From cd30084b3e8027870d1b9d8bcdab7d5deb3f3cea Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Wed, 23 Sep 2026 21:52:37 +0000 Subject: [PATCH 1/2] =?UTF-8?q?##=20Python=20SDK=20Changes:=20*=20`open=5F?= =?UTF-8?q?router.presets.create=5Fpresets=5Fresponses()`:=20=20=20*=20=20?= =?UTF-8?q?`request.input.union(Array<>)[]`=20**Changed**=20(Breaking=20?= =?UTF-8?q?=E2=9A=A0=EF=B8=8F)=20*=20`open=5Frouter.responses.send()`:=20?= =?UTF-8?q?=20=20*=20=20`request.input.union(Array<>)[]`=20**Changed**=20(?= =?UTF-8?q?Breaking=20=E2=9A=A0=EF=B8=8F)=20*=20`open=5Frouter.beta.respon?= =?UTF-8?q?ses.send()`:=20=20=20*=20=20`request.input.union(Array<>)[]`=20?= =?UTF-8?q?**Changed**=20(Breaking=20=E2=9A=A0=EF=B8=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .speakeasy/gen.lock | 48 ++++---- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 104 +++++++++++++++--- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/customtoolcallitem.mdx | 10 +- docs/components/functioncallitem.mdx | 10 +- docs/components/inputsunion1.mdx | 12 -- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- .../components/customtoolcallitem.py | 37 +++++-- src/openrouter/components/functioncallitem.py | 51 ++++++--- src/openrouter/components/inputs_union.py | 96 +++++++--------- uv.lock | 2 +- 14 files changed, 246 insertions(+), 154 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index e2d7a0dc..1b748a3c 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 6e123cb0ea767ec1dfe22b6d5a22eb03 + docChecksum: ddef32b4cd6f5d73939713b2c82a3b29 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.2.21 - configChecksum: a5d71454cf56db3056ccd04663866372 + releaseVersion: 1.2.22 + configChecksum: b17b6b12ede2e231b529d7155e1fc0d3 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 58d82779-89cb-4b09-bf67-c46027d7304d - pristine_commit_hash: ea160db099b23c803386dce65f0700209fa185e7 - pristine_tree_hash: cf523b00e4d3d9d56f5e8d59507ec599ed3eb8fa + generation_id: d70feb9e-7b5f-4223-bd74-6c302290ab81 + pristine_commit_hash: 2e2b161273a0c50a40a16292bc0e77e2cc984059 + pristine_tree_hash: 2b4f8c135349d264802aecf405de53a0945a61f0 features: python: acceptHeaders: 3.0.0 @@ -1747,8 +1747,8 @@ trackedFiles: pristine_git_object: 8f1998f649043b4b2c6eab0ed51df960be63523e docs/components/customtoolcallitem.mdx: id: 3936d690b05c - last_write_checksum: sha1:9f4cc1011f0ddbd3d208c3dc2047791b1f1f01b1 - pristine_git_object: 2756d1cddeb91afb0b4133e94effabe1cd46433e + last_write_checksum: sha1:8c012c8a3cce20be5d502d9e6c878bb43f35e60f + pristine_git_object: c7d8e13ed7c739d36a410b926e8f6936617c0f38 docs/components/customtoolcallitemtype.mdx: id: d69cfea1fb83 last_write_checksum: sha1:25c64017876c8e051f178e87fcd94f47f19e6bc8 @@ -2263,8 +2263,8 @@ trackedFiles: pristine_git_object: da8e18a164f2bd77e34b42d88e0b553edfe8a9c3 docs/components/functioncallitem.mdx: id: 6cb0afdc292f - last_write_checksum: sha1:e9acf1abd137daa1c96e655d4acc47e2170b0f73 - pristine_git_object: fddfd0d82b508d45dba047ff8d9d1d9a36ba1b5a + last_write_checksum: sha1:7367b01801c55c7ed2535a7354da3c5c7acfc16f + pristine_git_object: 9d430414fa99b188b559a2fbfa441482fc8ae913 docs/components/functioncallitemsubagentitem.mdx: id: e71e71703a47 last_write_checksum: sha1:24fc27e4de6e95f72e293c5275aa68c89ed3076c @@ -2919,8 +2919,8 @@ trackedFiles: pristine_git_object: 33aee92c61bf7ab9beded4e193f50a2c08462378 docs/components/inputsunion1.mdx: id: c216609d21ce - last_write_checksum: sha1:b023f72b6c127783c064f15b7c416d94711a9b32 - pristine_git_object: 98dad1d296224d766b427a471afd2fb36ec4cf43 + last_write_checksum: sha1:9227d47c24ee5edc23887ac20f218cffd067b528 + pristine_git_object: e76c31df752f42afe7df4285608f21e6c8392a59 docs/components/inputtext.mdx: id: c8a97322a50a last_write_checksum: sha1:6f92abbb193a5d21cc129df4c5804b3f9161322d @@ -8243,8 +8243,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:aab9ea784cd1775a5ff0bf967745d37b9e981bf1 - pristine_git_object: 09333c0bfdbd5e89764847d2f9fc65fbbf1a4eff + last_write_checksum: sha1:a262410e1db860a3666bb1a38ed3024cf6df845a + pristine_git_object: b6e61eb75d5b4e7050ca3c9d6ef4037f6078f02f scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -8271,8 +8271,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:bb9f5e866713c9ef6501e791a28656687a36aaf5 - pristine_git_object: b0f7b459f819b45c0a54c82340c2b9b069cede6c + last_write_checksum: sha1:5f2d1738ec120e5dd894bd4e7abd0f4daa948b41 + pristine_git_object: 31edc02f24e953d9278afbf62bbbb239a715b0ad src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -9099,8 +9099,8 @@ trackedFiles: pristine_git_object: 308a29665db6048780b3d9d3dad551110e002cfe src/openrouter/components/customtoolcallitem.py: id: 232ac63226eb - last_write_checksum: sha1:758b6fc6d369c1ce7d0de6435e6d08f20d68b0c8 - pristine_git_object: 7725b78a34d2cd994fec5837f32e3ff1a3fdaba3 + last_write_checksum: sha1:8b3e9d86e1500c7f0a4aa2756d9cf3f0faae45dd + pristine_git_object: ab5d763007ce66924f71816ab297670ad34b2bc6 src/openrouter/components/customtoolcalloutputitem.py: id: 533940b12cd2 last_write_checksum: sha1:1934cb285468ce7e60f506412320c62b55239047 @@ -9299,8 +9299,8 @@ trackedFiles: pristine_git_object: 613c2bbaec296ed9b0da13f249ef96b9314ff9ed src/openrouter/components/functioncallitem.py: id: 5e69afffd660 - last_write_checksum: sha1:9318194be1605dc33b9a448f6482bab8b8ed2584 - pristine_git_object: 181d74766073f16555f30e129adc23d9003fc8bb + last_write_checksum: sha1:b9a85934a58a48db9f50c5bdb2df7a40bb4e7190 + pristine_git_object: edf2b4fda878fdda48ea5b411fcc39883f20d75d src/openrouter/components/functioncalloutputitem.py: id: bf659aa04e7d last_write_checksum: sha1:e938b63769022d499419ffcd309fdd71edb36174 @@ -9575,8 +9575,8 @@ trackedFiles: pristine_git_object: f499cbbb546232f5cfbfe2c44fb41aefb306c87f src/openrouter/components/inputs_union.py: id: 17d6239cb6a7 - last_write_checksum: sha1:2a0e9f681cd64913508e9cad82d2755eeb56cbca - pristine_git_object: 2bcad7f1f7081532ec62490519361777717fcc20 + last_write_checksum: sha1:e7216b0014bd1650565f9610d4ba5d8b5b7adf3c + pristine_git_object: 8d4f5d6af0e647677d01ec98dd25c2093705df0b src/openrouter/components/inputtext.py: id: a995ae96be99 last_write_checksum: sha1:2da9ff645acc96772701908830151c5a707ed021 @@ -15130,6 +15130,4 @@ examples: "500": application/json: {"error": {"code": 409, "message": "That question is no longer waiting for an answer."}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.interns.invoke()`: **Added** +releaseNotes: "## Python SDK Changes:\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[]` **Changed** (Breaking ⚠️)\n* `open_router.responses.send()`: \n * `request.input.union(Array<>)[]` **Changed** (Breaking ⚠️)\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[]` **Changed** (Breaking ⚠️)\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 1809f729..1f22d2f1 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.2.21 + version: 1.2.22 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index fc398145..6575bad3 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -8220,12 +8220,6 @@ components: sequence_number: 6 type: 'response.custom_tool_call_input.done' CustomToolCallItem: - allOf: - - $ref: '#/components/schemas/OpenAIResponseCustomToolCall' - - properties: - status: - $ref: '#/components/schemas/ToolCallStatus' - type: 'object' description: 'A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI''s `apply_patch` whose payload is opaque text rather than JSON arguments.' example: call_id: 'call-abc123' @@ -8233,6 +8227,42 @@ components: input: "*** Begin Patch\n*** End Patch" name: 'apply_patch' type: 'custom_tool_call' + properties: + async: + description: 'True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`.' + example: true + type: + - 'boolean' + - 'null' + call_id: + type: 'string' + id: + type: + - 'string' + - 'null' + input: + type: 'string' + name: + type: 'string' + namespace: + description: 'Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)' + type: + - 'string' + - 'null' + status: + anyOf: + - $ref: '#/components/schemas/ToolCallStatus' + - type: 'null' + type: + enum: + - 'custom_tool_call' + type: 'string' + required: + - 'type' + - 'call_id' + - 'name' + - 'input' + type: 'object' CustomToolCallOutputItem: allOf: - $ref: '#/components/schemas/OpenAIResponseCustomToolCallOutput' @@ -9379,12 +9409,6 @@ components: sequence_number: 6 type: 'response.function_call_arguments.done' FunctionCallItem: - allOf: - - $ref: '#/components/schemas/OpenAIResponseFunctionToolCall' - - properties: {} - required: - - 'id' - type: 'object' description: 'A function call initiated by the model' example: arguments: '{"location":"San Francisco"}' @@ -9393,6 +9417,60 @@ components: name: 'get_weather' status: 'completed' type: 'function_call' + properties: + arguments: + type: 'string' + async: + description: 'True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`.' + example: true + type: + - 'boolean' + - 'null' + call_id: + type: 'string' + id: + type: + - 'string' + - 'null' + name: + type: 'string' + namespace: + description: 'Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)' + type: + - 'string' + - 'null' + status: + anyOf: + - $ref: '#/components/schemas/ToolCallStatus' + - type: 'null' + subagent_id: + description: 'EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls.' + type: + - 'string' + - 'null' + subagent_items: + description: 'EXPERIMENTAL — subject to change without notice. The subagent''s output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool.' + items: + additionalProperties: {} + properties: + type: + type: 'string' + required: + - 'type' + type: 'object' + type: + - 'array' + - 'null' + type: + enum: + - 'function_call' + type: 'string' + required: + - 'type' + - 'call_id' + - 'name' + - 'arguments' + type: 'object' FunctionCallOutputItem: allOf: - $ref: '#/components/schemas/OpenAIResponseFunctionToolCallOutput' @@ -12349,8 +12427,6 @@ components: - text: 'Analyzed the problem and found the optimal solution.' type: 'summary_text' type: 'reasoning' - - $ref: '#/components/schemas/OutputFunctionCallItem' - - $ref: '#/components/schemas/OutputCustomToolCallItem' - $ref: '#/components/schemas/OutputWebSearchCallItem' - $ref: '#/components/schemas/OutputFileSearchCallItem' - $ref: '#/components/schemas/OutputImageGenerationCallItem' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 19428b1d..d1dceea3 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:735f8cdc3a309a74edd33480c4c47de14d32303562cb526eb39a59bc70e35598 - sourceBlobDigest: sha256:55427771e384f01b34046cd72b6c55606a9e94895f6774a99936ebbf6cbc40c5 + sourceRevisionDigest: sha256:790674c532081dfabb7339f3069003cc638178dddc3bee934d5ed0fb388a7d53 + sourceBlobDigest: sha256:b073b26bfee1d9c1478bd018c96279ab06290278274d61255b265940c0d31edb tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:735f8cdc3a309a74edd33480c4c47de14d32303562cb526eb39a59bc70e35598 - sourceBlobDigest: sha256:55427771e384f01b34046cd72b6c55606a9e94895f6774a99936ebbf6cbc40c5 + sourceRevisionDigest: sha256:790674c532081dfabb7339f3069003cc638178dddc3bee934d5ed0fb388a7d53 + sourceBlobDigest: sha256:b073b26bfee1d9c1478bd018c96279ab06290278274d61255b265940c0d31edb codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:3a17822156ea0541216cff2b222d58e321e916e588857ac5c48cb65083feddaf + codeSamplesRevisionDigest: sha256:4e0ba9267951a6ee26a33ea0dbbf9d6ae805be6321a44fbc2c5b27296dea3fc8 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index c9ff193c..7dbad0a5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2619,4 +2619,14 @@ Based on: ### Generated - [python v1.2.21] . ### Releases -- [PyPI v1.2.21] https://pypi.org/project/openrouter/1.2.21 - . \ No newline at end of file +- [PyPI v1.2.21] https://pypi.org/project/openrouter/1.2.21 - . + +## 2026-09-23 21:50:45 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.2.22] . +### Releases +- [PyPI v1.2.22] https://pypi.org/project/openrouter/1.2.22 - . \ No newline at end of file diff --git a/docs/components/customtoolcallitem.mdx b/docs/components/customtoolcallitem.mdx index 2756d1cd..c7d8e13e 100644 --- a/docs/components/customtoolcallitem.mdx +++ b/docs/components/customtoolcallitem.mdx @@ -9,11 +9,11 @@ A call to a custom (freeform-grammar) tool created by the model — distinct fro | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `async_` | *Optional[bool]* | :heavy_minus_sign: | True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`. | true | +| `async_` | *OptionalNullable[bool]* | :heavy_minus_sign: | True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`. | true | | `call_id` | *str* | :heavy_check_mark: | N/A | | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | | `input` | *str* | :heavy_check_mark: | N/A | | | `name` | *str* | :heavy_check_mark: | N/A | | -| `namespace` | *Optional[str]* | :heavy_minus_sign: | Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server) | | -| `type` | [components.CustomToolCallItemType](../components/customtoolcallitemtype.mdx) | :heavy_check_mark: | N/A | | -| `status` | [Optional[components.ToolCallStatus]](../components/toolcallstatus.mdx) | :heavy_minus_sign: | N/A | completed | \ No newline at end of file +| `namespace` | *OptionalNullable[str]* | :heavy_minus_sign: | Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server) | | +| `status` | [OptionalNullable[components.ToolCallStatus]](../components/toolcallstatus.mdx) | :heavy_minus_sign: | N/A | completed | +| `type` | [components.CustomToolCallItemType](../components/customtoolcallitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/functioncallitem.mdx b/docs/components/functioncallitem.mdx index fddfd0d8..9d430414 100644 --- a/docs/components/functioncallitem.mdx +++ b/docs/components/functioncallitem.mdx @@ -10,12 +10,12 @@ A function call initiated by the model | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `arguments` | *str* | :heavy_check_mark: | N/A | | -| `async_` | *Optional[bool]* | :heavy_minus_sign: | True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`. | true | +| `async_` | *OptionalNullable[bool]* | :heavy_minus_sign: | True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`. | true | | `call_id` | *str* | :heavy_check_mark: | N/A | | -| `id` | *str* | :heavy_check_mark: | N/A | | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | | `name` | *str* | :heavy_check_mark: | N/A | | -| `namespace` | *Optional[str]* | :heavy_minus_sign: | Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server) | | -| `status` | [Optional[components.ToolCallStatus]](../components/toolcallstatus.mdx) | :heavy_minus_sign: | N/A | completed | -| `subagent_id` | *Optional[str]* | :heavy_minus_sign: | EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls. | | +| `namespace` | *OptionalNullable[str]* | :heavy_minus_sign: | Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server) | | +| `status` | [OptionalNullable[components.ToolCallStatus]](../components/toolcallstatus.mdx) | :heavy_minus_sign: | N/A | completed | +| `subagent_id` | *OptionalNullable[str]* | :heavy_minus_sign: | EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls. | | | `subagent_items` | List[[components.FunctionCallItemSubagentItem](../components/functioncallitemsubagentitem.mdx)] | :heavy_minus_sign: | EXPERIMENTAL — subject to change without notice. The subagent's output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool. | | | `type` | [components.FunctionCallItemType](../components/functioncallitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/inputsunion1.mdx b/docs/components/inputsunion1.mdx index 98dad1d2..e76c31df 100644 --- a/docs/components/inputsunion1.mdx +++ b/docs/components/inputsunion1.mdx @@ -58,18 +58,6 @@ value: components.InputsMessage = /* values here */ value: components.InputsReasoning = /* values here */ ``` -### `components.OutputFunctionCallItem` - -```python -value: components.OutputFunctionCallItem = /* values here */ -``` - -### `components.OutputCustomToolCallItem` - -```python -value: components.OutputCustomToolCallItem = /* values here */ -``` - ### `components.OutputWebSearchCallItem` ```python diff --git a/pyproject.toml b/pyproject.toml index 09333c0b..b6e61eb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.2.21" +version = "1.2.22" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index b0f7b459..31edc02f 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.2.21" +__version__: str = "1.2.22" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.2.21 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.2.22 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/customtoolcallitem.py b/src/openrouter/components/customtoolcallitem.py index 7725b78a..ab5d7630 100644 --- a/src/openrouter/components/customtoolcallitem.py +++ b/src/openrouter/components/customtoolcallitem.py @@ -2,10 +2,16 @@ from __future__ import annotations from .toolcallstatus import ToolCallStatus -from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) import pydantic from pydantic import model_serializer -from typing import Literal, Optional +from typing import Literal from typing_extensions import Annotated, NotRequired, TypedDict @@ -19,12 +25,12 @@ class CustomToolCallItemTypedDict(TypedDict): input: str name: str type: CustomToolCallItemType - async_: NotRequired[bool] + async_: NotRequired[Nullable[bool]] r"""True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`.""" - id: NotRequired[str] - namespace: NotRequired[str] + id: NotRequired[Nullable[str]] + namespace: NotRequired[Nullable[str]] r"""Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)""" - status: NotRequired[ToolCallStatus] + status: NotRequired[Nullable[ToolCallStatus]] class CustomToolCallItem(BaseModel): @@ -38,28 +44,37 @@ class CustomToolCallItem(BaseModel): type: CustomToolCallItemType - async_: Annotated[Optional[bool], pydantic.Field(alias="async")] = None + async_: Annotated[OptionalNullable[bool], pydantic.Field(alias="async")] = UNSET r"""True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`.""" - id: Optional[str] = None + id: OptionalNullable[str] = UNSET - namespace: Optional[str] = None + namespace: OptionalNullable[str] = UNSET r"""Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)""" - status: Optional[ToolCallStatus] = None + status: OptionalNullable[ToolCallStatus] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["async", "id", "namespace", "status"]) + nullable_fields = set(["async", "id", "namespace", "status"]) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): m[k] = val return m diff --git a/src/openrouter/components/functioncallitem.py b/src/openrouter/components/functioncallitem.py index 181d7476..edf2b4fd 100644 --- a/src/openrouter/components/functioncallitem.py +++ b/src/openrouter/components/functioncallitem.py @@ -2,10 +2,16 @@ from __future__ import annotations from .toolcallstatus import ToolCallStatus -from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) import pydantic from pydantic import ConfigDict, model_serializer -from typing import Any, Dict, List, Literal, Optional +from typing import Any, Dict, List, Literal from typing_extensions import Annotated, NotRequired, TypedDict @@ -38,17 +44,17 @@ class FunctionCallItemTypedDict(TypedDict): arguments: str call_id: str - id: str name: str type: FunctionCallItemType - async_: NotRequired[bool] + async_: NotRequired[Nullable[bool]] r"""True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`.""" - namespace: NotRequired[str] + id: NotRequired[Nullable[str]] + namespace: NotRequired[Nullable[str]] r"""Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)""" - status: NotRequired[ToolCallStatus] - subagent_id: NotRequired[str] + status: NotRequired[Nullable[ToolCallStatus]] + subagent_id: NotRequired[Nullable[str]] r"""EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls.""" - subagent_items: NotRequired[List[FunctionCallItemSubagentItemTypedDict]] + subagent_items: NotRequired[Nullable[List[FunctionCallItemSubagentItemTypedDict]]] r"""EXPERIMENTAL — subject to change without notice. The subagent's output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool.""" @@ -59,30 +65,33 @@ class FunctionCallItem(BaseModel): call_id: str - id: str - name: str type: FunctionCallItemType - async_: Annotated[Optional[bool], pydantic.Field(alias="async")] = None + async_: Annotated[OptionalNullable[bool], pydantic.Field(alias="async")] = UNSET r"""True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`.""" - namespace: Optional[str] = None + id: OptionalNullable[str] = UNSET + + namespace: OptionalNullable[str] = UNSET r"""Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)""" - status: Optional[ToolCallStatus] = None + status: OptionalNullable[ToolCallStatus] = UNSET - subagent_id: Optional[str] = None + subagent_id: OptionalNullable[str] = UNSET r"""EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls.""" - subagent_items: Optional[List[FunctionCallItemSubagentItem]] = None + subagent_items: OptionalNullable[List[FunctionCallItemSubagentItem]] = UNSET r"""EXPERIMENTAL — subject to change without notice. The subagent's output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool.""" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["async", "namespace", "status", "subagent_id", "subagent_items"] + ["async", "id", "namespace", "status", "subagent_id", "subagent_items"] + ) + nullable_fields = set( + ["async", "id", "namespace", "status", "subagent_id", "subagent_items"] ) serialized = handler(self) m = {} @@ -90,9 +99,17 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): m[k] = val return m diff --git a/src/openrouter/components/inputs_union.py b/src/openrouter/components/inputs_union.py index 2bcad7f1..8d4f5d6a 100644 --- a/src/openrouter/components/inputs_union.py +++ b/src/openrouter/components/inputs_union.py @@ -74,10 +74,6 @@ OutputComputerCallItem, OutputComputerCallItemTypedDict, ) -from .outputcustomtoolcallitem import ( - OutputCustomToolCallItem, - OutputCustomToolCallItemTypedDict, -) from .outputdatetimeitem import OutputDatetimeItem, OutputDatetimeItemTypedDict from .outputfilesearchcallitem import ( OutputFileSearchCallItem, @@ -91,10 +87,6 @@ OutputFilesServerToolItem, OutputFilesServerToolItemTypedDict, ) -from .outputfunctioncallitem import ( - OutputFunctionCallItem, - OutputFunctionCallItemTypedDict, -) from .outputfusionservertoolitem import ( OutputFusionServerToolItem, OutputFusionServerToolItemTypedDict, @@ -385,50 +377,48 @@ def serialize_model(self, handler): Union[ ItemReferenceItemTypedDict, ConfigurationUpdateItemTypedDict, - ContextCompactionItemTypedDict, - InputMessageItemTypedDict, - AdditionalToolsItemTypedDict, - EasyInputMessageTypedDict, - OutputWebSearchServerToolItemTypedDict, - CompactionItemTypedDict, CustomToolCallOutputItemTypedDict, + InputMessageItemTypedDict, LocalShellCallOutputItemTypedDict, OutputToolSearchServerToolItemTypedDict, + OutputWebSearchServerToolItemTypedDict, + CompactionItemTypedDict, + AdditionalToolsItemTypedDict, OutputFileSearchServerToolItemTypedDict, OutputFileSearchCallItemTypedDict, - OutputApplyPatchServerToolItemTypedDict, - McpApprovalResponseItemTypedDict, + ContextCompactionItemTypedDict, + EasyInputMessageTypedDict, + OutputTextEditorServerToolItemTypedDict, + OutputMcpServerToolItemTypedDict, FunctionCallOutputItemTypedDict, - OutputDatetimeItemTypedDict, OutputImageGenerationCallItemTypedDict, - ApplyPatchCallItemTypedDict, OutputWebSearchCallItemTypedDict, - ApplyPatchCallOutputItemTypedDict, - OutputBrowserUseServerToolItemTypedDict, - McpApprovalRequestItemTypedDict, - OutputTextEditorServerToolItemTypedDict, McpListToolsItemTypedDict, + OutputBrowserUseServerToolItemTypedDict, + ApplyPatchCallOutputItemTypedDict, LocalShellCallItemTypedDict, + OutputApplyPatchServerToolItemTypedDict, + McpApprovalResponseItemTypedDict, + ApplyPatchCallItemTypedDict, + McpApprovalRequestItemTypedDict, + OutputDatetimeItemTypedDict, OutputSearchModelsServerToolItemTypedDict, - OutputMcpServerToolItemTypedDict, + OutputMemoryServerToolItemTypedDict, InputsMessageTypedDict, OutputComputerCallItemTypedDict, - OutputMemoryServerToolItemTypedDict, - McpCallItemTypedDict, - AgentMessageItemTypedDict, OutputCodeInterpreterCallItemTypedDict, ShellCallItemTypedDict, - OutputAdvisorServerToolItemTypedDict, - OutputWebFetchServerToolItemTypedDict, - OutputImageGenerationServerToolItemTypedDict, + AgentMessageItemTypedDict, + McpCallItemTypedDict, OutputCodeInterpreterServerToolItemTypedDict, ReasoningItemTypedDict, + OutputAdvisorServerToolItemTypedDict, InputsReasoningTypedDict, + OutputWebFetchServerToolItemTypedDict, + OutputImageGenerationServerToolItemTypedDict, CustomToolCallItemTypedDict, - OutputCustomToolCallItemTypedDict, ShellCallOutputItemTypedDict, OutputFusionServerToolItemTypedDict, - OutputFunctionCallItemTypedDict, OutputShellServerToolItemTypedDict, OutputFilesServerToolItemTypedDict, FunctionCallItemTypedDict, @@ -443,50 +433,48 @@ def serialize_model(self, handler): Union[ ItemReferenceItem, ConfigurationUpdateItem, - ContextCompactionItem, - InputMessageItem, - AdditionalToolsItem, - EasyInputMessage, - OutputWebSearchServerToolItem, - CompactionItem, CustomToolCallOutputItem, + InputMessageItem, LocalShellCallOutputItem, OutputToolSearchServerToolItem, + OutputWebSearchServerToolItem, + CompactionItem, + AdditionalToolsItem, OutputFileSearchServerToolItem, OutputFileSearchCallItem, - OutputApplyPatchServerToolItem, - McpApprovalResponseItem, + ContextCompactionItem, + EasyInputMessage, + OutputTextEditorServerToolItem, + OutputMcpServerToolItem, FunctionCallOutputItem, - OutputDatetimeItem, OutputImageGenerationCallItem, - ApplyPatchCallItem, OutputWebSearchCallItem, - ApplyPatchCallOutputItem, - OutputBrowserUseServerToolItem, - McpApprovalRequestItem, - OutputTextEditorServerToolItem, McpListToolsItem, + OutputBrowserUseServerToolItem, + ApplyPatchCallOutputItem, LocalShellCallItem, + OutputApplyPatchServerToolItem, + McpApprovalResponseItem, + ApplyPatchCallItem, + McpApprovalRequestItem, + OutputDatetimeItem, OutputSearchModelsServerToolItem, - OutputMcpServerToolItem, + OutputMemoryServerToolItem, InputsMessage, OutputComputerCallItem, - OutputMemoryServerToolItem, - McpCallItem, - AgentMessageItem, OutputCodeInterpreterCallItem, ShellCallItem, - OutputAdvisorServerToolItem, - OutputWebFetchServerToolItem, - OutputImageGenerationServerToolItem, + AgentMessageItem, + McpCallItem, OutputCodeInterpreterServerToolItem, ReasoningItem, + OutputAdvisorServerToolItem, InputsReasoning, + OutputWebFetchServerToolItem, + OutputImageGenerationServerToolItem, CustomToolCallItem, - OutputCustomToolCallItem, ShellCallOutputItem, OutputFusionServerToolItem, - OutputFunctionCallItem, OutputShellServerToolItem, OutputFilesServerToolItem, FunctionCallItem, diff --git a/uv.lock b/uv.lock index 8992e576..9d6dd8f4 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.2.21" +version = "1.2.22" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 7a43b7c29a765adc99a89b441ec4b4e8ca2f1aad Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Wed, 23 Sep 2026 21:52:44 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow