langchainjs: All requests through langchain to OpenAI timeout
Trying to add langchainjs to my Node.js project but whenever calling any function related to OpenAI the requests timeout. I also downloaded the repo, configured it and ran the examples but the results were exactly the same, it just times out.
For example:
const model = new OpenAI({ temperature: 0.9, modelName: "gpt-3.5-turbo" , timeout: 20})
const response = await model.generate(["Tell me a joke."]);
console.log(response)
When directly using the OpenAI node package then it works perfectly
const configuration = new Configuration({
organization: orgId,
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createChatCompletion({model: 'gpt-3.5-turbo', temperature: 0, messages: [{role: 'user', content: 'hi there'}]})
console.log(response)
Hoping for some feedback. Thanks!
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 18
Haha no worries
@nfcampos Get the f**k out of here 😡 😂 😂 . Obviously I assumed it to be seconds and for some reason I initially added the timeout there because it seemed like it was not working so in my mind I increased the timeout instead of setting it to
20ms.Managed to dwelve into the deepest depths of
langchainfor 1+ day just to find out my fatal mistake was the dumbest one …In your case perhaps the issue might be that you should change examples to use
modelName: "gpt-3.5-turbo"since currently I see that by default it usesgpt-4for which you might not have access. For me though it is not the issue.