Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/pygpt_net/provider/api/anthropic/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ def send(self, context: BridgeContext, extra: Optional[Dict[str, Any]] = None):
# Add optional fields only if provided
if system_prompt:
params["system"] = system_prompt # SDK expects string or blocks, not None
if temperature is not None:
params["temperature"] = temperature # keep as-is; upstream config controls the type
if top_p is not None:
params["top_p"] = top_p
# Claude 4.x: top_p is rejected when temperature is also present.
# Opus 4.x and claude-3-7-sonnet have deprecated temperature entirely (extended thinking).
_no_temp = ("claude-opus-4-", "claude-3-7-sonnet")
if temperature is not None and not any(model.id.startswith(p) for p in _no_temp):
params["temperature"] = temperature
if tools: # only include when non-empty list
params["tools"] = tools # must be a valid list per API
if mcp_servers:
Expand Down