-
Notifications
You must be signed in to change notification settings - Fork 209
Open
Description
Description
(C.f. discussion on Logfire's slack: https://pydanticlogfire.slack.com/archives/C06EDRBSAH3/p1771351911189739 )
The code looks like:
# Build request kwargs with thinking enabled
kwargs: dict[str, Any] = {
"model": self.model_name_map[self.model_params.model_version],
"messages": anthropic_messages,
"temperature": 1, # Only temperature of 1 is supported for thinking
"max_tokens": self._resolve_max_tokens(default_max_tokens=16384),
"stream": True,
"tools": anthropic_tools,
}
if system_message:
kwargs["system"] = system_message
# Add thinking parameter if budget specified
if thinking_budget is not None:
kwargs["thinking"] = {"type": "enabled", "budget_tokens": thinking_budget}
# Call Anthropic API with beta features for interleaved thinking
logger.debug(f"Starting agentic loop iteration {iteration_num}")
stream = await self.client.beta.messages.create(
betas=["interleaved-thinking-2025-05-14"], **kwargs
)Outputs aren't shown and instead the 'tool results' (user message sent back with tool results) are shown as outputs.
Python, Logfire & OS Versions, related packages (not required)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels