From dd9c69d9f9335a3a39ae978ec078834beeabcdf5 Mon Sep 17 00:00:00 2001 From: Cheng Zhang Date: Thu, 19 Feb 2026 21:16:54 +0000 Subject: [PATCH 1/2] update docs --- .../rest_api/headers/security_config.md | 172 ++++++----- .../rest_api/headers/security_features.md | 10 +- .../rest_api/headers/security_policy.md | 20 +- src/sequrity/control/types/headers.py | 276 +++++++++++++----- 4 files changed, 313 insertions(+), 165 deletions(-) diff --git a/docs/control/reference/rest_api/headers/security_config.md b/docs/control/reference/rest_api/headers/security_config.md index fe67d4a..6668549 100644 --- a/docs/control/reference/rest_api/headers/security_config.md +++ b/docs/control/reference/rest_api/headers/security_config.md @@ -12,6 +12,7 @@ This header is **optional** and can be used in Headers-Only Mode to fine-tune se "min_num_tools_for_filtering": 10, "clear_session_meta": "never", "max_n_turns": null, + "allow_history_mismatch": null, "clear_history_every_n_attempts": null, "disable_rllm": true, "enable_multistep_planning": null, @@ -19,6 +20,7 @@ This header is **optional** and can be used in Headers-Only Mode to fine-tune se "prune_failed_steps": false, "force_to_cache": [], "max_pllm_steps": null, + "max_pllm_failed_steps": null, "max_tool_calls_per_step": null, "reduced_grammar_for_rllm_review": true, "retry_on_policy_violation": false, @@ -30,6 +32,8 @@ This header is **optional** and can be used in Headers-Only Mode to fine-tune se }, "prompt": { "pllm": { + "flavor": null, + "version": null, "debug_info_level": "normal", "clarify_ambiguous_queries": null, "context_var_visibility": null, @@ -40,7 +44,15 @@ This header is **optional** and can be used in Headers-Only Mode to fine-tune se "query_include_tool_results": null }, "rllm": { + "flavor": null, + "version": null, "debug_info_level": null + }, + "tllm": { + "flavor": null, + "version": null, + "add_tool_description": null, + "add_tool_input_schema": null } }, "response_format": { @@ -58,7 +70,7 @@ The configuration is organized into three sections: - **`fsm`**: FSM (Finite State Machine) overrides for execution behavior - **`prompt`**: Per-LLM prompt configuration overrides -- **`response_format`**: Response format and content settings +- **`response_format`**: Response format configuration for dual-LLM sessions All fields are optional and have sensible defaults. @@ -74,7 +86,7 @@ All fields are optional and have sensible defaults. |------|----------|---------|-------------| | `integer` or `null` | No | `10` | >= 2 | -Minimum number of available tools to trigger tool filtering. If fewer tools are available, no filtering is performed. +Minimum number of registered tools to enable tool-filtering LLM step. Set to `null` to disable. #### `fsm.clear_session_meta` @@ -82,7 +94,7 @@ Minimum number of available tools to trigger tool filtering. If fewer tools are |------|----------|---------| | `string` | No | `"never"` | -When to clear session metadata: +When to clear session meta information: - `"never"`: Never clear - `"every_attempt"`: Clear at the beginning of each PLLM attempt @@ -94,33 +106,17 @@ When to clear session metadata: |------|----------|---------|-------------| | `integer` or `null` | No | endpoint-dependent | >= 1 | -Maximum number of conversation turns allowed in the session. When not set, the server applies a default based on the endpoint type. +Maximum number of turns allowed in the session. If `null`, unlimited turns are allowed. When not set, the server applies a default based on the endpoint type. ### Dual-LLM Only Fields -#### `fsm.max_pllm_steps` - -| Type | Required | Default | Constraints | -|------|----------|---------|-------------| -| `integer` or `null` | No | `null` | >= 1 | - -Maximum number of PLLM steps before giving up and returning an error. - -#### `fsm.max_tool_calls_per_step` - -| Type | Required | Default | Constraints | -|------|----------|---------|-------------| -| `integer` or `null` | No | `null` | >= 1 | - -Maximum number of tool calls allowed per PLLM step. - #### `fsm.allow_history_mismatch` | Type | Required | Default | |------|----------|---------| | `boolean` or `null` | No | `null` | -Allow mismatches between the stored session history and the incoming messages. +Controls behaviour when incoming messages diverge from stored history in stateless mode. When `true`, the server silently truncates its stored history to the last consistent point and accepts the caller's version. When `false`, the server rejects the request with an error if a mismatch is detected. #### `fsm.clear_history_every_n_attempts` @@ -128,71 +124,87 @@ Allow mismatches between the stored session history and the incoming messages. |------|----------|---------|-------------| | `integer` or `null` | No | `null` | >= 1 | -If set, clears the tool call history every n PLLM attempts to save token usage. +Single-step mode only. Clear all failed step history every N attempts to save tokens. -#### `fsm.max_pllm_failed_steps` +#### `fsm.disable_rllm` -| Type | Required | Default | Constraints | -|------|----------|---------|-------------| -| `integer` or `null` | No | `null` | >= 1 | +| Type | Required | Default | +|------|----------|---------| +| `boolean` | No | `true` | -Maximum number of failed PLLM steps allowed before giving up and returning an error. +Whether to skip the response LLM (RLLM) review step. -#### `fsm.retry_on_policy_violation` +#### `fsm.enable_multistep_planning` | Type | Required | Default | |------|----------|---------| | `boolean` | No | `false` | -Retry PLLM attempts when a policy violation is detected. +When `false` (single-step), each attempt solves independently. When `true` (multi-step), each step builds on previous. -#### `fsm.disable_rllm` +#### `fsm.enabled_internal_tools` | Type | Required | Default | |------|----------|---------| -| `boolean` | No | `true` | +| `array[string]` | No | endpoint-dependent | -Disable the Response LLM (RLLM) for reviewing final responses. +List of internal tool IDs available to planning LLM. Valid values: `"parse_with_ai"`, `"verify_hypothesis"`, `"set_policy"`, `"complete_turn"`. When not set, the server applies a default based on the endpoint type. -#### `fsm.reduced_grammar_for_rllm_review` +#### `fsm.prune_failed_steps` | Type | Required | Default | |------|----------|---------| -| `boolean` | No | `true` | +| `boolean` | No | `false` | -Use reduced grammar for the RLLM review process. +Multi-step mode only. Remove failed steps from history after turn completes. -#### `fsm.enable_multistep_planning` +#### `fsm.force_to_cache` | Type | Required | Default | |------|----------|---------| -| `boolean` | No | `false` | +| `array[string]` | No | `[]` | -Enable multi-step planning for complex user queries. +List of tool ID regex patterns to always cache their results regardless of the cache_tool_result setting. -#### `fsm.prune_failed_steps` +#### `fsm.max_pllm_steps` -| Type | Required | Default | -|------|----------|---------| -| `boolean` | No | `false` | +| Type | Required | Default | Constraints | +|------|----------|---------|-------------| +| `integer` or `null` | No | `null` | >= 1 | -Prune failed PLLM steps from session history to save tokens. +Maximum number of steps allowed per turn. -#### `fsm.enabled_internal_tools` +#### `fsm.max_pllm_failed_steps` + +| Type | Required | Default | Constraints | +|------|----------|---------|-------------| +| `integer` or `null` | No | `null` | >= 1 | + +Maximum number of failed steps allowed per turn. + +#### `fsm.max_tool_calls_per_step` + +| Type | Required | Default | Constraints | +|------|----------|---------|-------------| +| `integer` or `null` | No | `null` | >= 1 | + +Maximum number of tool calls allowed per PLLM attempt. If `null`, no limit is enforced. + +#### `fsm.reduced_grammar_for_rllm_review` | Type | Required | Default | |------|----------|---------| -| `array[string]` | No | endpoint-dependent | +| `boolean` | No | `true` | -Internal tools to enable. Valid values: `"parse_with_ai"`, `"verify_hypothesis"`. When not set, the server applies a default based on the endpoint type. +Whether to paraphrase RLLM output via reduced grammar before feeding back to planning LLM. -#### `fsm.force_to_cache` +#### `fsm.retry_on_policy_violation` | Type | Required | Default | |------|----------|---------| -| `array[string]` | No | `[]` | +| `boolean` | No | `false` | -List of tool ID regex patterns to always cache. +When `true`, allow planning LLM to retry after policy violation. #### `fsm.wrap_tool_result` @@ -200,7 +212,7 @@ List of tool ID regex patterns to always cache. |------|----------|---------| | `boolean` or `null` | No | `null` | -Whether to wrap tool results before passing to PLLM. +Whether to wrap tool results in Ok/Err types. #### `fsm.detect_tool_errors` @@ -208,7 +220,11 @@ Whether to wrap tool results before passing to PLLM. |------|----------|---------| | `string` or `null` | No | `null` | -Tool error detection strategy: `"none"`, `"regex"`, or `"llm"`. +Whether and how to detect errors in tool results: + +- `"none"`: Do not detect tool result errors +- `"regex"`: Use regex patterns to detect common error messages in tool results +- `"llm"`: Use an LLM to analyze tool results and detect potential errors #### `fsm.detect_tool_error_regex_pattern` @@ -216,7 +232,7 @@ Tool error detection strategy: `"none"`, `"regex"`, or `"llm"`. |------|----------|---------| | `string` or `null` | No | `null` | -Regex pattern to use when `detect_tool_errors` is set to `"regex"`. +The regex pattern to use for detecting error messages in tool results when `detect_tool_errors` is set to `"regex"`. #### `fsm.detect_tool_error_max_result_length` @@ -224,7 +240,7 @@ Regex pattern to use when `detect_tool_errors` is set to `"regex"`. |------|----------|---------| | `integer` or `null` | No | `null` | -Maximum tool result length to consider for error detection. +The maximum length of tool result to consider for error detection. Longer results will be truncated. If `null`, no limit is enforced. #### `fsm.strict_tool_result_parsing` @@ -232,7 +248,7 @@ Maximum tool result length to consider for error detection. |------|----------|---------| | `boolean` or `null` | No | `null` | -Enable strict parsing of tool results. +If `true`, only parse external tool results as JSON when the tool declares an output_schema. When `false`, always attempt `json.loads` on tool results. --- @@ -246,26 +262,26 @@ Planning LLM prompt overrides: | Field | Type | Default | Description | |-------|------|---------|-------------| -| `flavor` | `string` | `null` | Prompt flavor | -| `version` | `string` | `null` | Prompt version | -| `debug_info_level` | `string` | `"normal"` | Debug info level: `"minimal"`, `"normal"`, `"extra"` | -| `clarify_ambiguous_queries` | `boolean` | `null` | Allow PLLM to ask clarifying questions | -| `context_var_visibility` | `string` | `null` | Context variable visibility: `"none"`, `"basic-notext"`, `"basic-executable"`, `"all-executable"`, `"all"` | -| `query_inline_roles` | `array[string]` | `null` | Message roles to inline in query: `"assistant"`, `"tool"`, `"developer"`, `"system"` | -| `query_role_name_overrides` | `object` | `null` | Map of message role name overrides | -| `query_include_tool_calls` | `boolean` | `null` | Include tool calls in query | -| `query_include_tool_args` | `boolean` | `null` | Include tool arguments in query | -| `query_include_tool_results` | `boolean` | `null` | Include tool results in query | +| `flavor` | `string` | `null` | Prompt template variant to use (e.g., `"universal"`). | +| `version` | `string` | `null` | Prompt template version. Combined with flavor to load template. | +| `debug_info_level` | `string` | `"normal"` | Level of detail for debug/execution information in planning LLM prompt: `"minimal"`, `"normal"`, `"extra"`. | +| `clarify_ambiguous_queries` | `boolean` | `null` | Whether planning LLM is allowed to ask for clarification on ambiguous queries. | +| `context_var_visibility` | `string` | `null` | The visibility level of context variables in the PLLM prompts: `"none"`, `"basic-notext"`, `"basic-executable"`, `"all-executable"`, `"all"`. | +| `query_inline_roles` | `array[string]` | `null` | List of roles whose messages will be inlined into the user query: `"assistant"`, `"tool"`, `"developer"`, `"system"`. | +| `query_role_name_overrides` | `object` | `null` | Overrides for message role names in the inlined user query. For example, `{"assistant": "developer"}` will change the role of assistant messages to developer. | +| `query_include_tool_calls` | `boolean` | `null` | Whether to include upstream tool calls in inlined query. | +| `query_include_tool_args` | `boolean` | `null` | Whether to include arguments of upstream tool calls. | +| `query_include_tool_results` | `boolean` | `null` | Whether to include results of upstream tool calls. | ### `prompt.rllm` -Response LLM prompt overrides: +Review LLM prompt overrides: | Field | Type | Default | Description | |-------|------|---------|-------------| -| `flavor` | `string` | `null` | Prompt flavor | -| `version` | `string` | `null` | Prompt version | -| `debug_info_level` | `string` | `null` | Debug info level | +| `flavor` | `string` | `null` | Prompt template variant to use (e.g., `"universal"`). | +| `version` | `string` | `null` | Prompt template version. Combined with flavor to load template. | +| `debug_info_level` | `string` | `null` | Level of detail for debug/execution information in RLLM prompt: `"minimal"`, `"normal"`, `"extra"`. | ### `prompt.tllm` @@ -273,10 +289,10 @@ Tool-formulating LLM prompt overrides: | Field | Type | Default | Description | |-------|------|---------|-------------| -| `flavor` | `string` | `null` | Prompt flavor | -| `version` | `string` | `null` | Prompt version | -| `add_tool_description` | `boolean` | `null` | Add tool description to prompt | -| `add_tool_input_schema` | `boolean` | `null` | Add tool input schema to prompt | +| `flavor` | `string` | `null` | Prompt template variant to use (e.g., `"universal"`). | +| `version` | `string` | `null` | Prompt template version. Combined with flavor to load template. | +| `add_tool_description` | `boolean` | `null` | Whether to include tool descriptions in tool-filtering prompt. | +| `add_tool_input_schema` | `boolean` | `null` | Whether to include tool input JSON schemas in tool-filtering prompt. | ### Other LLM Prompts @@ -284,8 +300,8 @@ Tool-formulating LLM prompt overrides: | Field | Type | Default | Description | |-------|------|---------|-------------| -| `flavor` | `string` | `null` | Prompt flavor | -| `version` | `string` | `null` | Prompt version | +| `flavor` | `string` | `null` | Prompt template variant to use (e.g., `"universal"`). | +| `version` | `string` | `null` | Prompt template version. Combined with flavor to load template. | --- @@ -297,7 +313,7 @@ Tool-formulating LLM prompt overrides: |------|----------|---------| | `boolean` | No | `false` | -Strip the response content. This overrides other inclusion settings. +When `true`, returns only essential result value as plain text, stripping all metadata. #### `response_format.include_program` @@ -305,7 +321,7 @@ Strip the response content. This overrides other inclusion settings. |------|----------|---------| | `boolean` | No | `false` | -Include the final program in the response. +Whether to include the generated program in the response. #### `response_format.include_policy_check_history` @@ -313,7 +329,7 @@ Include the final program in the response. |------|----------|---------| | `boolean` | No | `false` | -Include the policy check history in the response. +Whether to include policy check results even when there are no violations. #### `response_format.include_namespace_snapshot` @@ -321,4 +337,4 @@ Include the policy check history in the response. |------|----------|---------| | `boolean` | No | `false` | -Include the namespace snapshot in the response. +Whether to include snapshot of all variables after program execution. diff --git a/docs/control/reference/rest_api/headers/security_features.md b/docs/control/reference/rest_api/headers/security_features.md index 84fbf4f..7e5cb25 100644 --- a/docs/control/reference/rest_api/headers/security_features.md +++ b/docs/control/reference/rest_api/headers/security_features.md @@ -41,13 +41,13 @@ The agent architecture to use. Valid values: |------|----------|---------| | `array[object]` | No | `null` | -An array of content classifier configurations. Each classifier has the following fields: +LLM-based content classifiers that analyze tool call arguments (pre-execution) and results (post-execution) to detect sensitive content (e.g., PII, toxicity). Each classifier has the following fields: | Field | Type | Required | Default | Description | |-------|------|----------|---------|-------------| | `name` | `string` | Yes | - | Classifier identifier (see below) | -| `threshold` | `float` | No | `0.5` | Detection sensitivity threshold (0.0 - 1.0) | -| `mode` | `string` | No | `null` | Preset mode that overrides threshold: `"normal"` or `"strict"` | +| `threshold` | `float` | No | `0.5` | Threshold for the tagger (0.0 - 1.0) | +| `mode` | `string` | No | `null` | Optional mode that overrides threshold (e.g., `"high sensitivity"`, `"strict"`, `"low sensitivity"`, `"normal"`) | Available classifiers: @@ -62,11 +62,11 @@ Available classifiers: |------|----------|---------| | `array[object]` | No | `null` | -An array of content blocker configurations. Each blocker has the following fields: +Content blockers that redact or mask sensitive content in tool call arguments (pre-execution) and results (post-execution). Each blocker has the following fields: | Field | Type | Required | Default | Description | |-------|------|----------|---------|-------------| -| `name` | `string` | Yes | - | Blocker identifier (see below) | +| `name` | `string` | Yes | - | Blocker identifier: `"url_blocker"` or `"file_blocker"` (see below) | Available blockers: diff --git a/docs/control/reference/rest_api/headers/security_policy.md b/docs/control/reference/rest_api/headers/security_policy.md index 69c8cf2..d1791a4 100644 --- a/docs/control/reference/rest_api/headers/security_policy.md +++ b/docs/control/reference/rest_api/headers/security_policy.md @@ -61,7 +61,7 @@ An object containing the policy code and its language. Fields: |------|----------|---------| | `boolean` | No | `false` | -When enabled, security policies are auto-generated based on the user query. The `codes` field can contain natural language instructions when this is enabled. +Whether to auto-generate policies based on tool metadata and natural language descriptions. ### `fail_fast` @@ -69,7 +69,7 @@ When enabled, security policies are auto-generated based on the user query. The |------|----------|---------| | `boolean` or `null` | No | `null` | -Stop execution on the first policy violation. +Whether to fail fast on first hard denial during policy checks. ### `presets` @@ -93,7 +93,7 @@ The default action when no policy rules match a tool call. When `true`, tool cal |------|----------|---------| | `string` | No | `"soft"` | -The enforcement level for the default allow/deny policy. Valid values: `"hard"`, `"soft"`. +Enforcement level for default allow policy. Valid values: `"hard"`, `"soft"`. #### `presets.enable_non_executable_memory` @@ -101,7 +101,7 @@ The enforcement level for the default allow/deny policy. Valid values: `"hard"`, |------|----------|---------| | `boolean` | No | `true` | -Inject non-executable tag to tool result tags by default. +Whether to enable non-executable memory internal policy (attach non-executable tag to all tool results by default). #### `presets.enable_llm_blocked_tag` @@ -109,7 +109,7 @@ Inject non-executable tag to tool result tags by default. |------|----------|---------| | `boolean` | No | `true` | -Whether to enable hard deny when `__llm_blocked` tag is in args of parse_with_ai. +Whether to enable LLM blocked tag internal policy (denies tool calls to parse_with_ai if any argument has LLM_BLOCKED_TAG). #### `presets.llm_blocked_tag_enforcement_level` @@ -117,7 +117,7 @@ Whether to enable hard deny when `__llm_blocked` tag is in args of parse_with_ai |------|----------|---------| | `string` | No | `"hard"` | -The enforcement level for the LLM blocked tag policy. Valid values: `"hard"`, `"soft"`. +Enforcement level for LLM blocked tag internal policy. Valid values: `"hard"`, `"soft"`. #### `presets.branching_meta_policy` @@ -125,7 +125,7 @@ The enforcement level for the LLM blocked tag policy. Valid values: `"hard"`, `" |------|----------|---------| | `object` | No | See below | -Metadata that are allowed or forbidden in branching. +Control flow meta policy for branching tools. ##### `branching_meta_policy.mode` @@ -144,7 +144,7 @@ The mode for the branching meta policy: |------|----------|---------| | `array[string]` | No | `[]` | -List of producer names to allow (in `allow` mode) or deny (in `deny` mode) for control flow relaxer. +Set of prohibited producers for control flow relaxer in custom mode. ##### `branching_meta_policy.tags` @@ -152,7 +152,7 @@ List of producer names to allow (in `allow` mode) or deny (in `deny` mode) for c |------|----------|---------| | `array[string]` | No | `[]` | -List of tags to allow (in `allow` mode) or deny (in `deny` mode) for control flow relaxer. +Set of prohibited tags for control flow relaxer in custom mode. ##### `branching_meta_policy.consumers` @@ -160,4 +160,4 @@ List of tags to allow (in `allow` mode) or deny (in `deny` mode) for control flo |------|----------|---------| | `array[string]` | No | `[]` | -List of consumer names to allow (in `allow` mode) or deny (in `deny` mode) for control flow relaxer. +Set of prohibited consumers for control flow relaxer in custom mode. diff --git a/src/sequrity/control/types/headers.py b/src/sequrity/control/types/headers.py index 066ee53..a3c2b2a 100644 --- a/src/sequrity/control/types/headers.py +++ b/src/sequrity/control/types/headers.py @@ -25,14 +25,17 @@ class TaggerConfig(BaseModel): Attributes: name: Classifier identifier. threshold: Detection sensitivity threshold (0.0-1.0). - mode: Optional mode that overrides threshold ("normal"/"strict"). + mode: Optional mode that overrides threshold (e.g., "high sensitivity", "strict", "low sensitivity", "normal"). """ model_config = ConfigDict(extra="forbid") - name: ContentClassifierName - threshold: float = Field(default=0.5, ge=0.0, le=1.0) - mode: str | None = Field(default=None) + name: ContentClassifierName = Field(description="Classifier identifier.") + threshold: float = Field(default=0.5, ge=0.0, le=1.0, description="Threshold for the tagger.") + mode: str | None = Field( + default=None, + description="Optional mode that overrides threshold (e.g., 'high sensitivity', 'strict', 'low sensitivity', 'normal').", + ) class ConstraintConfig(BaseModel): @@ -44,7 +47,7 @@ class ConstraintConfig(BaseModel): model_config = ConfigDict(extra="forbid") - name: ContentBlockerName + name: ContentBlockerName = Field(description="Blocker identifier ('url_blocker' or 'file_blocker').") class FeaturesHeader(BaseModel): @@ -63,8 +66,14 @@ class FeaturesHeader(BaseModel): model_config = ConfigDict(extra="forbid") agent_arch: AgentArch | None = Field(None, description="Agent architecture: single-llm or dual-llm.") - content_classifiers: list[TaggerConfig] | None = Field(None, description="Content classifiers to enable.") - content_blockers: list[ConstraintConfig] | None = Field(None, description="Content blockers to enable.") + content_classifiers: list[TaggerConfig] | None = Field( + None, + description="LLM-based content classifiers that analyze tool call arguments (pre-execution) and results (post-execution) to detect sensitive content (e.g., PII, toxicity).", + ) + content_blockers: list[ConstraintConfig] | None = Field( + None, + description="Content blockers that redact or mask sensitive content in tool call arguments (pre-execution) and results (post-execution).", + ) @overload def dump_for_headers(self, mode: Literal["json_str"] = ...) -> str: ... @@ -165,9 +174,15 @@ class ControlFlowMetaPolicy(BaseModel): """Control flow meta policy for branching tools.""" mode: Literal["allow", "deny"] = Field(default="deny", description="'allow' for whitelist, 'deny' for blacklist.") - producers: set[str] = Field(default_factory=set, description="Producer identifiers for control flow policy.") - tags: set[str] = Field(default_factory=set, description="Tag identifiers for control flow policy.") - consumers: set[str] = Field(default_factory=set, description="Consumer identifiers for control flow policy.") + producers: set[str] = Field( + default_factory=set, description="Set of prohibited producers for control flow relaxer in custom mode." + ) + tags: set[str] = Field( + default_factory=set, description="Set of prohibited tags for control flow relaxer in custom mode." + ) + consumers: set[str] = Field( + default_factory=set, description="Set of prohibited consumers for control flow relaxer in custom mode." + ) class InternalPolicyPresets(BaseModel): @@ -177,10 +192,11 @@ class InternalPolicyPresets(BaseModel): default_allow: bool = Field(default=True, description="Whether to allow tool calls by default.") default_allow_enforcement_level: Literal["hard", "soft"] = Field( - default="soft", description="Enforcement level for default allow/deny policies." + default="soft", description="Enforcement level for default allow policy." ) enable_non_executable_memory: bool = Field( - default=True, description="Attach non-executable tag to all tool results by default." + default=True, + description="Whether to enable non-executable memory internal policy (attach non-executable tag to all tool results by default).", ) branching_meta_policy: ControlFlowMetaPolicy = Field( default_factory=ControlFlowMetaPolicy, @@ -188,10 +204,10 @@ class InternalPolicyPresets(BaseModel): ) enable_llm_blocked_tag: bool = Field( default=True, - description="Deny tool calls to parse_with_ai if any argument has LLM_BLOCKED_TAG.", + description="Whether to enable LLM blocked tag internal policy (denies tool calls to parse_with_ai if any argument has LLM_BLOCKED_TAG).", ) llm_blocked_tag_enforcement_level: Literal["hard", "soft"] = Field( - default="hard", description="Enforcement level for LLM blocked tag policy." + default="hard", description="Enforcement level for LLM blocked tag internal policy." ) @@ -226,11 +242,14 @@ class SecurityPolicyHeader(BaseModel): mode: Literal["standard", "strict", "custom"] | None = Field( default=None, description="The security mode: standard, strict, or custom." ) - codes: PolicyCode | None = Field(default=None, description="The security policy codes.") + codes: PolicyCode | None = Field(default=None, description="User security policy code.") auto_gen: bool | None = Field( - default=None, description="If True, enable auto-generation mode which relaxes certain policy constraints." + default=None, + description="Whether to auto-generate policies based on tool metadata and natural language descriptions.", + ) + fail_fast: bool | None = Field( + default=None, description="Whether to fail fast on first hard denial during policy checks." ) - fail_fast: bool | None = Field(default=None, description="Whether to fail fast on policy violations.") presets: InternalPolicyPresets | None = Field(default=None, description="Internal policy presets configuration.") @overload @@ -320,7 +339,7 @@ def single_llm( # X-Config header (FineGrainedConfigHeader) # --------------------------------------------------------------------------- -InternalSqrtToolIdType: TypeAlias = Literal["parse_with_ai", "verify_hypothesis"] +InternalSqrtToolIdType: TypeAlias = Literal["parse_with_ai", "verify_hypothesis", "set_policy", "complete_turn"] DebugInfoLevel: TypeAlias = Literal["minimal", "normal", "extra"] PromptFlavor: TypeAlias = str PromptVersion: TypeAlias = str @@ -336,28 +355,79 @@ class FsmOverrides(BaseModel): model_config = ConfigDict(extra="forbid") # Shared (single-llm & dual-llm) - min_num_tools_for_filtering: int | None = None - clear_session_meta: Literal["never", "every_attempt", "every_turn"] | None = None - max_n_turns: int | None = None + min_num_tools_for_filtering: int | None = Field( + default=None, + description="Minimum number of registered tools to enable tool-filtering LLM step. Set to None to disable.", + ) + clear_session_meta: Literal["never", "every_attempt", "every_turn"] | None = Field( + default=None, + description="When to clear session meta information. 'never': never clear; 'every_attempt': clear at the beginning of each PLLM attempt; 'every_turn': clear at the beginning of each turn.", + ) + max_n_turns: int | None = Field( + default=None, + description="Maximum number of turns allowed in the session. If None, unlimited turns are allowed.", + ) # Dual-LLM only - allow_history_mismatch: bool | None = None - clear_history_every_n_attempts: int | None = None - disable_rllm: bool | None = None - enable_multistep_planning: bool | None = None - enabled_internal_tools: list[InternalSqrtToolIdType] | None = None - prune_failed_steps: bool | None = None - force_to_cache: list[str] | None = None - max_pllm_steps: int | None = None - max_pllm_failed_steps: int | None = None - max_tool_calls_per_step: int | None = None - reduced_grammar_for_rllm_review: bool | None = None - retry_on_policy_violation: bool | None = None - wrap_tool_result: bool | None = None - detect_tool_errors: Literal["none", "regex", "llm"] | None = None - detect_tool_error_regex_pattern: str | None = None - detect_tool_error_max_result_length: int | None = None - strict_tool_result_parsing: bool | None = None + allow_history_mismatch: bool | None = Field( + default=None, + description="Controls behaviour when incoming messages diverge from stored history in stateless mode. When True, the server silently truncates its stored history to the last consistent point. When False, the server rejects the request with an error if a mismatch is detected.", + ) + clear_history_every_n_attempts: int | None = Field( + default=None, + description="Single-step mode only. Clear all failed step history every N attempts to save tokens.", + ) + disable_rllm: bool | None = Field(default=None, description="Whether to skip the response LLM (RLLM) review step.") + enable_multistep_planning: bool | None = Field( + default=None, + description="When False (single-step), each attempt solves independently. When True (multi-step), each step builds on previous.", + ) + enabled_internal_tools: list[InternalSqrtToolIdType] | None = Field( + default=None, description="List of internal tool IDs available to planning LLM." + ) + prune_failed_steps: bool | None = Field( + default=None, description="Multi-step mode only. Remove failed steps from history after turn completes." + ) + force_to_cache: list[str] | None = Field( + default=None, + description="List of tool ID regex patterns to always cache their results regardless of the cache_tool_result setting.", + ) + max_pllm_steps: int | None = Field(default=None, description="Maximum number of steps allowed per turn.") + max_pllm_failed_steps: int | None = Field( + default=None, description="Maximum number of failed steps allowed per turn." + ) + max_tool_calls_per_step: int | None = Field( + default=None, + description="Maximum number of tool calls allowed per PLLM attempt. If None, no limit is enforced.", + ) + reduced_grammar_for_rllm_review: bool | None = Field( + default=None, + description="Whether to paraphrase RLLM output via reduced grammar before feeding back to planning LLM.", + ) + retry_on_policy_violation: bool | None = Field( + default=None, + description="When True, allow planning LLM to retry after policy violation.", + ) + wrap_tool_result: bool | None = Field( + default=None, + description="Whether to wrap tool results in Ok/Err types.", + ) + detect_tool_errors: Literal["none", "regex", "llm"] | None = Field( + default=None, + description="Whether and how to detect errors in tool results. 'none': do not detect; 'regex': use regex patterns; 'llm': use an LLM to analyze tool results.", + ) + detect_tool_error_regex_pattern: str | None = Field( + default=None, + description="The regex pattern to use for detecting error messages in tool results when detect_tool_errors is set to 'regex'.", + ) + detect_tool_error_max_result_length: int | None = Field( + default=None, + description="The maximum length of tool result to consider for error detection. Longer results will be truncated. If None, no limit is enforced.", + ) + strict_tool_result_parsing: bool | None = Field( + default=None, + description="If True, only parse external tool results as JSON when the tool declares an output_schema. When False, always attempt json.loads on tool results.", + ) class PllmPromptOverrides(BaseModel): @@ -365,16 +435,42 @@ class PllmPromptOverrides(BaseModel): model_config = ConfigDict(extra="forbid") - flavor: PromptFlavor | None = None - version: PromptVersion | None = None - clarify_ambiguous_queries: bool | None = None - context_var_visibility: Literal["none", "basic-notext", "basic-executable", "all-executable", "all"] | None = None - query_inline_roles: list[Literal["assistant", "tool", "developer", "system"]] | None = None - query_role_name_overrides: dict[MessageRoleType, MessageRoleType] | None = None - query_include_tool_calls: bool | None = None - query_include_tool_args: bool | None = None - query_include_tool_results: bool | None = None - debug_info_level: DebugInfoLevel | None = None + flavor: PromptFlavor | str | None = Field( + default=None, description="Prompt template variant to use (e.g., 'universal')." + ) + version: PromptVersion | str | None = Field( + default=None, + description="Prompt template version. Combined with flavor to load template.", + ) + clarify_ambiguous_queries: bool | None = Field( + default=None, description="Whether planning LLM is allowed to ask for clarification on ambiguous queries." + ) + context_var_visibility: Literal["none", "basic-notext", "basic-executable", "all-executable", "all"] | None = Field( + default=None, + description="The visibility level of context variables in the PLLM prompts. 'none': do not show any; 'basic-notext': show basic types but not text; 'basic-executable': show basic types and executable memory variables; 'all-executable': show all executable memory variables; 'all': show all.", + ) + query_inline_roles: list[Literal["assistant", "tool", "developer", "system"]] | None = Field( + default=None, description="List of roles whose messages will be inlined into the user query." + ) + query_role_name_overrides: dict[MessageRoleType, MessageRoleType] | None = Field( + default=None, + description="Overrides for message role names in the inlined user query. For example, {'assistant': 'developer'} will change the role of assistant messages to developer.", + ) + query_include_tool_calls: bool | None = Field( + default=None, + description="Whether to include upstream tool calls in inlined query.", + ) + query_include_tool_args: bool | None = Field( + default=None, + description="Whether to include arguments of upstream tool calls.", + ) + query_include_tool_results: bool | None = Field( + default=None, + description="Whether to include results of upstream tool calls.", + ) + debug_info_level: DebugInfoLevel | None = Field( + default=None, description="Level of detail for debug/execution information in planning LLM prompt." + ) class RllmPromptOverrides(BaseModel): @@ -382,9 +478,16 @@ class RllmPromptOverrides(BaseModel): model_config = ConfigDict(extra="forbid") - flavor: PromptFlavor | None = None - version: PromptVersion | None = None - debug_info_level: DebugInfoLevel | None = None + flavor: PromptFlavor | str | None = Field( + default=None, description="Prompt template variant to use (e.g., 'universal')." + ) + version: PromptVersion | str | None = Field( + default=None, + description="Prompt template version. Combined with flavor to load template.", + ) + debug_info_level: DebugInfoLevel | None = Field( + default=None, description="Level of detail for debug/execution information in RLLM prompt." + ) class TllmPromptOverrides(BaseModel): @@ -392,10 +495,19 @@ class TllmPromptOverrides(BaseModel): model_config = ConfigDict(extra="forbid") - flavor: PromptFlavor | None = None - version: PromptVersion | None = None - add_tool_description: bool | None = None - add_tool_input_schema: bool | None = None + flavor: PromptFlavor | str | None = Field( + default=None, description="Prompt template variant to use (e.g., 'universal')." + ) + version: PromptVersion | str | None = Field( + default=None, + description="Prompt template version. Combined with flavor to load template.", + ) + add_tool_description: bool | None = Field( + default=None, description="Whether to include tool descriptions in tool-filtering prompt." + ) + add_tool_input_schema: bool | None = Field( + default=None, description="Whether to include tool input JSON schemas in tool-filtering prompt." + ) class LlmPromptOverrides(BaseModel): @@ -403,8 +515,13 @@ class LlmPromptOverrides(BaseModel): model_config = ConfigDict(extra="forbid") - flavor: PromptFlavor | None = None - version: PromptVersion | None = None + flavor: PromptFlavor | str | None = Field( + default=None, description="Prompt template variant to use (e.g., 'universal')." + ) + version: PromptVersion | str | None = Field( + default=None, + description="Prompt template version. Combined with flavor to load template.", + ) class PromptOverrides(BaseModel): @@ -412,14 +529,18 @@ class PromptOverrides(BaseModel): model_config = ConfigDict(extra="forbid") - pllm: PllmPromptOverrides | None = None - rllm: RllmPromptOverrides | None = None - grllm: LlmPromptOverrides | None = None - qllm: LlmPromptOverrides | None = None - tllm: TllmPromptOverrides | None = None - tagllm: LlmPromptOverrides | None = None - policy_llm: LlmPromptOverrides | None = None - error_detector_llm: LlmPromptOverrides | None = None + pllm: PllmPromptOverrides | None = Field(default=None, description="Configuration for the planning LLM prompt.") + rllm: RllmPromptOverrides | None = Field(default=None, description="Configuration for the review LLM prompt.") + grllm: LlmPromptOverrides | None = Field(default=None, description="Configuration for the GRLLM prompt.") + qllm: LlmPromptOverrides | None = Field(default=None, description="Configuration for the QLLM prompt.") + tllm: TllmPromptOverrides | None = Field( + default=None, description="Configuration for the tool-formulating LLM prompt." + ) + tagllm: LlmPromptOverrides | None = Field(default=None, description="Configuration for the tag LLM prompt.") + policy_llm: LlmPromptOverrides | None = Field(default=None, description="Configuration for the policy LLM prompt.") + error_detector_llm: LlmPromptOverrides | None = Field( + default=None, description="Configuration for the error detector LLM prompt." + ) class ResponseFormatOverrides(BaseModel): @@ -427,10 +548,19 @@ class ResponseFormatOverrides(BaseModel): model_config = ConfigDict(extra="forbid") - strip_response_content: bool | None = None - include_program: bool | None = None - include_policy_check_history: bool | None = None - include_namespace_snapshot: bool | None = None + strip_response_content: bool | None = Field( + default=None, + description="When True, returns only essential result value as plain text, stripping all metadata.", + ) + include_program: bool | None = Field( + default=None, description="Whether to include the generated program in the response." + ) + include_policy_check_history: bool | None = Field( + default=None, description="Whether to include policy check results even when there are no violations." + ) + include_namespace_snapshot: bool | None = Field( + default=None, description="Whether to include snapshot of all variables after program execution." + ) class FineGrainedConfigHeader(BaseModel): @@ -451,9 +581,11 @@ class FineGrainedConfigHeader(BaseModel): model_config = ConfigDict(extra="forbid") - fsm: FsmOverrides | None = None - prompt: PromptOverrides | None = None - response_format: ResponseFormatOverrides | None = None + fsm: FsmOverrides | None = Field(default=None, description="FSM configuration overrides.") + prompt: PromptOverrides | None = Field(default=None, description="Prompt configuration overrides for all LLMs.") + response_format: ResponseFormatOverrides | None = Field( + default=None, description="Response format configuration for dual-LLM sessions." + ) @overload def dump_for_headers(self, mode: Literal["json_str"] = ...) -> str: ... From 80833e8d1b6743b5b14368ac10ff3b4f1ec75811 Mon Sep 17 00:00:00 2001 From: Cheng Zhang Date: Thu, 19 Feb 2026 21:26:33 +0000 Subject: [PATCH 2/2] ignore extra fields for request/response classes --- src/sequrity/types/chat_completion/request.py | 46 +++++++++---------- .../types/chat_completion/response.py | 16 +++---- src/sequrity/types/messages/request.py | 38 +++++++-------- src/sequrity/types/messages/response.py | 8 ++-- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/sequrity/types/chat_completion/request.py b/src/sequrity/types/chat_completion/request.py index 23a9864..6634417 100644 --- a/src/sequrity/types/chat_completion/request.py +++ b/src/sequrity/types/chat_completion/request.py @@ -13,7 +13,7 @@ class ContentPartText(BaseModel): type: Literal["text"] = Field(description="The type of the content part.") text: str = Field(description="The text content.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ImageUrl(BaseModel): @@ -25,7 +25,7 @@ class ImageUrl(BaseModel): description="Specifies the detail level of the image. 'low', 'high', or 'auto' for automatic selection.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ContentPartImage(BaseModel): @@ -34,7 +34,7 @@ class ContentPartImage(BaseModel): type: Literal["image_url"] = Field(description="The type of the content part.") image_url: ImageUrl = Field(description="The image URL details.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class InputAudioData(BaseModel): @@ -43,7 +43,7 @@ class InputAudioData(BaseModel): data: str = Field(description="Base64 encoded audio data.") format: Literal["wav", "mp3"] = Field(description="The format of the audio data.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ContentPartInputAudio(BaseModel): @@ -52,7 +52,7 @@ class ContentPartInputAudio(BaseModel): type: Literal["input_audio"] = Field(description="The type of the content part.") input_audio: InputAudioData = Field(description="The input audio data.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class FileData(BaseModel): @@ -68,7 +68,7 @@ class FileData(BaseModel): description="The name of the file, used when passing the file to the model as a string.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ContentPartFile(BaseModel): @@ -77,7 +77,7 @@ class ContentPartFile(BaseModel): type: Literal["file"] = Field(description="The type of the content part. Always 'file'.") file: FileData = Field(description="The file data.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") ContentPart = ContentPartText | ContentPartImage | ContentPartInputAudio | ContentPartFile @@ -98,7 +98,7 @@ class DeveloperMessage(BaseModel): description="An optional name for the participant. Provides the model information to differentiate between participants of the same role.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class SystemMessage(BaseModel): @@ -111,7 +111,7 @@ class SystemMessage(BaseModel): description="An optional name for the participant. Provides the model information to differentiate between participants of the same role.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class UserMessage(BaseModel): @@ -124,7 +124,7 @@ class UserMessage(BaseModel): description="An optional name for the participant. Provides the model information to differentiate between participants of the same role.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class FunctionCallResult(BaseModel): @@ -135,7 +135,7 @@ class FunctionCallResult(BaseModel): ) name: str = Field(description="The name of the function to call.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ToolCallFunction(BaseModel): @@ -146,7 +146,7 @@ class ToolCallFunction(BaseModel): ) name: str = Field(description="The name of the function to call.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ToolCall(BaseModel): @@ -156,7 +156,7 @@ class ToolCall(BaseModel): type: Literal["function"] = Field(description="The type of the tool. Currently, only 'function' is supported.") function: ToolCallFunction = Field(description="The function that the model called.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class AssistantMessageAudio(BaseModel): @@ -164,7 +164,7 @@ class AssistantMessageAudio(BaseModel): id: str = Field(description="Unique identifier for a previous audio response from the model.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ContentPartRefusal(BaseModel): @@ -173,7 +173,7 @@ class ContentPartRefusal(BaseModel): type: Literal["refusal"] = Field(description="The type of the content part.") refusal: str = Field(description="The refusal message.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class AssistantMessage(BaseModel): @@ -212,7 +212,7 @@ class ToolMessage(BaseModel): content: str | list[ContentPartText] = Field(description="The contents of the tool message.") tool_call_id: str = Field(description="Tool call that this message is responding to.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class FunctionMessage(BaseModel): @@ -222,7 +222,7 @@ class FunctionMessage(BaseModel): content: str | None = Field(description="The contents of the function message.") name: str = Field(description="The name of the function.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") Message = Annotated[ @@ -255,7 +255,7 @@ class FunctionDefinition(BaseModel): description="Whether to enable strict schema adherence when generating the function call.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class FunctionTool(BaseModel): @@ -264,7 +264,7 @@ class FunctionTool(BaseModel): type: Literal["function"] = Field(description="The type of the tool. Currently, only 'function' is supported.") function: FunctionDefinition = Field(description="The function definition.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") Tool = FunctionTool @@ -280,7 +280,7 @@ class ResponseFormatText(BaseModel): type: Literal["text"] = Field(description="The type of response format being defined. Always 'text'.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ResponseFormatJsonObject(BaseModel): @@ -288,7 +288,7 @@ class ResponseFormatJsonObject(BaseModel): type: Literal["json_object"] = Field(description="The type of response format being defined. Always 'json_object'.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class JsonSchema(BaseModel): @@ -320,7 +320,7 @@ class ResponseFormatJsonSchema(BaseModel): type: Literal["json_schema"] = Field(description="The type of response format being defined. Always 'json_schema'.") json_schema: JsonSchema = Field(description="Structured Outputs configuration options, including a JSON Schema.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") ResponseFormat = ResponseFormatText | ResponseFormatJsonObject | ResponseFormatJsonSchema @@ -374,4 +374,4 @@ class ChatCompletionRequest(BaseModel): description="An alternative to sampling with temperature, called nucleus sampling. Use 0.1 for top 10% probability mass.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") diff --git a/src/sequrity/types/chat_completion/response.py b/src/sequrity/types/chat_completion/response.py index 942123e..0b92605 100644 --- a/src/sequrity/types/chat_completion/response.py +++ b/src/sequrity/types/chat_completion/response.py @@ -34,7 +34,7 @@ class TopLogprob(BaseModel): description="The log probability of this token, if it is within the top 20 most likely tokens." ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class TokenLogprob(BaseModel): @@ -52,7 +52,7 @@ class TokenLogprob(BaseModel): description="List of the most likely tokens and their log probability, at this token position." ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ChoiceLogprobs(BaseModel): @@ -67,7 +67,7 @@ class ChoiceLogprobs(BaseModel): description="A list of message refusal tokens with log probability information.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") # ============================================================================= @@ -83,7 +83,7 @@ class ToolCallFunction(BaseModel): ) name: str = Field(description="The name of the function to call.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ResponseToolCall(BaseModel): @@ -93,7 +93,7 @@ class ResponseToolCall(BaseModel): type: Literal["function"] = Field(description="The type of the tool. Currently, only 'function' is supported.") function: ToolCallFunction = Field(description="The function that the model called.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") # ============================================================================= @@ -109,7 +109,7 @@ class AnnotationUrlCitation(BaseModel): title: str = Field(description="The title of the web resource.") url: str = Field(description="The URL of the web resource.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class Annotation(BaseModel): @@ -118,7 +118,7 @@ class Annotation(BaseModel): type: Literal["url_citation"] = Field(description="The type of the URL citation. Always 'url_citation'.") url_citation: AnnotationUrlCitation = Field(description="A URL citation when using web search.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class AudioResponse(BaseModel): @@ -133,7 +133,7 @@ class AudioResponse(BaseModel): ) transcript: str = Field(description="Transcript of the audio generated by the model.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ResponseMessage(BaseModel): diff --git a/src/sequrity/types/messages/request.py b/src/sequrity/types/messages/request.py index 274dc1f..8fe7a2a 100644 --- a/src/sequrity/types/messages/request.py +++ b/src/sequrity/types/messages/request.py @@ -23,7 +23,7 @@ class TextBlockParam(BaseModel): ) citations: list[dict[str, Any]] | None = Field(default=None, description="Citations supporting the text block.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class Base64ImageSourceParam(BaseModel): @@ -35,7 +35,7 @@ class Base64ImageSourceParam(BaseModel): ) data: str = Field(..., description="The base64-encoded image data.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class URLImageSourceParam(BaseModel): @@ -44,7 +44,7 @@ class URLImageSourceParam(BaseModel): type: Literal["url"] = Field(default="url", description="The type of image source.") url: str = Field(..., description="The URL of the image.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") ImageSource = Annotated[ @@ -62,7 +62,7 @@ class ImageBlockParam(BaseModel): default=None, description="Create a cache control breakpoint at this content block." ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class Base64DocumentSourceParam(BaseModel): @@ -72,7 +72,7 @@ class Base64DocumentSourceParam(BaseModel): media_type: Literal["application/pdf"] = Field(..., description="The media type of the document.") data: str = Field(..., description="The base64-encoded document data.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class DocumentBlockParam(BaseModel): @@ -84,7 +84,7 @@ class DocumentBlockParam(BaseModel): default=None, description="Create a cache control breakpoint at this content block." ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ToolUseBlockParam(BaseModel): @@ -98,7 +98,7 @@ class ToolUseBlockParam(BaseModel): default=None, description="Create a cache control breakpoint at this content block." ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ToolResultBlockParam(BaseModel): @@ -117,7 +117,7 @@ class ToolResultBlockParam(BaseModel): default=None, description="Create a cache control breakpoint at this content block." ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ThinkingBlockParam(BaseModel): @@ -129,7 +129,7 @@ class ThinkingBlockParam(BaseModel): default=None, description="Create a cache control breakpoint at this content block." ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") MessageContentBlockParam = Annotated[ @@ -159,7 +159,7 @@ class MessageParam(BaseModel): description="The contents of the message. Can be a string or an array of content blocks.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") # ============================================================================= @@ -199,7 +199,7 @@ class ToolParam(BaseModel): ) type: Literal["custom"] | None = Field(default=None, description="The type of the tool.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") ToolUnionParam = ToolParam | dict[str, Any] @@ -221,7 +221,7 @@ class ToolChoiceAutoParam(BaseModel): description="Whether to disable parallel tool use. If true, the model will output at most one tool use.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ToolChoiceAnyParam(BaseModel): @@ -233,7 +233,7 @@ class ToolChoiceAnyParam(BaseModel): description="Whether to disable parallel tool use. If true, the model will output exactly one tool use.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ToolChoiceToolParam(BaseModel): @@ -246,7 +246,7 @@ class ToolChoiceToolParam(BaseModel): description="Whether to disable parallel tool use. If true, the model will output exactly one tool use.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ToolChoiceNoneParam(BaseModel): @@ -254,7 +254,7 @@ class ToolChoiceNoneParam(BaseModel): type: Literal["none"] = Field(default="none", description="The model will not use any tools.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") ToolChoiceParam = Annotated[ @@ -276,7 +276,7 @@ class MetadataParam(BaseModel): description="An external identifier for the user associated with the request. Should be a uuid, hash, or other opaque identifier.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") # ============================================================================= @@ -300,7 +300,7 @@ class OutputConfigParam(BaseModel): default=None, description="A schema to specify Claude's output format in responses." ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") # ============================================================================= @@ -314,7 +314,7 @@ class ThinkingConfigEnabledParam(BaseModel): type: Literal["enabled"] = Field(default="enabled", description="Thinking is enabled.") budget_tokens: int = Field(..., description="The maximum number of tokens to use for thinking. Minimum is 1024.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ThinkingConfigDisabledParam(BaseModel): @@ -322,7 +322,7 @@ class ThinkingConfigDisabledParam(BaseModel): type: Literal["disabled"] = Field(default="disabled", description="Thinking is disabled.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") ThinkingConfigParam = Annotated[ diff --git a/src/sequrity/types/messages/response.py b/src/sequrity/types/messages/response.py index 496713a..afbc615 100644 --- a/src/sequrity/types/messages/response.py +++ b/src/sequrity/types/messages/response.py @@ -31,7 +31,7 @@ class TextBlock(BaseModel): description="Citations supporting the text block.", ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ThinkingBlock(BaseModel): @@ -40,7 +40,7 @@ class ThinkingBlock(BaseModel): type: Literal["thinking"] = Field(..., description="The type of the content block.") text: str = Field(..., description="The thinking content.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class RedactedThinkingBlock(BaseModel): @@ -59,7 +59,7 @@ class ToolUseBlock(BaseModel): name: str = Field(..., description="The name of the tool being used.") input: dict[str, Any] = Field(..., description="An object containing the input being passed to the tool.") - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") class ServerToolUseBlock(BaseModel): @@ -120,7 +120,7 @@ class Usage(BaseModel): default=None, description="If the request used the priority, standard, or batch tier." ) - model_config = ConfigDict(extra="forbid") + model_config = ConfigDict(extra="ignore") # =============================================================================