From 964fde3decb78cb2fc65d6311c4c4e395febd056 Mon Sep 17 00:00:00 2001 From: Cheng Zhang Date: Tue, 10 Mar 2026 23:27:41 +0000 Subject: [PATCH 1/2] messages api reasoning efforts --- docs/control/reference/rest_api/messages.md | 2 ++ src/sequrity/control/resources/messages.py | 10 +++++++++ src/sequrity/control/types/headers.py | 2 +- src/sequrity/types/chat_completion/request.py | 4 ++-- src/sequrity/types/messages/request.py | 21 ++++++++++++++++++- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/docs/control/reference/rest_api/messages.md b/docs/control/reference/rest_api/messages.md index be35ceb..ac27b06 100644 --- a/docs/control/reference/rest_api/messages.md +++ b/docs/control/reference/rest_api/messages.md @@ -27,6 +27,7 @@ Where `{endpoint_type}` is `chat`, `code`, `agent`, or `lang-graph`. See [URL Pa | `tools` | `array[ToolParam]` | No | Tool definitions the model may use. See [Tools](#tools). | | `tool_choice` | `ToolChoice` | No | How the model should use tools. See [Tool Choice](#tool-choice). | | `thinking` | `ThinkingConfig` | No | Extended thinking configuration. See [Thinking](#thinking). | +| `reasoning_effort` | `string` | No | Reasoning effort for reasoning models: `"none"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`. | | `stop_sequences` | `array[string]` | No | Custom stop sequences. | | `stream` | `boolean` | No | If `true`, stream the response via server-sent events. | | `output_config` | `OutputConfig` | No | Output format configuration (e.g. JSON schema). | @@ -132,6 +133,7 @@ Extended thinking configuration. Discriminated by `type`: |------|--------|-------------| | `enabled` | `budget_tokens` (int, min 1024) | Enable thinking with a token budget. | | `disabled` | — | Disable thinking. | +| `adaptive` | — | Claude automatically decides whether to use extended thinking based on request complexity. | ### Output Config diff --git a/src/sequrity/control/resources/messages.py b/src/sequrity/control/resources/messages.py index 4249c89..508d55d 100644 --- a/src/sequrity/control/resources/messages.py +++ b/src/sequrity/control/resources/messages.py @@ -11,6 +11,7 @@ MessageParam, MetadataParam, OutputConfigParam, + ReasoningEffort, TextBlockParam, ThinkingConfigParam, ToolChoiceParam, @@ -43,6 +44,7 @@ def create( tools: list[ToolParam | dict] | None = None, tool_choice: ToolChoiceParam | dict | None = None, thinking: ThinkingConfigParam | dict | None = None, + reasoning_effort: ReasoningEffort | None = None, stop_sequences: list[str] | None = None, stream: Literal[True], output_config: OutputConfigParam | dict | None = None, @@ -76,6 +78,7 @@ def create( tools: list[ToolParam | dict] | None = None, tool_choice: ToolChoiceParam | dict | None = None, thinking: ThinkingConfigParam | dict | None = None, + reasoning_effort: ReasoningEffort | None = None, stop_sequences: list[str] | None = None, stream: Literal[False] | None = None, output_config: OutputConfigParam | dict | None = None, @@ -109,6 +112,7 @@ def create( tools: list[ToolParam | dict] | None = None, tool_choice: ToolChoiceParam | dict | None = None, thinking: ThinkingConfigParam | dict | None = None, + reasoning_effort: ReasoningEffort | None = None, stop_sequences: list[str] | None = None, stream: bool | None = None, output_config: OutputConfigParam | dict | None = None, @@ -141,6 +145,7 @@ def create( tools: List of tool definitions available to the model. tool_choice: How the model should use the provided tools. thinking: Configuration for extended thinking. + reasoning_effort: Reasoning effort level for supported models. stop_sequences: Custom text sequences that cause the model to stop. stream: Whether to stream the response. When ``True``, returns a :class:`SyncStream` of :class:`AnthropicStreamEvent` objects. @@ -179,6 +184,7 @@ def create( "tools": tools, "tool_choice": tool_choice, "thinking": thinking, + "reasoning_effort": reasoning_effort, "top_k": top_k, "top_p": top_p, "output_config": output_config, @@ -248,6 +254,7 @@ async def create( tools: list[ToolParam | dict] | None = None, tool_choice: ToolChoiceParam | dict | None = None, thinking: ThinkingConfigParam | dict | None = None, + reasoning_effort: ReasoningEffort | None = None, stop_sequences: list[str] | None = None, stream: Literal[True], output_config: OutputConfigParam | dict | None = None, @@ -281,6 +288,7 @@ async def create( tools: list[ToolParam | dict] | None = None, tool_choice: ToolChoiceParam | dict | None = None, thinking: ThinkingConfigParam | dict | None = None, + reasoning_effort: ReasoningEffort | None = None, stop_sequences: list[str] | None = None, stream: Literal[False] | None = None, output_config: OutputConfigParam | dict | None = None, @@ -313,6 +321,7 @@ async def create( tools: list[ToolParam | dict] | None = None, tool_choice: ToolChoiceParam | dict | None = None, thinking: ThinkingConfigParam | dict | None = None, + reasoning_effort: ReasoningEffort | None = None, stop_sequences: list[str] | None = None, stream: bool | None = None, output_config: OutputConfigParam | dict | None = None, @@ -344,6 +353,7 @@ async def create( "tools": tools, "tool_choice": tool_choice, "thinking": thinking, + "reasoning_effort": reasoning_effort, "top_k": top_k, "top_p": top_p, "output_config": output_config, diff --git a/src/sequrity/control/types/headers.py b/src/sequrity/control/types/headers.py index e77ffe3..0d38766 100644 --- a/src/sequrity/control/types/headers.py +++ b/src/sequrity/control/types/headers.py @@ -478,7 +478,7 @@ class PllmPromptOverrides(BaseModel): model_config = ConfigDict(extra="forbid") flavor: PromptFlavor | str | None = Field( - default=None, description="Prompt template variant to use (e.g., 'universal')." + default=None, description="Prompt template variant to use (e.g., 'universal', 'code')." ) version: PromptVersion | str | None = Field( default=None, diff --git a/src/sequrity/types/chat_completion/request.py b/src/sequrity/types/chat_completion/request.py index 6634417..5accb53 100644 --- a/src/sequrity/types/chat_completion/request.py +++ b/src/sequrity/types/chat_completion/request.py @@ -325,7 +325,7 @@ class ResponseFormatJsonSchema(BaseModel): ResponseFormat = ResponseFormatText | ResponseFormatJsonObject | ResponseFormatJsonSchema -ReasoningEffort = Literal["minimal", "low", "medium", "high"] +ReasoningEffort = Literal["none", "minimal", "low", "medium", "high", "xhigh"] # ============================================================================= # Main Request Class @@ -347,7 +347,7 @@ class ChatCompletionRequest(BaseModel): # Optional fields reasoning_effort: ReasoningEffort | None = Field( default=None, - description="Constrains effort on reasoning for reasoning models. Supported values are 'minimal', 'low', 'medium', and 'high'.", + description="Constrains effort on reasoning for reasoning models. Supported values are 'none', 'minimal', 'low', 'medium', 'high', and 'xhigh'.", ) response_format: ResponseFormat | None = Field( default=None, diff --git a/src/sequrity/types/messages/request.py b/src/sequrity/types/messages/request.py index 8fe7a2a..381cbff 100644 --- a/src/sequrity/types/messages/request.py +++ b/src/sequrity/types/messages/request.py @@ -325,11 +325,26 @@ class ThinkingConfigDisabledParam(BaseModel): model_config = ConfigDict(extra="ignore") +class ThinkingConfigAdaptiveParam(BaseModel): + """Adaptive thinking configuration. + + Claude automatically decides whether to use extended thinking based on the complexity of the request. + """ + + type: Literal["adaptive"] = Field( + default="adaptive", description="Claude automatically decides whether to use extended thinking." + ) + + model_config = ConfigDict(extra="ignore") + + ThinkingConfigParam = Annotated[ - ThinkingConfigEnabledParam | ThinkingConfigDisabledParam, + ThinkingConfigEnabledParam | ThinkingConfigDisabledParam | ThinkingConfigAdaptiveParam, Field(discriminator="type"), ] +ReasoningEffort = Literal["none", "minimal", "low", "medium", "high", "xhigh"] + # ============================================================================= # Main Request Class @@ -359,6 +374,10 @@ class AnthropicMessageRequest(BaseModel): # Optional fields metadata: MetadataParam | None = Field(default=None, description="An object describing metadata about the request.") + reasoning_effort: ReasoningEffort | None = Field( + default=None, + description="Constrains effort on reasoning for reasoning models. Supported values are 'none', 'minimal', 'low', 'medium', 'high', and 'xhigh'.", + ) output_config: OutputConfigParam | None = Field( default=None, description="Configuration options for the model's output, such as the output format." ) From 947c1454e770a068b4de0d2c78b49b7d8ee9dfa3 Mon Sep 17 00:00:00 2001 From: Cheng Zhang Date: Wed, 11 Mar 2026 09:33:39 +0000 Subject: [PATCH 2/2] upgrade version --- docs/release_notes.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/release_notes.md b/docs/release_notes.md index 61d6d7a..23ce178 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -5,6 +5,20 @@ hide: # Release Notes +## v0.4.2 + +`time: 2026-03-11` + +| Product | Version | +| ---------|---------| +| Control API | `60c3b428492056c3a31711d314a6978040f43774` | + +??? info "v0.4.2 Release Notes" + + **Updates** + - Updated reasoning efforts to match Anthropic's adaptive thinking + - Add Dual-LLM prompt flavor 'code' + ## v0.4.1 `time: 2026-02-25`