diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 559f474b..6e59fc3b 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -383,6 +383,299 @@ components: - 'recipient' - 'content' type: 'object' + Alignment: + additionalProperties: false + description: 'Beta. The result of the alignment plugin for this request; the shape may change.' + example: + calls: + - call: 1 + outcome: 'allowed' + rules: + - broken: false + probability: 0.04 + properties: + calls: + description: 'One record per evaluated assistant message of the request, in the order the messages were produced.' + items: + $ref: '#/components/schemas/AlignmentCallRecord' + minItems: 1 + type: 'array' + required: + - 'calls' + type: 'object' + AlignmentAllowedCallRecord: + additionalProperties: false + properties: + call: + description: 'Number of the record, from 1. A record is one evaluated assistant message; a model call of a server-tool loop that produces several messages has one record per message, and a retry continues the numbering.' + type: 'integer' + outcome: + enum: + - 'allowed' + type: 'string' + rules: + description: 'One record per rule, in the order of `rules` in the request.' + items: + $ref: '#/components/schemas/AlignmentRuleRecord' + maxItems: 128 + minItems: 1 + type: 'array' + required: + - 'call' + - 'outcome' + - 'rules' + type: 'object' + AlignmentBlockedCallRecord: + additionalProperties: false + properties: + call: + description: 'Number of the record, from 1. A record is one evaluated assistant message; a model call of a server-tool loop that produces several messages has one record per message, and a retry continues the numbering.' + type: 'integer' + outcome: + enum: + - 'blocked' + type: 'string' + rules: + description: 'One record per rule, in the order of `rules` in the request.' + items: + $ref: '#/components/schemas/AlignmentRuleRecord' + maxItems: 128 + minItems: 1 + type: 'array' + required: + - 'call' + - 'outcome' + - 'rules' + type: 'object' + AlignmentCallRecord: + discriminator: + mapping: + allowed: '#/components/schemas/AlignmentAllowedCallRecord' + blocked: '#/components/schemas/AlignmentBlockedCallRecord' + unavailable: '#/components/schemas/AlignmentUnavailableCallRecord' + propertyName: 'outcome' + oneOf: + - $ref: '#/components/schemas/AlignmentAllowedCallRecord' + - $ref: '#/components/schemas/AlignmentBlockedCallRecord' + - $ref: '#/components/schemas/AlignmentUnavailableCallRecord' + AlignmentChatAudio: + additionalProperties: false + description: 'The audio of the withheld message: its `id` and `transcript`. The plugin does not retain `data` or `expires_at`.' + example: + id: 'audio_abc123' + transcript: 'Sure, I can take 20% off your order.' + properties: + id: + description: 'The provider id of the audio.' + minLength: 1 + type: 'string' + transcript: + description: 'The transcript of the audio.' + type: 'string' + required: + - 'transcript' + type: 'object' + AlignmentChatImage: + additionalProperties: false + properties: + image_url: + additionalProperties: false + properties: + url: + minLength: 1 + type: 'string' + required: + - 'url' + type: 'object' + type: + enum: + - 'image_url' + type: 'string' + required: + - 'type' + - 'image_url' + type: 'object' + AlignmentChatRejected: + additionalProperties: false + description: 'The assistant message of the withheld turn, without reasoning. `audio` holds the id and transcript of the audio, without `data` or `expires_at`.' + example: + content: 'Sure, I can take 20% off your order.' + refusal: null + role: 'assistant' + properties: + audio: + $ref: '#/components/schemas/AlignmentChatAudio' + content: + type: + - 'string' + - 'null' + images: + items: + $ref: '#/components/schemas/AlignmentChatImage' + type: 'array' + refusal: + type: + - 'string' + - 'null' + role: + enum: + - 'assistant' + type: 'string' + tool_calls: + items: + $ref: '#/components/schemas/AlignmentChatToolCall' + type: 'array' + required: + - 'role' + - 'content' + - 'refusal' + type: 'object' + AlignmentChatToolCall: + additionalProperties: false + properties: + function: + additionalProperties: false + properties: + arguments: + type: 'string' + name: + type: 'string' + required: + - 'name' + - 'arguments' + type: 'object' + id: + type: 'string' + type: + enum: + - 'function' + type: 'string' + required: + - 'id' + - 'type' + - 'function' + type: 'object' + AlignmentPlugin: + additionalProperties: false + description: 'Beta. States the listed rules to the model and evaluates every turn against them. Requests are evaluated only for entities admitted to the beta; the configuration, metadata, and error shapes may change.' + example: + id: 'alignment' + mode: 'audit' + rules: + - 'Never offer a discount.' + properties: + id: + enum: + - 'alignment' + type: 'string' + instruct: + description: 'Whether the rules are stated to the model in a system message on every provider call. Default true.' + type: 'boolean' + max_retries: + description: 'Provider calls made again after a blocked turn, in enforce mode. Default 1.' + type: 'integer' + mode: + description: '`enforce`: a turn that breaks a rule is withheld, retried, and finally returned as an error. `audit`: every turn is evaluated and returned. Default `enforce`.' + enum: + - 'enforce' + - 'audit' + type: 'string' + rules: + description: 'Texts that state what the reply must do or must not do. Each rule is evaluated on its own.' + example: + - 'Never offer a discount.' + - 'End with exactly one question.' + items: + maxLength: 200 + minLength: 1 + pattern: '^[^\n\r]*$' + type: 'string' + maxItems: 128 + minItems: 1 + type: 'array' + threshold: + description: 'Probability at or above which a rule is broken. Default 0.7.' + format: 'double' + type: 'number' + required: + - 'id' + - 'rules' + type: 'object' + AlignmentRejected: + anyOf: + - $ref: '#/components/schemas/AlignmentChatRejected' + - $ref: '#/components/schemas/AlignmentResponsesRejected' + AlignmentResponsesRejected: + description: 'The output items of the withheld turn, without reasoning items. The client did not receive these items; their `id` values are assigned by the plugin (`msg_`, `fc_`, `ctc_`, `ig__`, or the provider item id of a native tool call) and differ from the ids the Responses API assigns to delivered items.' + example: + - content: + - annotations: [] + text: 'Sure, I can take 20% off your order.' + type: 'output_text' + id: 'msg_1' + role: 'assistant' + status: 'completed' + type: 'message' + items: + discriminator: + mapping: + apply_patch_call: '#/components/schemas/OutputItemApplyPatchCall' + code_interpreter_call: '#/components/schemas/OutputItemCodeInterpreterCall' + custom_tool_call: '#/components/schemas/OutputItemCustomToolCall' + file_search_call: '#/components/schemas/OutputItemFileSearchCall' + function_call: '#/components/schemas/OutputItemFunctionCall' + image_generation_call: '#/components/schemas/OutputItemImageGenerationCall' + message: '#/components/schemas/OutputMessage' + reasoning: '#/components/schemas/OutputItemReasoning' + web_search_call: '#/components/schemas/OutputItemWebSearchCall' + propertyName: 'type' + oneOf: + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/OutputItemReasoning' + - $ref: '#/components/schemas/OutputItemFunctionCall' + - $ref: '#/components/schemas/OutputItemCustomToolCall' + - $ref: '#/components/schemas/OutputItemWebSearchCall' + - $ref: '#/components/schemas/OutputItemFileSearchCall' + - $ref: '#/components/schemas/OutputItemImageGenerationCall' + - $ref: '#/components/schemas/OutputItemApplyPatchCall' + - $ref: '#/components/schemas/OutputItemCodeInterpreterCall' + type: 'array' + AlignmentRuleRecord: + additionalProperties: false + properties: + broken: + description: 'Whether probability is at or above the threshold.' + type: 'boolean' + probability: + description: 'The evaluator''s probability that the turn breaks the rule.' + format: 'double' + type: 'number' + required: + - 'probability' + - 'broken' + type: 'object' + AlignmentUnavailableCallRecord: + additionalProperties: false + properties: + call: + description: 'Number of the record, from 1. A record is one evaluated assistant message; a model call of a server-tool loop that produces several messages has one record per message, and a retry continues the numbering.' + type: 'integer' + outcome: + enum: + - 'unavailable' + type: 'string' + reason: + enum: + - 'cut' + - 'evaluator_error' + - 'malformed_answer' + - 'time_limit' + type: 'string' + required: + - 'call' + - 'outcome' + - 'reason' + type: 'object' AnnotationAddedEvent: allOf: - $ref: '#/components/schemas/BaseAnnotationAddedEvent' @@ -4759,6 +5052,8 @@ components: body: anyOf: - properties: + alignment: + $ref: '#/components/schemas/Alignment' choices: items: properties: @@ -7022,6 +7317,7 @@ components: items: discriminator: mapping: + alignment: '#/components/schemas/AlignmentPlugin' auto-beta-router: '#/components/schemas/AutoBetaRouterPlugin' auto-router: '#/components/schemas/AutoRouterPlugin' context-compression: '#/components/schemas/ContextCompressionPlugin' @@ -7048,6 +7344,7 @@ components: - $ref: '#/components/schemas/FusionPlugin' - $ref: '#/components/schemas/SwitchyardRouterPlugin' - $ref: '#/components/schemas/JevRouterPlugin' + - $ref: '#/components/schemas/AlignmentPlugin' type: 'array' prediction: $ref: '#/components/schemas/Prediction' @@ -16719,6 +17016,7 @@ components: items: discriminator: mapping: + alignment: '#/components/schemas/AlignmentPlugin' auto-beta-router: '#/components/schemas/AutoBetaRouterPlugin' auto-router: '#/components/schemas/AutoRouterPlugin' context-compression: '#/components/schemas/ContextCompressionPlugin' @@ -16745,6 +17043,7 @@ components: - $ref: '#/components/schemas/FusionPlugin' - $ref: '#/components/schemas/SwitchyardRouterPlugin' - $ref: '#/components/schemas/JevRouterPlugin' + - $ref: '#/components/schemas/AlignmentPlugin' type: 'array' provider: $ref: '#/components/schemas/ProviderPreferences' @@ -21562,6 +21861,79 @@ components: top_p: null sequence_number: 0 type: 'response.created' + OpenResponsesErrorField: + description: 'Error of a failed response; `metadata` carries OpenRouter-specific details.' + example: + code: 'server_error' + message: 'Alignment plugin: the reply could not be evaluated: evaluator_error' + metadata: + alignment: + calls: + - call: 1 + outcome: 'unavailable' + reason: 'evaluator_error' + properties: + code: + enum: + - 'server_error' + - 'rate_limit_exceeded' + - 'invalid_prompt' + - 'vector_store_timeout' + - 'invalid_image' + - 'invalid_image_format' + - 'invalid_base64_image' + - 'invalid_image_url' + - 'image_too_large' + - 'image_too_small' + - 'image_parse_error' + - 'image_content_policy_violation' + - 'invalid_image_mode' + - 'image_file_too_large' + - 'unsupported_image_media_type' + - 'empty_image_file' + - 'failed_to_download_image' + - 'image_file_not_found' + - 'bio_policy' + - 'cyber_policy' + - 'misalignment_policy_violation' + - 'data_residency_mismatch' + type: 'string' + message: + type: 'string' + metadata: + $ref: '#/components/schemas/OpenResponsesErrorMetadata' + required: + - 'code' + - 'message' + type: + - 'object' + - 'null' + OpenResponsesErrorMetadata: + description: 'OpenRouter-specific details of a failed response, such as the alignment object of an alignment error.' + example: + alignment: + calls: + - call: 1 + outcome: 'unavailable' + reason: 'evaluator_error' + properties: + alignment: + allOf: + - $ref: '#/components/schemas/Alignment' + - additionalProperties: false + properties: + rejected: + $ref: '#/components/schemas/AlignmentRejected' + type: 'object' + description: 'Beta. The result of the alignment plugin for this request; the shape may change.' + example: + calls: + - call: 1 + outcome: 'allowed' + rules: + - broken: false + probability: 0.04 + type: 'object' OpenResponsesInProgressEvent: allOf: - $ref: '#/components/schemas/InProgressEvent' @@ -21623,6 +21995,10 @@ components: allOf: - $ref: '#/components/schemas/BaseResponsesResult' - properties: + alignment: + $ref: '#/components/schemas/Alignment' + error: + $ref: '#/components/schemas/OpenResponsesErrorField' error_type: $ref: '#/components/schemas/ApiErrorType' openrouter_metadata: @@ -26983,6 +27359,7 @@ components: items: discriminator: mapping: + alignment: '#/components/schemas/AlignmentPlugin' auto-beta-router: '#/components/schemas/AutoBetaRouterPlugin' auto-router: '#/components/schemas/AutoRouterPlugin' context-compression: '#/components/schemas/ContextCompressionPlugin' @@ -27009,6 +27386,7 @@ components: - $ref: '#/components/schemas/FusionPlugin' - $ref: '#/components/schemas/SwitchyardRouterPlugin' - $ref: '#/components/schemas/JevRouterPlugin' + - $ref: '#/components/schemas/AlignmentPlugin' type: 'array' presence_penalty: format: 'double'