Make budget_tokens optional in AnthropicThinkingConfig
budget_tokens is required when type is "enabled" and rejected when type is "disabled" (this is validated by the server)
This commit is contained in:
@@ -76,16 +76,16 @@ class AnthropicThinkingConfig(BaseModel):
|
|||||||
type: Type of thinking mode (currently only "enabled" or "disabled").
|
type: Type of thinking mode (currently only "enabled" or "disabled").
|
||||||
budget_tokens: Maximum number of tokens for thinking.
|
budget_tokens: Maximum number of tokens for thinking.
|
||||||
With today's models, the minimum is 1024.
|
With today's models, the minimum is 1024.
|
||||||
Only allowed if type is "enabled".
|
Currently required when type is "enabled", not allowed when "disabled".
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Why `| str` here? To not break compatibility in case Anthropic adds
|
# Why `| str` here? To not break compatibility in case Anthropic adds
|
||||||
# more types in the future.
|
# more types in the future.
|
||||||
type: Literal["enabled", "disabled"] | str
|
type: Literal["enabled", "disabled"] | str
|
||||||
|
|
||||||
# Why not enforce minimnum of 1024 here? To not break compatibility in
|
# No client-side validation on budget_tokens — we let the server
|
||||||
# case Anthropic changes this requirement in the future.
|
# enforce the rules so we stay forward-compatible if they change.
|
||||||
budget_tokens: int
|
budget_tokens: Optional[int] = None
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
Reference in New Issue
Block a user