-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
The baseUrl passed to ChatGoogleGenerativeAI does not work #627
Comments
I was just about to create an issue for this I can't use a proxy with [ ] I/flutter ( 6522): │ API key not valid. Please pass a valid API key.
[ +7 ms] I/flutter ( 6522):
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
[ ] I/flutter ( 6522): │ #0 parseBatchEmbedContentsResponse (package:google_generative_ai/src/api.dart:631:38)
[ ] I/flutter ( 6522): │ #1 <asynchronous suspension>
[ ] I/flutter ( 6522): │ #2 GoogleGenerativeAIEmbeddings.embedDocuments.<anonymous closure>
(package:langchain_google/src/embeddings/google_ai/google_ai_embeddings.dart:162:22)
[ ] I/flutter ( 6522): │ #3 <asynchronous suspension>
[ ] I/flutter ( 6522): │ #4 Future.wait.<anonymous closure> (dart:async/future.dart:520:21)
[ ] I/flutter ( 6522): │ #5 <asynchronous suspension>
[ ] I/flutter ( 6522): │ #6 GoogleGenerativeAIEmbeddings.embedDocuments
(package:langchain_google/src/embeddings/google_ai/google_ai_embeddings.dart:160:49)
[ ] I/flutter ( 6522): │ #7 <asynchronous suspension> Error seems to be coming from here: BatchEmbedContentsResponse parseBatchEmbedContentsResponse(Object jsonObject) {
return switch (jsonObject) {
{'embeddings': final List<Object?> embeddings} =>
BatchEmbedContentsResponse(
embeddings.map(_parseContentEmbedding).toList()),
{'error': final Object error} => throw parseError(error),
_ => throw unhandledFormat('EmbedContentResponse', jsonObject)
};
} and here: GenerativeAIException parseError(Object jsonObject) {
return switch (jsonObject) {
{
'message': final String message,
'details': [{'reason': 'API_KEY_INVALID'}, ...]
} =>
InvalidApiKey(message),
{'message': UnsupportedUserLocation._message} => UnsupportedUserLocation(),
{'message': final String message} => ServerException(message),
_ => throw unhandledFormat('server error', jsonObject)
};
} It was working fine about a month ago, the |
I'll take a look. I remember I had to use a custom http client to override the base url as the |
System Info
langchain: 0.7.7+1
langchain_google: 0.6.4+1
dart: 3.5.4
flutter: 3.24.5
Related Components
Reproduction
Here's my code (with a few things omitted):
I set the baseUrl to 'abc' (an incorrect Url), but llm.invoke returns the message just fine. I'm guessing that llm isn't using the baseUrl I set to initiate the request.
Expected behavior
As stated above, the custom baseUrl should take effect.
I only tested ChatGoogleGenerativeAI and found this issue. I'm not sure if other components (e.g. GoogleGenerativeAI...) also have this problem.
Thanks again for creating langchain_dart.
The text was updated successfully, but these errors were encountered: