diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 803358a..4056cc7 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: ad7637a68c46f585f25b6a36b9dd0f64 + docChecksum: 16502ba1d37c69afff28bddd6d7626fa docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.17 - configChecksum: e1094fdca787104fc58b99c1a21f533d + releaseVersion: 0.11.18 + configChecksum: a2b5416af2f6e419e890e700ebff85b2 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: efe0a4c5-68bb-420f-acd6-9382a2e84419 - pristine_commit_hash: 2c5b8d0d8b460f97ba19d673e012040cb8cceddc - pristine_tree_hash: d8087e47e225e199329a004d366ac4e933efff90 + generation_id: 43c7e9de-e01c-454f-963f-fffefb852389 + pristine_commit_hash: 507fe1d22cb798a9ec68eac499ec65af7c93a995 + pristine_tree_hash: e7dc383135ed75f29c946b77f2965d61ec238f63 features: python: acceptHeaders: 3.0.0 @@ -108,6 +108,30 @@ trackedFiles: id: 5886155bc810 last_write_checksum: sha1:64acd6c3d2db5593d8359474c4e2e31e4db62453 pristine_git_object: 6edb98e874664ab4349034ca3d0c5874f761fe9a + docs/components/additionaltoolsitem.mdx: + id: 8658d14827df + last_write_checksum: sha1:e97ba3bc67c191d689dba7fe6ab66871a1cecf3c + pristine_git_object: 34d2291edf704988089189629166217cc45ab2b0 + docs/components/additionaltoolsitemrole.mdx: + id: b3d0b645d28d + last_write_checksum: sha1:a8df9099d85af44ca7547bba92435a4d93523dd3 + pristine_git_object: 2e7f805c00b56bbd6872d986beb5fa76cb0a6c28 + docs/components/additionaltoolsitemtool.mdx: + id: 075b8c61fc35 + last_write_checksum: sha1:e038792f2a5d489bc1994d81d6df101d376c53e8 + pristine_git_object: 9dcea23673cc79bb60efaf0b84299aa4b916e3ca + docs/components/additionaltoolsitemtoolfunction.mdx: + id: b8c1e4fcad3b + last_write_checksum: sha1:fd16181ea1f609dfcb8cc4bdc566011d2041faee + pristine_git_object: d78714317e328d9131e563de7807db0761bb3da1 + docs/components/additionaltoolsitemtoolunion.mdx: + id: b3e8598b1887 + last_write_checksum: sha1:930eb580f2512a07b58b830f588dedad8ecab631 + pristine_git_object: 5fc5576b0d88994c2e7d6996181e51e5fd63fa94 + docs/components/additionaltoolsitemtypefunction.mdx: + id: bf179b4008af + last_write_checksum: sha1:c0d4fee7d39fbd3d08c44bbe0e7b929350c5d7e8 + pristine_git_object: 00ce08abaaf149eb1713cc084e87a8b1efc8df81 docs/components/advisornestedtool.mdx: id: 71464b7dde39 last_write_checksum: sha1:85f6613d57b23cb14b06e5bd9ee717dd7a0076cb @@ -2410,8 +2434,8 @@ trackedFiles: pristine_git_object: 33aee92c61bf7ab9beded4e193f50a2c08462378 docs/components/inputsunion1.mdx: id: c216609d21ce - last_write_checksum: sha1:ccfecdbd5ad7a2719b2372c54e9eac1075b1f108 - pristine_git_object: 9d37626f96de3c19d39e4901d041ef41b01bdc98 + last_write_checksum: sha1:be2b2255aaaa200ee37b27ad64e428592f8065cd + pristine_git_object: be6efd1c3a0a797e8f00600fb2fb47fa00b4ddf4 docs/components/inputtext.mdx: id: c8a97322a50a last_write_checksum: sha1:58653e40ea0a33629dda40d2a11c8d21a75b0467 @@ -4672,6 +4696,10 @@ trackedFiles: id: ed021c787cd5 last_write_checksum: sha1:bb6b3619ca5b6877ddd66dda0a2cb799c989ad33 pristine_git_object: 01eae6d76ebf42187c1dcbeaa43288f5df94e8cb + docs/components/typeadditionaltools.mdx: + id: e9b8d6c3c36b + last_write_checksum: sha1:6b4730663782a2052103e741b926d4943319b269 + pristine_git_object: fd61616ce5a2764c026d48863bb671a79be3e824 docs/components/typeadvisor20260301.mdx: id: 6b8fbaf1abe6 last_write_checksum: sha1:a8d7df683cc00996868f4a8f16d43f5171f9786c @@ -6506,8 +6534,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:8564217ec020db72f0e9fdbc4cc2a9741aef8da8 - pristine_git_object: 1f53995948f1621cbe09a49eab44c5b08e538977 + last_write_checksum: sha1:bb8d05c87d2fce01ba7ea9fe811425844624c6d6 + pristine_git_object: b9fecdcfb5971da6721e949608d09ca07d77307c scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6534,8 +6562,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:24a6775af4e431ffa67c67f909015339440e6b0a - pristine_git_object: d07f58993aa7027d3e22432eeec9c887d991b7ea + last_write_checksum: sha1:109693a9a2f8aaa8302f4a8c79ca80d9f736ed4f + pristine_git_object: 040c27279c9bd92aa793b82352d5b0b986c6faf9 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6574,8 +6602,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:f4f8b839a539a8885447d5bbdadcc985553d65c8 - pristine_git_object: 25795f206171fcfa804e2e44c033713d99f52c21 + last_write_checksum: sha1:db6939dcf34a388b4111cb127e372fd434a437c0 + pristine_git_object: 2b758c9d3531925e091e70d3aeb1559ecfef10a2 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6588,6 +6616,10 @@ trackedFiles: id: 0bd8d79c3144 last_write_checksum: sha1:db8e3247cf9eb2c235d32949d36f7ae95870e8ed pristine_git_object: 1138e6f6bc025546a86877749ce83aca4c46499a + src/openrouter/components/additionaltoolsitem.py: + id: 2761ab789f41 + last_write_checksum: sha1:9156822bf7cf6b71f1351e12a03b7a659c0a2762 + pristine_git_object: 1bd74f0c42994da09935ed8a6a4c0baa49a0bc5e src/openrouter/components/advisornestedtool.py: id: 768fcc6bad2b last_write_checksum: sha1:9c4303eb7fbefd1d7200cd588e7ab7e55db791e8 @@ -7610,8 +7642,8 @@ trackedFiles: pristine_git_object: a3d84a96f4553a320f5eee5d63f6bc5c244ab446 src/openrouter/components/inputs_union.py: id: 17d6239cb6a7 - last_write_checksum: sha1:289d1c1eb23075d285491f8fab2bf4d8dc941c4b - pristine_git_object: 1371934ab909d77965b050958080277ca8988f09 + last_write_checksum: sha1:56b54bc88ad27ba75866fa7f548fa405650d689a + pristine_git_object: 138ccb8156df5fe2baa8b2b4b60dce353fd3cf7a src/openrouter/components/inputtext.py: id: a995ae96be99 last_write_checksum: sha1:f78a6a35792b704f18ee6e1312c24f78f38cca36 @@ -10877,4 +10909,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.tts.create_speech()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.stt.create_transcription()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.byok.list()`: \n * `request.provider` **Changed** (Breaking ⚠️)\n * `response.data[].provider` **Changed** (Breaking ⚠️)\n* `open_router.byok.create()`: \n * `request.provider` **Changed** (Breaking ⚠️)\n * `response.data.provider` **Changed** (Breaking ⚠️)\n* `open_router.byok.get()`: `response.data.provider` **Changed** (Breaking ⚠️)\n* `open_router.byok.update()`: `response.data.provider` **Changed** (Breaking ⚠️)\n* `open_router.images.generate()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.video_generation.generate()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.generations.submit_feedback()`: **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem)` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index d85800f..20ab2ae 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.17 + version: 0.11.18 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 1a0c9ef..460cc29 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -149,6 +149,104 @@ components: required: - data type: object + AdditionalToolsItem: + description: Additional tools made available to the model at this point in the input + example: + role: developer + tools: + - name: get_weather + parameters: + properties: + location: + type: string + type: object + type: function + type: additional_tools + properties: + id: + nullable: true + type: string + role: + enum: + - unknown + - user + - assistant + - system + - critic + - discriminator + - developer + - tool + type: string + x-speakeasy-unknown-values: allow + tools: + items: + anyOf: + - allOf: + - $ref: '#/components/schemas/FunctionTool' + - properties: {} + type: object + description: Function tool definition + example: + description: Get the current weather in a location + name: get_weather + parameters: + properties: + location: + description: The city and state + type: string + unit: + enum: + - celsius + - fahrenheit + type: string + x-speakeasy-unknown-values: allow + required: + - location + type: object + type: function + - $ref: '#/components/schemas/Preview_WebSearchServerTool' + - $ref: '#/components/schemas/Preview_20250311_WebSearchServerTool' + - $ref: '#/components/schemas/Legacy_WebSearchServerTool' + - $ref: '#/components/schemas/WebSearchServerTool' + - $ref: '#/components/schemas/FileSearchServerTool' + - $ref: '#/components/schemas/ComputerUseServerTool' + - $ref: '#/components/schemas/CodeInterpreterServerTool' + - $ref: '#/components/schemas/McpServerTool' + - $ref: '#/components/schemas/ImageGenerationServerTool' + - $ref: '#/components/schemas/CodexLocalShellTool' + - $ref: '#/components/schemas/ShellServerTool' + - $ref: '#/components/schemas/ApplyPatchServerTool' + - $ref: '#/components/schemas/CustomTool' + - $ref: '#/components/schemas/AdvisorServerTool_OpenRouter' + - $ref: '#/components/schemas/SubagentServerTool_OpenRouter' + - $ref: '#/components/schemas/DatetimeServerTool' + - $ref: '#/components/schemas/FilesServerTool' + - $ref: '#/components/schemas/FusionServerTool_OpenRouter' + - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' + - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/WebFetchServerTool' + - $ref: '#/components/schemas/WebSearchServerTool_OpenRouter' + - $ref: '#/components/schemas/ApplyPatchServerTool_OpenRouter' + - $ref: '#/components/schemas/BashServerTool' + - $ref: '#/components/schemas/ShellServerTool_OpenRouter' + - additionalProperties: + nullable: true + properties: + type: + type: string + required: + - type + type: object + type: array + type: + enum: + - additional_tools + type: string + required: + - type + - role + - tools + type: object AdvisorNestedTool: additionalProperties: nullable: true @@ -10337,6 +10435,7 @@ components: - $ref: '#/components/schemas/CustomToolCallOutputItem' - $ref: '#/components/schemas/CompactionItem' - $ref: '#/components/schemas/ItemReferenceItem' + - $ref: '#/components/schemas/AdditionalToolsItem' type: array description: Input for a response request - can be a string or array of items example: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 4af3fa7..1f1f0a0 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:99649ad73bd44656a11c0f47bf5b52ff056911ce5543fdd487b1c7d835d4d01e - sourceBlobDigest: sha256:fb03e6ac1679e81970afc16a019748cc195bb2881a09f0e5dc0ae18934621701 + sourceRevisionDigest: sha256:5d92f9e16b58b6867b6333b47544046d8179ed6ee1ce9b9d289a5f5fc9ac13bf + sourceBlobDigest: sha256:59fc773016c0c02fc04da6c9785ff6cf5b572b30f5d22095b14564f1c4ff958b tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:99649ad73bd44656a11c0f47bf5b52ff056911ce5543fdd487b1c7d835d4d01e - sourceBlobDigest: sha256:fb03e6ac1679e81970afc16a019748cc195bb2881a09f0e5dc0ae18934621701 + sourceRevisionDigest: sha256:5d92f9e16b58b6867b6333b47544046d8179ed6ee1ce9b9d289a5f5fc9ac13bf + sourceBlobDigest: sha256:59fc773016c0c02fc04da6c9785ff6cf5b572b30f5d22095b14564f1c4ff958b codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:a6459b61a352d9d8512b16c634606461a35e4275e373904dec9cd85e245db64b + codeSamplesRevisionDigest: sha256:3770bb81a5566b8937f2c434e761c2a63e5c7f0507d7b3439ec0d1a87d53c673 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index bd0faa7..e1fac37 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -278,4 +278,14 @@ Based on: ### Generated - [python v0.11.17] . ### Releases -- [PyPI v0.11.17] https://pypi.org/project/openrouter/0.11.17 - . \ No newline at end of file +- [PyPI v0.11.17] https://pypi.org/project/openrouter/0.11.17 - . + +## 2026-07-10 01:18:52 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.18] . +### Releases +- [PyPI v0.11.18] https://pypi.org/project/openrouter/0.11.18 - . \ No newline at end of file diff --git a/docs/components/additionaltoolsitem.mdx b/docs/components/additionaltoolsitem.mdx new file mode 100644 index 0000000..34d2291 --- /dev/null +++ b/docs/components/additionaltoolsitem.mdx @@ -0,0 +1,15 @@ +--- +title: "AdditionalToolsItem" +--- + +Additional tools made available to the model at this point in the input + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `role` | [components.AdditionalToolsItemRole](../components/additionaltoolsitemrole.mdx) | :heavy_check_mark: | N/A | +| `tools` | List[[components.AdditionalToolsItemToolUnion](../components/additionaltoolsitemtoolunion.mdx)] | :heavy_check_mark: | N/A | +| `type` | [components.TypeAdditionalTools](../components/typeadditionaltools.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/additionaltoolsitemrole.mdx b/docs/components/additionaltoolsitemrole.mdx new file mode 100644 index 0000000..2e7f805 --- /dev/null +++ b/docs/components/additionaltoolsitemrole.mdx @@ -0,0 +1,26 @@ +--- +title: "AdditionalToolsItemRole" +--- + +## Example Usage + +```python +from openrouter.components import AdditionalToolsItemRole + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: AdditionalToolsItemRole = "unknown" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"unknown"` +- `"user"` +- `"assistant"` +- `"system"` +- `"critic"` +- `"discriminator"` +- `"developer"` +- `"tool"` diff --git a/docs/components/additionaltoolsitemtool.mdx b/docs/components/additionaltoolsitemtool.mdx new file mode 100644 index 0000000..9dcea23 --- /dev/null +++ b/docs/components/additionaltoolsitemtool.mdx @@ -0,0 +1,10 @@ +--- +title: "AdditionalToolsItemTool" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `type` | *str* | :heavy_check_mark: | N/A | +| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/additionaltoolsitemtoolfunction.mdx b/docs/components/additionaltoolsitemtoolfunction.mdx new file mode 100644 index 0000000..d787143 --- /dev/null +++ b/docs/components/additionaltoolsitemtoolfunction.mdx @@ -0,0 +1,16 @@ +--- +title: "AdditionalToolsItemToolFunction" +--- + +Function tool definition + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `name` | *str* | :heavy_check_mark: | N/A | +| `parameters` | Dict[str, *Nullable[Any]*] | :heavy_check_mark: | N/A | +| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `type` | [components.AdditionalToolsItemTypeFunction](../components/additionaltoolsitemtypefunction.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/additionaltoolsitemtoolunion.mdx b/docs/components/additionaltoolsitemtoolunion.mdx new file mode 100644 index 0000000..5fc5576 --- /dev/null +++ b/docs/components/additionaltoolsitemtoolunion.mdx @@ -0,0 +1,168 @@ +--- +title: "AdditionalToolsItemToolUnion" +--- + +## Supported Types + +### `components.AdditionalToolsItemToolFunction` + +```python +value: components.AdditionalToolsItemToolFunction = /* values here */ +``` + +### `components.PreviewWebSearchServerTool` + +```python +value: components.PreviewWebSearchServerTool = /* values here */ +``` + +### `components.Preview20250311WebSearchServerTool` + +```python +value: components.Preview20250311WebSearchServerTool = /* values here */ +``` + +### `components.LegacyWebSearchServerTool` + +```python +value: components.LegacyWebSearchServerTool = /* values here */ +``` + +### `components.WebSearchServerTool` + +```python +value: components.WebSearchServerTool = /* values here */ +``` + +### `components.FileSearchServerTool` + +```python +value: components.FileSearchServerTool = /* values here */ +``` + +### `components.ComputerUseServerTool` + +```python +value: components.ComputerUseServerTool = /* values here */ +``` + +### `components.CodeInterpreterServerTool` + +```python +value: components.CodeInterpreterServerTool = /* values here */ +``` + +### `components.McpServerTool` + +```python +value: components.McpServerTool = /* values here */ +``` + +### `components.ImageGenerationServerTool` + +```python +value: components.ImageGenerationServerTool = /* values here */ +``` + +### `components.CodexLocalShellTool` + +```python +value: components.CodexLocalShellTool = /* values here */ +``` + +### `components.ShellServerTool` + +```python +value: components.ShellServerTool = /* values here */ +``` + +### `components.ApplyPatchServerTool` + +```python +value: components.ApplyPatchServerTool = /* values here */ +``` + +### `components.CustomTool` + +```python +value: components.CustomTool = /* values here */ +``` + +### `components.AdvisorServerToolOpenRouter` + +```python +value: components.AdvisorServerToolOpenRouter = /* values here */ +``` + +### `components.SubagentServerToolOpenRouter` + +```python +value: components.SubagentServerToolOpenRouter = /* values here */ +``` + +### `components.DatetimeServerTool` + +```python +value: components.DatetimeServerTool = /* values here */ +``` + +### `components.FilesServerTool` + +```python +value: components.FilesServerTool = /* values here */ +``` + +### `components.FusionServerToolOpenRouter` + +```python +value: components.FusionServerToolOpenRouter = /* values here */ +``` + +### `components.ImageGenerationServerToolOpenRouter` + +```python +value: components.ImageGenerationServerToolOpenRouter = /* values here */ +``` + +### `components.ChatSearchModelsServerTool` + +```python +value: components.ChatSearchModelsServerTool = /* values here */ +``` + +### `components.WebFetchServerTool` + +```python +value: components.WebFetchServerTool = /* values here */ +``` + +### `components.WebSearchServerToolOpenRouter` + +```python +value: components.WebSearchServerToolOpenRouter = /* values here */ +``` + +### `components.ApplyPatchServerToolOpenRouter` + +```python +value: components.ApplyPatchServerToolOpenRouter = /* values here */ +``` + +### `components.BashServerTool` + +```python +value: components.BashServerTool = /* values here */ +``` + +### `components.ShellServerToolOpenRouter` + +```python +value: components.ShellServerToolOpenRouter = /* values here */ +``` + +### `components.AdditionalToolsItemTool` + +```python +value: components.AdditionalToolsItemTool = /* values here */ +``` + diff --git a/docs/components/additionaltoolsitemtypefunction.mdx b/docs/components/additionaltoolsitemtypefunction.mdx new file mode 100644 index 0000000..00ce08a --- /dev/null +++ b/docs/components/additionaltoolsitemtypefunction.mdx @@ -0,0 +1,15 @@ +--- +title: "AdditionalToolsItemTypeFunction" +--- + +## Example Usage + +```python +from openrouter.components import AdditionalToolsItemTypeFunction +value: AdditionalToolsItemTypeFunction = "function" +``` + + +## Values + +- `"function"` diff --git a/docs/components/inputsunion1.mdx b/docs/components/inputsunion1.mdx index 9d37626..be6efd1 100644 --- a/docs/components/inputsunion1.mdx +++ b/docs/components/inputsunion1.mdx @@ -280,3 +280,9 @@ value: components.CompactionItem = /* values here */ value: components.ItemReferenceItem = /* values here */ ``` +### `components.AdditionalToolsItem` + +```python +value: components.AdditionalToolsItem = /* values here */ +``` + diff --git a/docs/components/typeadditionaltools.mdx b/docs/components/typeadditionaltools.mdx new file mode 100644 index 0000000..fd61616 --- /dev/null +++ b/docs/components/typeadditionaltools.mdx @@ -0,0 +1,15 @@ +--- +title: "TypeAdditionalTools" +--- + +## Example Usage + +```python +from openrouter.components import TypeAdditionalTools +value: TypeAdditionalTools = "additional_tools" +``` + + +## Values + +- `"additional_tools"` diff --git a/pyproject.toml b/pyproject.toml index 1f53995..b9fecdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.17" +version = "0.11.18" 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 d07f589..040c272 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.17" +__version__: str = "0.11.18" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.17 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.18 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 25795f2..2b758c9 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -8,6 +8,19 @@ from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict from .activityitem import ActivityItem, ActivityItemTypedDict from .activityresponse import ActivityResponse, ActivityResponseTypedDict + from .additionaltoolsitem import ( + AdditionalToolsItem, + AdditionalToolsItemRole, + AdditionalToolsItemTool, + AdditionalToolsItemToolFunction, + AdditionalToolsItemToolFunctionTypedDict, + AdditionalToolsItemToolTypedDict, + AdditionalToolsItemToolUnion, + AdditionalToolsItemToolUnionTypedDict, + AdditionalToolsItemTypeFunction, + AdditionalToolsItemTypedDict, + TypeAdditionalTools, + ) from .advisornestedtool import AdvisorNestedTool, AdvisorNestedToolTypedDict from .advisorreasoning import ( AdvisorReasoning, @@ -2769,6 +2782,16 @@ "ActivityItemTypedDict", "ActivityResponse", "ActivityResponseTypedDict", + "AdditionalToolsItem", + "AdditionalToolsItemRole", + "AdditionalToolsItemTool", + "AdditionalToolsItemToolFunction", + "AdditionalToolsItemToolFunctionTypedDict", + "AdditionalToolsItemToolTypedDict", + "AdditionalToolsItemToolUnion", + "AdditionalToolsItemToolUnionTypedDict", + "AdditionalToolsItemTypeFunction", + "AdditionalToolsItemTypedDict", "AdvisorNestedTool", "AdvisorNestedToolTypedDict", "AdvisorReasoning", @@ -4586,6 +4609,7 @@ "Truncation", "Type", "TypeAdaptive", + "TypeAdditionalTools", "TypeAdvisor20260301", "TypeAny", "TypeBash20250124", @@ -4782,6 +4806,17 @@ "ActivityItemTypedDict": ".activityitem", "ActivityResponse": ".activityresponse", "ActivityResponseTypedDict": ".activityresponse", + "AdditionalToolsItem": ".additionaltoolsitem", + "AdditionalToolsItemRole": ".additionaltoolsitem", + "AdditionalToolsItemTool": ".additionaltoolsitem", + "AdditionalToolsItemToolFunction": ".additionaltoolsitem", + "AdditionalToolsItemToolFunctionTypedDict": ".additionaltoolsitem", + "AdditionalToolsItemToolTypedDict": ".additionaltoolsitem", + "AdditionalToolsItemToolUnion": ".additionaltoolsitem", + "AdditionalToolsItemToolUnionTypedDict": ".additionaltoolsitem", + "AdditionalToolsItemTypeFunction": ".additionaltoolsitem", + "AdditionalToolsItemTypedDict": ".additionaltoolsitem", + "TypeAdditionalTools": ".additionaltoolsitem", "AdvisorNestedTool": ".advisornestedtool", "AdvisorNestedToolTypedDict": ".advisornestedtool", "AdvisorReasoning": ".advisorreasoning", diff --git a/src/openrouter/components/additionaltoolsitem.py b/src/openrouter/components/additionaltoolsitem.py new file mode 100644 index 0000000..1bd74f0 --- /dev/null +++ b/src/openrouter/components/additionaltoolsitem.py @@ -0,0 +1,284 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .advisorservertool_openrouter import ( + AdvisorServerToolOpenRouter, + AdvisorServerToolOpenRouterTypedDict, +) +from .applypatchservertool import ApplyPatchServerTool, ApplyPatchServerToolTypedDict +from .applypatchservertool_openrouter import ( + ApplyPatchServerToolOpenRouter, + ApplyPatchServerToolOpenRouterTypedDict, +) +from .bashservertool import BashServerTool, BashServerToolTypedDict +from .chatsearchmodelsservertool import ( + ChatSearchModelsServerTool, + ChatSearchModelsServerToolTypedDict, +) +from .codeinterpreterservertool import ( + CodeInterpreterServerTool, + CodeInterpreterServerToolTypedDict, +) +from .codexlocalshelltool import CodexLocalShellTool, CodexLocalShellToolTypedDict +from .computeruseservertool import ComputerUseServerTool, ComputerUseServerToolTypedDict +from .customtool import CustomTool, CustomToolTypedDict +from .datetimeservertool import DatetimeServerTool, DatetimeServerToolTypedDict +from .filesearchservertool import FileSearchServerTool, FileSearchServerToolTypedDict +from .filesservertool import FilesServerTool, FilesServerToolTypedDict +from .fusionservertool_openrouter import ( + FusionServerToolOpenRouter, + FusionServerToolOpenRouterTypedDict, +) +from .imagegenerationservertool import ( + ImageGenerationServerTool, + ImageGenerationServerToolTypedDict, +) +from .imagegenerationservertool_openrouter import ( + ImageGenerationServerToolOpenRouter, + ImageGenerationServerToolOpenRouterTypedDict, +) +from .legacy_websearchservertool import ( + LegacyWebSearchServerTool, + LegacyWebSearchServerToolTypedDict, +) +from .mcpservertool import McpServerTool, McpServerToolTypedDict +from .preview_20250311_websearchservertool import ( + Preview20250311WebSearchServerTool, + Preview20250311WebSearchServerToolTypedDict, +) +from .preview_websearchservertool import ( + PreviewWebSearchServerTool, + PreviewWebSearchServerToolTypedDict, +) +from .shellservertool import ShellServerTool, ShellServerToolTypedDict +from .shellservertool_openrouter import ( + ShellServerToolOpenRouter, + ShellServerToolOpenRouterTypedDict, +) +from .subagentservertool_openrouter import ( + SubagentServerToolOpenRouter, + SubagentServerToolOpenRouterTypedDict, +) +from .webfetchservertool import WebFetchServerTool, WebFetchServerToolTypedDict +from .websearchservertool import WebSearchServerTool, WebSearchServerToolTypedDict +from .websearchservertool_openrouter import ( + WebSearchServerToolOpenRouter, + WebSearchServerToolOpenRouterTypedDict, +) +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +import pydantic +from pydantic import ConfigDict, model_serializer +from typing import Any, Dict, List, Literal, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +AdditionalToolsItemRole = Union[ + Literal[ + "unknown", + "user", + "assistant", + "system", + "critic", + "discriminator", + "developer", + "tool", + ], + UnrecognizedStr, +] + + +class AdditionalToolsItemToolTypedDict(TypedDict): + type: str + + +class AdditionalToolsItemTool(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + type: str + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + +AdditionalToolsItemTypeFunction = Literal["function",] + + +class AdditionalToolsItemToolFunctionTypedDict(TypedDict): + r"""Function tool definition""" + + name: str + parameters: Nullable[Dict[str, Nullable[Any]]] + type: AdditionalToolsItemTypeFunction + description: NotRequired[Nullable[str]] + strict: NotRequired[Nullable[bool]] + + +class AdditionalToolsItemToolFunction(BaseModel): + r"""Function tool definition""" + + name: str + + parameters: Nullable[Dict[str, Nullable[Any]]] + + type: AdditionalToolsItemTypeFunction + + description: OptionalNullable[str] = UNSET + + strict: OptionalNullable[bool] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["description", "strict"]) + nullable_fields = set(["description", "parameters", "strict"]) + 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 + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +AdditionalToolsItemToolUnionTypedDict = TypeAliasType( + "AdditionalToolsItemToolUnionTypedDict", + Union[ + CodexLocalShellToolTypedDict, + ApplyPatchServerToolTypedDict, + ShellServerToolTypedDict, + FusionServerToolOpenRouterTypedDict, + ImageGenerationServerToolOpenRouterTypedDict, + AdditionalToolsItemToolTypedDict, + ShellServerToolOpenRouterTypedDict, + CodeInterpreterServerToolTypedDict, + BashServerToolTypedDict, + ApplyPatchServerToolOpenRouterTypedDict, + WebSearchServerToolOpenRouterTypedDict, + WebFetchServerToolTypedDict, + ChatSearchModelsServerToolTypedDict, + FilesServerToolTypedDict, + AdvisorServerToolOpenRouterTypedDict, + SubagentServerToolOpenRouterTypedDict, + DatetimeServerToolTypedDict, + CustomToolTypedDict, + ComputerUseServerToolTypedDict, + AdditionalToolsItemToolFunctionTypedDict, + FileSearchServerToolTypedDict, + WebSearchServerToolTypedDict, + PreviewWebSearchServerToolTypedDict, + Preview20250311WebSearchServerToolTypedDict, + LegacyWebSearchServerToolTypedDict, + McpServerToolTypedDict, + ImageGenerationServerToolTypedDict, + ], +) + + +AdditionalToolsItemToolUnion = TypeAliasType( + "AdditionalToolsItemToolUnion", + Union[ + CodexLocalShellTool, + ApplyPatchServerTool, + ShellServerTool, + FusionServerToolOpenRouter, + ImageGenerationServerToolOpenRouter, + AdditionalToolsItemTool, + ShellServerToolOpenRouter, + CodeInterpreterServerTool, + BashServerTool, + ApplyPatchServerToolOpenRouter, + WebSearchServerToolOpenRouter, + WebFetchServerTool, + ChatSearchModelsServerTool, + FilesServerTool, + AdvisorServerToolOpenRouter, + SubagentServerToolOpenRouter, + DatetimeServerTool, + CustomTool, + ComputerUseServerTool, + AdditionalToolsItemToolFunction, + FileSearchServerTool, + WebSearchServerTool, + PreviewWebSearchServerTool, + Preview20250311WebSearchServerTool, + LegacyWebSearchServerTool, + McpServerTool, + ImageGenerationServerTool, + ], +) + + +TypeAdditionalTools = Literal["additional_tools",] + + +class AdditionalToolsItemTypedDict(TypedDict): + r"""Additional tools made available to the model at this point in the input""" + + role: AdditionalToolsItemRole + tools: List[AdditionalToolsItemToolUnionTypedDict] + type: TypeAdditionalTools + id: NotRequired[Nullable[str]] + + +class AdditionalToolsItem(BaseModel): + r"""Additional tools made available to the model at this point in the input""" + + role: AdditionalToolsItemRole + + tools: List[AdditionalToolsItemToolUnion] + + type: TypeAdditionalTools + + id: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["id"]) + nullable_fields = set(["id"]) + 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 + 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 1371934..138ccb8 100644 --- a/src/openrouter/components/inputs_union.py +++ b/src/openrouter/components/inputs_union.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .additionaltoolsitem import AdditionalToolsItem, AdditionalToolsItemTypedDict from .applypatchcallitem import ApplyPatchCallItem, ApplyPatchCallItemTypedDict from .applypatchcalloutputitem import ( ApplyPatchCallOutputItem, @@ -375,40 +376,41 @@ def serialize_model(self, handler): Union[ ItemReferenceItemTypedDict, CompactionItemTypedDict, - OutputFileSearchCallItemTypedDict, - EasyInputMessageTypedDict, - InputMessageItemTypedDict, + AdditionalToolsItemTypedDict, + OutputImageGenerationCallItemTypedDict, LocalShellCallOutputItemTypedDict, OutputToolSearchServerToolItemTypedDict, OutputFileSearchServerToolItemTypedDict, - OutputWebSearchServerToolItemTypedDict, CustomToolCallOutputItemTypedDict, - OutputImageGenerationCallItemTypedDict, + InputMessageItemTypedDict, + EasyInputMessageTypedDict, + OutputWebSearchServerToolItemTypedDict, OutputWebSearchCallItemTypedDict, + OutputFileSearchCallItemTypedDict, OutputDatetimeItemTypedDict, - OutputMcpServerToolItemTypedDict, + OutputApplyPatchServerToolItemTypedDict, FunctionCallOutputItemTypedDict, - OutputSearchModelsServerToolItemTypedDict, LocalShellCallItemTypedDict, - ApplyPatchCallItemTypedDict, McpListToolsItemTypedDict, + OutputSearchModelsServerToolItemTypedDict, ApplyPatchCallOutputItemTypedDict, - McpApprovalResponseItemTypedDict, + OutputMcpServerToolItemTypedDict, OutputBrowserUseServerToolItemTypedDict, - McpApprovalRequestItemTypedDict, + McpApprovalResponseItemTypedDict, OutputTextEditorServerToolItemTypedDict, - OutputApplyPatchServerToolItemTypedDict, + ApplyPatchCallItemTypedDict, + McpApprovalRequestItemTypedDict, + OutputCodeInterpreterCallItemTypedDict, + OutputMemoryServerToolItemTypedDict, CustomToolCallItemTypedDict, InputsMessageTypedDict, - OutputMemoryServerToolItemTypedDict, OutputCustomToolCallItemTypedDict, - OutputComputerCallItemTypedDict, ShellCallOutputItemTypedDict, ShellCallItemTypedDict, - OutputCodeInterpreterCallItemTypedDict, + OutputComputerCallItemTypedDict, OutputBashServerToolItemTypedDict, - OutputImageGenerationServerToolItemTypedDict, McpCallItemTypedDict, + OutputImageGenerationServerToolItemTypedDict, OutputFunctionCallItemTypedDict, FunctionCallItemTypedDict, OutputFilesServerToolItemTypedDict, @@ -428,40 +430,41 @@ def serialize_model(self, handler): Union[ ItemReferenceItem, CompactionItem, - OutputFileSearchCallItem, - EasyInputMessage, - InputMessageItem, + AdditionalToolsItem, + OutputImageGenerationCallItem, LocalShellCallOutputItem, OutputToolSearchServerToolItem, OutputFileSearchServerToolItem, - OutputWebSearchServerToolItem, CustomToolCallOutputItem, - OutputImageGenerationCallItem, + InputMessageItem, + EasyInputMessage, + OutputWebSearchServerToolItem, OutputWebSearchCallItem, + OutputFileSearchCallItem, OutputDatetimeItem, - OutputMcpServerToolItem, + OutputApplyPatchServerToolItem, FunctionCallOutputItem, - OutputSearchModelsServerToolItem, LocalShellCallItem, - ApplyPatchCallItem, McpListToolsItem, + OutputSearchModelsServerToolItem, ApplyPatchCallOutputItem, - McpApprovalResponseItem, + OutputMcpServerToolItem, OutputBrowserUseServerToolItem, - McpApprovalRequestItem, + McpApprovalResponseItem, OutputTextEditorServerToolItem, - OutputApplyPatchServerToolItem, + ApplyPatchCallItem, + McpApprovalRequestItem, + OutputCodeInterpreterCallItem, + OutputMemoryServerToolItem, CustomToolCallItem, InputsMessage, - OutputMemoryServerToolItem, OutputCustomToolCallItem, - OutputComputerCallItem, ShellCallOutputItem, ShellCallItem, - OutputCodeInterpreterCallItem, + OutputComputerCallItem, OutputBashServerToolItem, - OutputImageGenerationServerToolItem, McpCallItem, + OutputImageGenerationServerToolItem, OutputFunctionCallItem, FunctionCallItem, OutputFilesServerToolItem, diff --git a/uv.lock b/uv.lock index 852a1d8..61e791f 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.17" +version = "0.11.18" source = { editable = "." } dependencies = [ { name = "httpcore" },