-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Checked other resources
- This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
- I added a very descriptive title to this issue.
- I searched the LangChain.js documentation with the integrated search.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain.js rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
No need to put in valid values, the error happens before invoking the final call.
await new AzureChatOpenAI({
model: 'modelName',
azureOpenAIBasePath: 'azureOpenAIBasePath',
azureOpenAIApiDeploymentName: 'azureOpenAIApiDeploymentName',
azureOpenAIApiVersion: 'azureOpenAIApiVersion',
azureADTokenProvider: () => {
return Promise.resolve('token');
},
}).invoke([]);
Error Message and Stack Trace (if applicable)
Error: The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).
at new AzureOpenAI (foo/node_modules/openai/src/azure.ts:72:13)
at ChatOpenAICompletions._getClientOptions (file://foo/node_modules/@langchain/openai/dist/azure/chat_models.js:567:27)
at ChatOpenAICompletions.completionWithRetry (file://foo/node_modules/@langchain/openai/dist/chat_models.js:1910:36)
at ChatOpenAICompletions._generate (file://foo/node_modules/@langchain/openai/dist/chat_models.js:1737:37)
at AzureChatOpenAI._generate (file://foo/node_modules/@langchain/openai/dist/chat_models.js:2664:33)
at file://foo/node_modules/@langchain/core/dist/language_models/chat_models.js:250:96
at Array.map ()
at AzureChatOpenAI._generateUncached (file://foo/node_modules/@langchain/core/dist/language_models/chat_models.js:250:67)
at async AzureChatOpenAI.invoke (file://foo/node_modules/@langchain/core/dist/language_models/chat_models.js:88:24)
Description
Follow up of #8519. After updating to "@langchain/openai": "0.6.2" the error changed from missing api key to missing api version.
System Info
"@langchain/core": "0.3.66",
"@langchain/textsplitters": "0.1.0",
"langchain": "0.3.30",