From dc3dc464b1352ea373ab926f01a58259e3a8bae3 Mon Sep 17 00:00:00 2001 From: Adel Janbeih <153122094+degghvz@users.noreply.github.com> Date: Sun, 22 Mar 2026 13:43:38 +0100 Subject: [PATCH] fix: correct indentation and add thinking_config to Anthropic client Fixed IndentationError in trading_graph.py within the _get_provider_kwargs method. Optimized logic to fetch the configuration value once instead of twice. Removed temporary French comments. Updated anthropic_client.py to include thinking_config in the allowed_keys whitelist so the parameters are properly passed to the LLM. --- tradingagents/graph/trading_graph.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tradingagents/graph/trading_graph.py b/tradingagents/graph/trading_graph.py index cb649f53..41c0bdf1 100644 --- a/tradingagents/graph/trading_graph.py +++ b/tradingagents/graph/trading_graph.py @@ -147,11 +147,16 @@ class TradingAgentsGraph: reasoning_effort = self.config.get("openai_reasoning_effort") if reasoning_effort: kwargs["reasoning_effort"] = reasoning_effort -# Ton nouveau code pour Anthropic - elif self.provider == "anthropic" and self.config.get("anthropic_thinking_budget"): - kwargs["thinking_config"] = {"type": "enabled", "budget_tokens": int(self.config["anthropic_thinking_budget"])} - return kwargs + elif provider == "anthropic": + thinking_budget = self.config.get("anthropic_thinking_budget") + if thinking_budget: + kwargs["thinking_config"] = { + "type": "enabled", + "budget_tokens": int(thinking_budget) + } + + return kwargs def _create_tool_nodes(self) -> Dict[str, ToolNode]: """Create tool nodes for different data sources using abstract methods.""" return {