Python
fix: add http_client support for SSL certificate customization
阳虎64f07671b973
diff --git a/tradingagents/llm_clients/anthropic_client.py b/tradingagents/llm_clients/anthropic_client.pyindex e2f1abba2..8539c7527 100644--- a/tradingagents/llm_clients/anthropic_client.py+++ b/tradingagents/llm_clients/anthropic_client.py@@ -16,7 +16,7 @@ class AnthropicClient(BaseLLMClient):"""Return configured ChatAnthropic instance."""llm_kwargs = {"model": self.model}- for key in ("timeout", "max_retries", "api_key", "max_tokens", "callbacks"):+ for key in ("timeout", "max_retries", "api_key", "max_tokens", "callbacks", "http_client", "http_async_client"):if key in self.kwargs:llm_kwargs[key] = self.kwargs[key]diff --git a/tradingagents/llm_clients/factory.py b/tradingagents/llm_clients/factory.pyindex 028c88a28..93c2a7d34 100644--- a/tradingagents/llm_clients/factory.py+++ b/tradingagents/llm_clients/factory.py@@ -19,6 +19,12 @@ def create_llm_client(model: Model name/identifierbase_url: Optional base URL for API endpoint**kwargs: Additional provider-specific arguments+ - http_client: Custom httpx.Client for SSL proxy or certificate customization+ - http_async_client: Custom httpx.AsyncClient for async operations+ - timeout: Request timeout in seconds+ - max_retries: Maximum retry attempts+ - api_key: API key for the provider+ - callbacks: LangChain callbacksReturns:Configured BaseLLMClient instancediff --git a/tradingagents/llm_clients/google_client.py b/tradingagents/llm_clients/google_client.pyindex a1bd386b3..3dd85e3f6 100644--- a/tradingagents/llm_clients/google_client.py+++ b/tradingagents/llm_clients/google_client.py@@ -38,7 +38,7 @@ class GoogleClient(BaseLLMClient):"""Return configured ChatGoogleGenerativeAI instance."""llm_kwargs = {"model": self.model}- for key in ("timeout", "max_retries", "google_api_key", "callbacks"):+ 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]diff --git a/tradingagents/llm_clients/openai_client.py b/tradingagents/llm_clients/openai_client.pyindex 924f24b03..4605c1f94 100644--- a/tradingagents/llm_clients/openai_client.py+++ b/tradingagents/llm_clients/openai_client.py@@ -59,7 +59,7 @@ class OpenAIClient(BaseLLMClient):elif self.base_url:llm_kwargs["base_url"] = self.base_url- for key in ("timeout", "max_retries", "reasoning_effort", "api_key", "callbacks"):+ for key in ("timeout", "max_retries", "reasoning_effort", "api_key", "callbacks", "http_client", "http_async_client"):if key in self.kwargs:llm_kwargs[key] = self.kwargs[key]