mirror of
https://github.com/farcasclaudiu/TradingAgents.git
synced 2026-06-29 03:01:24 +03:00
fix(llm_clients): standardize Google API key to unified api_key param
GoogleClient now accepts the unified `api_key` parameter used by OpenAI and Anthropic clients, mapping it to the provider-specific `google_api_key` that ChatGoogleGenerativeAI expects. Legacy `google_api_key` still works for backward compatibility. Resolves TODO.md item #2 (inconsistent parameter handling).
This commit is contained in:
@@ -27,10 +27,16 @@ class GoogleClient(BaseLLMClient):
|
||||
"""Return configured ChatGoogleGenerativeAI instance."""
|
||||
llm_kwargs = {"model": self.model}
|
||||
|
||||
for key in ("timeout", "max_retries", "google_api_key", "callbacks", "http_client", "http_async_client"):
|
||||
for key in ("timeout", "max_retries", "callbacks", "http_client", "http_async_client"):
|
||||
if key in self.kwargs:
|
||||
llm_kwargs[key] = self.kwargs[key]
|
||||
|
||||
# Unified api_key maps to provider-specific google_api_key
|
||||
if "api_key" in self.kwargs:
|
||||
llm_kwargs["google_api_key"] = self.kwargs["api_key"]
|
||||
elif "google_api_key" in self.kwargs:
|
||||
llm_kwargs["google_api_key"] = self.kwargs["google_api_key"]
|
||||
|
||||
# Map thinking_level to appropriate API param based on model
|
||||
# Gemini 3 Pro: low, high
|
||||
# Gemini 3 Flash: minimal, low, medium, high
|
||||
|
||||
Reference in New Issue
Block a user