From e413553dc88ccc0ccb36a8c503d16a50c10a1e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=B3=E8=99=8E?= Date: Tue, 17 Mar 2026 21:25:15 +0800 Subject: [PATCH] fix: apply base_url to GoogleClient to make v1beta endpoint work The previous change in cli/utils.py set base_url to v1beta, but it was never passed to ChatGoogleGenerativeAI. This fix ensures the custom endpoint is actually used, resolving the 404 error for embeddings. Addresses Gemini Code Assist review feedback on PR #385. --- tradingagents/llm_clients/google_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tradingagents/llm_clients/google_client.py b/tradingagents/llm_clients/google_client.py index 3dd85e3f..a4fc23e7 100644 --- a/tradingagents/llm_clients/google_client.py +++ b/tradingagents/llm_clients/google_client.py @@ -38,6 +38,10 @@ class GoogleClient(BaseLLMClient): """Return configured ChatGoogleGenerativeAI instance.""" llm_kwargs = {"model": self.model} + # Support custom base_url (e.g., v1beta endpoint for embeddings) + if self.base_url: + llm_kwargs["base_url"] = self.base_url + for key in ("timeout", "max_retries", "google_api_key", "callbacks", "http_client", "http_async_client"): if key in self.kwargs: llm_kwargs[key] = self.kwargs[key]