Helicone Community Page

Updated 3 months ago

TypeError: Cannot read properties of undefined (reading '0')

Plain Text
{"helicone-message":"Helicone ran into an error servicing your request: TypeError: Cannot read properties of undefined (reading '0')","support":"Please reach out on our discord or email us at [email protected], we'd love to help!","helicone-error":"{}"}


Plain Text
import { createAnthropic } from "@ai-sdk/anthropic";
import { createOpenAI } from "@ai-sdk/openai";

export const heliconeDefaultHeaders = {
  "Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`,
  "Helicone-Cache-Enabled": "true",
  "Helicone-Moderations-Enabled": "true",
  "Helicone-LLM-Security-Enabled": "true",
  "Helicone-Retry-Enabled": "true",
  "Helicone-Retry-Num": "7",
  "Helicone-Retry-Min-Timeout": "1000",
};

export const openaiprovider = createOpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: "https://oai.helicone.ai/v1",
  headers: heliconeDefaultHeaders,
});

export const anthropicprovider = createAnthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
  baseURL: "https://anthropic.helicone.ai/v1",
  headers: heliconeDefaultHeaders,
});

export const groqprovider = createOpenAI({
  apiKey: process.env.GROQ_API_KEY,
  baseUrl: "https://groq.helicone.ai/openai/v1",
  headers: heliconeDefaultHeaders,
});
e
C
5 comments
^ getting this on the openAI provider, used to work totally fine πŸ€”
Plain Text
    "@ai-sdk/anthropic": "^0.0.39",
    "@ai-sdk/openai": "^0.0.44",
Yo! Did a bunch of testing, this seems to happen for me with the header
Plain Text
"Helicone-Moderations-Enabled": "true",

on gpt-4o models (using the latest one, at least, gpt-4o-2024-08-06)
Oh thank you
Heyo! Lmk if this was fixed πŸ™ Want to put it back into my code, hahah!
Add a reply
Sign up and join the conversation on Discord