#Issue when migrating from open v3 to openai v4 using automatic migration 'npm exec openai migrate'

1 messages · Page 1 of 1 (latest)

copper stratus
#

Hey team, any ideas if you can use https://www.npmjs.com/package/openai version 4 to interact with chatgpt v3.5?

I've tried an automatic migration from v3 npm module to v4 version npm exec openai migrate

here is my new code:

async createCompletionViaOpenAI(
    messages: OpenAI.Chat.ChatCompletionMessageParam[]
  ) {
    return await this.openai.chat.completions.create(
      {
        model: 'gpt-3.5-turbo',
        messages: messages,
      },
      {
        headers: {
          'Content-Type': 'application/json',
          'X-User-Agent': 'OpenAPI-Generator/1.0/Javascript',
        },
      }
    );
  }

 const completion = await this.chatService.createCompletionViaOpenAI(
        this.messages
      );
      console.log(completion); //returns null

the actual error that I am getting now completion is null

a bit more background, I am running the openai library in browser using angular v17, found that related issue https://github.com/openai/openai-node/issues/232

if roll back to v3, all works....

#

Issue when migrating from open v3 to openai v4 using automatic migration 'npm exec openai migrate'