Closed caiorg closed 3 months ago
Hello @caiorg! ๐ I'm Dosu, a helpful bot here to assist you with bugs, answer your questions, and guide you on contributing while we wait for a human maintainer. I'm diving into your issue and will be back with a full answer shortly! ๐ค
It appears there's a discrepancy between the baseUrl
and apiVersion
you've configured and what the library is actually using, leading to the error. This suggests a potential bug in the library or a misconfiguration in your setup. Here are steps to troubleshoot and potentially resolve the issue:
Double-check the baseUrl
and apiVersion
: Ensure the values you're using are correct for the Google Generative AI API. Using incorrect or unsupported values could result in the API calls failing.
Review your setup: Make sure your configuration in the langchain-nextjs-template
matches the expected format, especially if you're providing a custom baseUrl
.
Inspect the library code: Look into the libs/langchain-google-genai/src/chat_models.ts
file to see how apiVersion
and baseUrl
are utilized. This could provide insights into whether these parameters are correctly applied to API calls.
If these steps don't resolve the issue, consider debugging the library code directly to trace how the apiVersion
and baseUrl
are handled during runtime. This might involve adding console logs or using a debugger to pinpoint where the custom settings are being ignored or overwritten.
This approach should help identify the root cause of the issue and guide you towards a solution. If you need further assistance, feel free to ask.
To continue the conversation, mention @dosu.
It appears there's a discrepancy between the
baseUrl
andapiVersion
you've configured and what the library is actually using, leading to the error. This suggests a potential bug in the library or a misconfiguration in your setup. Here are steps to troubleshoot and potentially resolve the issue:
- Double-check the
baseUrl
andapiVersion
: Ensure the values you're using are correct for the Google Generative AI API. Using incorrect or unsupported values could result in the API calls failing.- Review your setup: Make sure your configuration in the
langchain-nextjs-template
matches the expected format, especially if you're providing a custombaseUrl
.- Inspect the library code: Look into the
libs/langchain-google-genai/src/chat_models.ts
file to see howapiVersion
andbaseUrl
are utilized. This could provide insights into whether these parameters are correctly applied to API calls.If these steps don't resolve the issue, consider debugging the library code directly to trace how the
apiVersion
andbaseUrl
are handled during runtime. This might involve adding console logs or using a debugger to pinpoint where the custom settings are being ignored or overwritten.This approach should help identify the root cause of the issue and guide you towards a solution. If you need further assistance, feel free to ask.
Details
Sources
- libs/langchain-google-genai/src/chat_models.ts
- langchain/src/chains/api/api_chain.ts
- langchain/src/util/azure.ts
- libs/langchain-google-common/src/chat_models.ts
About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a ๐ if this is helpful and ๐ if it is irrelevant.
To continue the conversation, mention @dosu.
I've already done all the steps mentioned prior to opening this issue.
I've managed to get it worki FOR TESTING PURPOSES by altering the library code at lines and file as I mentioned earlier.
Duplicate of: #5437 Fixed by: #5483
I'm sorry, I've searched the issues and did not find #5437 before opening this issue.
Btw... I've 0.2.0 installed and don't see the fixes. As far as I understood, the fixes are just waiting to merge. I'm I right?
Fixed by #5490 (upgrade to v0.0.15)
Checked other resources
Example Code
The following code from langchain-nextjs-template, updated to use Google's Gemini 1.5 Pro does not work as intended when "querying" the model and waiting for a response.
FILE:
langchain-nextjs-template/app/api/chat/route.ts
Error Message and Stack Trace (if applicable)
After timining out, I'm presented a toaster with the contents of the following api error response:
Description
I'm trying to use
apiVersion
andbaseUrl
parameters to update the url, but those are not taken into account when bootstraping the client. This behaviour can be verified by using simpleconsole.log("this", this)
before and after initializingthis.client
variable.As per seen at lines 280 and 281 from
@langchain/google-genai
lib (not shure if other libs have the same issue):https://github.com/langchain-ai/langchainjs/blob/14e697f49ee3ce6486aa67b04e7f9e18a831600d/libs/langchain-google-genai/src/chat_models.ts#L280
and
https://github.com/langchain-ai/langchainjs/blob/14e697f49ee3ce6486aa67b04e7f9e18a831600d/libs/langchain-google-genai/src/chat_models.ts#L281
It looks like it would need to follow the same approach at line 242 from the same file:
https://github.com/langchain-ai/langchainjs/blob/14e697f49ee3ce6486aa67b04e7f9e18a831600d/libs/langchain-google-genai/src/chat_models.ts#L242
System Info
BTW... tried using the latest stable version too.
EDIT 1: Forgot to mention that when testing, I was using a real Google API Key, but ommited here changing it to
MY_API_KEY
.