Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Request 400 status code: "You must provide a model parameter" when attempting any openAI .call method #336

Closed
snapdeus opened this issue Mar 15, 2023 · 4 comments
Labels
env/packaging Issues related to packaging/bundling

Comments

@snapdeus
Copy link

Greetings,

When using Node 18.1.0, or lower, on both Ubuntu 20.0.4 and Windows 10:

Attempting to use the method .call() results in a 400 status code.
image

Here is my code:

import { ChatOpenAI } from "langchain/chat_models"
import { HumanChatMessage } from 'langchain/schema'
import dotenv from 'dotenv'
dotenv.config()

const chat = new ChatOpenAI({
    openAIApiKey: process.env.OPENAI_API_KEY,
    temperature: 0.9

})
async function getChat() {
    const response = await chat.call([
        new HumanChatMessage(
            "Translate this sentence from English to French. I love programming."
        ),
    ]);


}

getChat()

Things I have tried:

  • Instead of passing the openAIApiKey as a parameter with .call(), I instead ran package.json script: npm run dev which was defined as node -r dotenv/config index.js
  • Downgrading to Node 16.8.0 and setting NODE_ENV to experimental
  • Downgrading the version of langchain to 0.0.22

TEMPORARY SOLUTION

After changing my Node version to 18.2.0, the error does NOT happen!

What I suspect may be the cause:

Something with AxiosFetchAdapter...that's the only thing I can think of!

@nfcampos
Copy link
Collaborator

Hi

In general it's not recommended to stick with old minor versions of Node. We only support running Langchain on the most recent versions of Node.js 16.x, 18.x, 19.x

@nfcampos nfcampos added the env/packaging Issues related to packaging/bundling label Mar 18, 2023
@jacobcwright
Copy link

Still getting this error with node v18.16.0

@nfcampos
Copy link
Collaborator

nfcampos commented May 9, 2023

Duplicate of #1010

@Developergovind
Copy link

same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
env/packaging Issues related to packaging/bundling
Projects
None yet
Development

No branches or pull requests

4 participants