Closed racso-dev closed 5 days ago
Thank you for providing detailed information about the issue you're facing. Based on the error message you've shared, it seems like the error is being thrown from the async_caller.cjs
file in the @langchain/core
package. However, without more specific information about the error object, it's difficult to pinpoint the exact cause of the issue.
From the context provided, it appears that there have been similar issues reported in the past. For instance, issue #4955 seems to be a duplicate of your issue but with the use of AzureChatOpenAI
instead of AzureOpenAI
. This issue was resolved by a pull request: azure-openai[patch]: fix azureOpenAIApiKey not working. It might be worth checking if the changes made in this pull request are applicable to your case.
Additionally, there are a few other closed issues that might be relevant:
AzureOpenAI Content Filter Error cause unhandled error: This issue suggests that the problem might be resolved when integrating the new OpenAI SDK.
Azure OpenAI call gets Bad Authorization header: This issue suggests ensuring that the AZURE_OPENAI_API_KEY
and other Azure OpenAI related environment variables are correctly set in your environment or passed in the fields
object when creating a new ChatOpenAI
instance.
Langchain and Azure ChatOpenAI is not working: This issue suggests setting the environment variables directly.
Given the information you've provided, I would recommend the following steps:
Double-check your environment variables and the parameters you're passing to the AzureOpenAI
constructor. Make sure they match the expected format and type as described in the LangChain.js documentation.
Try to get more information about the error object. The current error message is not very informative as it only shows [object Object]
. You could try logging error.message
or JSON.stringify(error)
to get more details about the error.
If the error persists, please provide more information about the error object and any other relevant details. This will help us better understand the issue and provide a more accurate solution.
I hope this helps! If you have any other questions or need further clarification, feel free to ask. Dosu
Any updates on this? Facing the same issue With error - Error: [object Object] at /app/server/node_modules/@langchain/core/dist/utils/async_caller.cjs:98:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async RetryOperation._fn (/app/server/node_modules/p-retry/index.js:50:12) { attemptNumber: 7, retriesLeft: 0 }
On using both AzureOpenAI as well as AzureChatOpenAI. Already tried the fix suggested in #4955 but that did not fix the issue
Up
I'm facing the same error.
When I use @langchain/openai, the error is:
Error: OpenAI or Azure OpenAI API key or Token Provider not found
at new ChatOpenAI (/Users/zouang/code/LangchainJSTest/node_modules/@langchain/openai/dist/chat_models.cjs:426:19)
at new AzureChatOpenAI (/Users/zouang/code/LangchainJSTest/node_modules/@langchain/openai/dist/azure/chat_models.cjs:25:9)
at Object.<anonymous> (/Users/zouang/code/LangchainJSTest/index.js:13:19)
at Module._compile (node:internal/modules/cjs/loader:1368:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
at Module.load (node:internal/modules/cjs/loader:1205:32)
at Module._load (node:internal/modules/cjs/loader:1021:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
at node:internal/main/run_main_module:28:49
When I use @langchain/azure-openai, the error is:
The sample encountered an error: Error: [object Object]
at /Users/zouang/code/LangchainJSTest/node_modules/@langchain/core/dist/utils/async_caller.cjs:98:23
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RetryOperation._fn (/Users/zouang/code/LangchainJSTest/node_modules/p-retry/index.js:50:12) {
attemptNumber: 7,
retriesLeft: 0
up
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
"error":{"message":"[object Object]","stack":"Error: [object Object]\n at /app/node_modules/.pnpm/@langchain+core@0.1.27/node_modules/@langchain/core/dist/utils/async_caller.cjs:101:23\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at RetryOperation._fn (/app/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js:50:12)"}
Description
It's a duplicate of 4955 except that I'm using
import { AzureOpenAI } from '@langchain/azure-openai'
instead ofimport { AzureChatOpenAI } from '@langchain/azure-openai'
As a quick fix I'm using
AzureChatOpenAI
but just creating the issue so you can fix bothSystem Info
yarn info v1.22.19
platform: ubuntu 22.04 node version : v20.12.1 pnpm version : 8.15.6