Helicone Community Page

Updated 4 months ago

Langchain js integration

Hey! Is the following supposed to just work out of the box in a langchain next js app:
Plain Text
const model = new ChatOpenAI(
      {
        modelName: "gpt-3.5-turbo",
        temperature: 0.2,
      },
      {
        basePath: "https://oai.hconeai.com/v1",
      },
    );

Because I don't see any logs in the helicone console. I added my api key as the env var HELICONE_API_KEY. Am I missing something??
s
C
2 comments
ah worked it out! this is how you do it for reference:
Plain Text
const model = new ChatOpenAI({
      modelName: "gpt-3.5-turbo",
      temperature: 0.2,
      configuration: {
        basePath: "https://oai.hconeai.com/v1",
        baseOptions: {
          headers: {
            "Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY as string}`,
          },
        },
      },
    });
Thanks , docs for OpenAI & Anthropic w/ LangChain have been updated:

https://docs.helicone.ai/getting-started/integration-method/openai-proxy
Add a reply
Sign up and join the conversation on Discord