Helicone Community Page

Home
Members
mjyoung
m
mjyoung
Offline, last seen 2 months ago
Joined November 6, 2024
Is there sample code for how to incorporate the AsyncLogger into a nextjs app? I had no trouble setting up the proxy, but trying to use the async package instead to avoid any extra network latency as well as helicone being in my app's critical path. Not having much luck integrating though.

I have something like:
Plain Text
export const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY ?? '',
 
});

export const heliconeAsyncLogger = new HeliconeAsyncLogger({
  apiKey: process.env.HELICONE_API_KEY ?? '',
  providers: {
    openAI: OpenAI,
  },
   headers: {
     'Helicone-Property-App-Env': APP_ENV,
     'Helicone-Property-MYoung-Test': 'Test',
   },
});

heliconeAsyncLogger.init();


But i'm not seeing the requests come through the console. I tried moving heliconeAsyncLogger.init() out into other parts of the code, such as the exact function where I make the GPT call but it doesn't seem to help.

Will this log correctly if I'm using OpenAI's beta client? I'm using openai.beta.chat.completion... so that I can use their new structured outputs feature
4 comments
C
m