Rebase onto upstream (a4d95fd)
#12
@@ -257,9 +257,10 @@ class AnthropicOAuthProvider(LLMProvider):
|
||||
payload["tools"] = tools
|
||||
|
||||
logger.info(
|
||||
"Anthropic request: model=%s max_tokens=%d thinking=%s",
|
||||
"Anthropic request: model={} max_tokens={} thinking={} tools={}",
|
||||
payload.get("model"), payload.get("max_tokens"),
|
||||
payload.get("thinking", "disabled"),
|
||||
len(payload.get("tools", [])),
|
||||
)
|
||||
|
||||
response = await client.post(
|
||||
@@ -348,25 +349,19 @@ class AnthropicOAuthProvider(LLMProvider):
|
||||
),
|
||||
}
|
||||
|
||||
# Log usage and thinking info
|
||||
if thinking_blocks:
|
||||
thinking_chars = sum(len(b.get("thinking", "")) for b in thinking_blocks)
|
||||
stop_reason = response.get("stop_reason", "end_turn")
|
||||
thinking_chars = sum(len(b.get("thinking", "")) for b in thinking_blocks) if thinking_blocks else 0
|
||||
logger.info(
|
||||
"Anthropic response: %d thinking block(s) (%d chars), "
|
||||
"input=%d output=%d tokens",
|
||||
len(thinking_blocks), thinking_chars,
|
||||
usage.get("prompt_tokens", 0), usage.get("completion_tokens", 0),
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
"Anthropic response: no thinking blocks, input=%d output=%d tokens",
|
||||
"Anthropic response: stop={} tool_calls={} thinking={} chars, "
|
||||
"input={} output={} tokens",
|
||||
stop_reason, len(tool_calls), thinking_chars,
|
||||
usage.get("prompt_tokens", 0), usage.get("completion_tokens", 0),
|
||||
)
|
||||
|
||||
return LLMResponse(
|
||||
content=text_content or None,
|
||||
tool_calls=tool_calls,
|
||||
finish_reason=response.get("stop_reason", "end_turn"),
|
||||
finish_reason=stop_reason,
|
||||
usage=usage,
|
||||
reasoning_content=thinking_blocks or None,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user