diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index a1bc4668..7e4c679b 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: 06c8e9946edd210938b68d85ffb902ff + docChecksum: 5be60b3df0b772d4a1e72412e5fa57bb docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.1.58 - configChecksum: 03d8d21ef3595cf11b1de19ad72c2ee0 + releaseVersion: 1.1.59 + configChecksum: 55d10c7f7eb996038e890bb1afd9fbf3 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: c6ef7a42-8e52-4c53-a36f-16fa8905e9b9 - pristine_commit_hash: 952cde02a6b857b63952e37a6151f7253e0091b1 - pristine_tree_hash: 1855d55f6fcd84d45de5b4973cd470d55d217d13 + generation_id: 36a3dd95-ed41-4ff9-9696-c4f3b05f7541 + pristine_commit_hash: 2a659f864394533e91de3b67b9a1fc1e82444c2f + pristine_tree_hash: c8cae87933ca431a58e624f5b156000a238fdd0b features: python: acceptHeaders: 3.0.0 @@ -2658,8 +2658,8 @@ trackedFiles: pristine_git_object: 33aee92c61bf7ab9beded4e193f50a2c08462378 docs/components/inputsunion1.mdx: id: c216609d21ce - last_write_checksum: sha1:38d513739703efb245bb9c09606aacc35651ad92 - pristine_git_object: 2e56403330ecae1d43fd2e4d23976dfe5330c38d + last_write_checksum: sha1:bbfac22455a7276ddffc53d3f6db8a95798cee4d + pristine_git_object: 0ffd2524e66f1242176e60ed5389f110864411e0 docs/components/inputtext.mdx: id: c8a97322a50a last_write_checksum: sha1:6f92abbb193a5d21cc129df4c5804b3f9161322d @@ -3686,12 +3686,12 @@ trackedFiles: pristine_git_object: 98279af1570063f5a0124fa4f575ed58b215c517 docs/components/outcomeexit.mdx: id: 760b3faffdf7 - last_write_checksum: sha1:6fbd92f244db4a275245f12d405faff18a18bc01 - pristine_git_object: dd9bda681ed90bb67dca90944f04ed6e6711b3e6 + last_write_checksum: sha1:15f8fda3619c2e844bfdef499c079cafe30d22a0 + pristine_git_object: 56aaef49a431eeee14635f940cc7d649d20d7a90 docs/components/outcometimeout.mdx: id: 4ee5cced97d5 - last_write_checksum: sha1:e81aa94e0d5d2fd30894499ac6b1d33cb329427d - pristine_git_object: 6fe515d1498ffc5e6a0abf4a4ca3f7984af90573 + last_write_checksum: sha1:dc0882c068159f34b3e787353915e9673914d2ba + pristine_git_object: 2dc6cbbbd0d12d23e42d9e393ec89d3507bf587e docs/components/outputadvisorservertoolitem.mdx: id: cd80a2ee4d39 last_write_checksum: sha1:75846501525d089fbf5f2d3beb0da6fe795c7eda @@ -3718,8 +3718,8 @@ trackedFiles: pristine_git_object: ad79a325e74efc6cc08ad7ffc794cecd0e7eaa15 docs/components/outputbashservertoolitem.mdx: id: c17c44c991b5 - last_write_checksum: sha1:6f0a1d504dca563629c30d3ba3a00794758e1444 - pristine_git_object: cf5ee887723a1081f1f12b22e8d6cbb478cbfe35 + last_write_checksum: sha1:00018a05919a43ae978a47975d643c7011046eef + pristine_git_object: bbd5a88a48589e639709e0ed88080980035308f9 docs/components/outputbashservertoolitemtype.mdx: id: 584dd317e6ab last_write_checksum: sha1:558e35bae6619f511da32758b7642bc6f000c95e @@ -3802,8 +3802,8 @@ trackedFiles: pristine_git_object: fe499bd21f3539752b0091907a0b3dd5c55b5d76 docs/components/outputfilesservertoolitem.mdx: id: 345df34acb80 - last_write_checksum: sha1:41c547463bd869c4acc0c8ad64ea2d4bc0a9998b - pristine_git_object: 111b79f06ab2edb08b60062868b1dd13fe14d740 + last_write_checksum: sha1:24af5ab89f945cf3e0d361fc216e8cc627794f6d + pristine_git_object: f4514c8f344dd1bd3cb4965a5e388ad6eccd5285 docs/components/outputfilesservertoolitemtype.mdx: id: abdc83b528c9 last_write_checksum: sha1:5a89f4165e70f4dee1b74cd300a790e0274d55f2 @@ -3870,8 +3870,8 @@ trackedFiles: pristine_git_object: 7e12c2ee3da68966a14d19207b95699c7b57d1e5 docs/components/outputitems.mdx: id: 876e956be23e - last_write_checksum: sha1:feaf29256eb4203388160c9f8c22292dde315bef - pristine_git_object: f73cc6671c184f19ca530e8d0bda4e6cc247e30b + last_write_checksum: sha1:12794ca2c665bfee086e9117a84eed62f7e13eeb + pristine_git_object: a0d4eb80a23a0d89e9f37c10e13f40c9086ed7e6 docs/components/outputmcpservertoolitem.mdx: id: 78e33fe9943f last_write_checksum: sha1:b64c87e227cf51037bc59aca8fb82b2ed0dd2f4c @@ -4018,8 +4018,8 @@ trackedFiles: pristine_git_object: 80904602e8e35699fce804be328b522c7b76bd8d docs/components/outputshellcallitem.mdx: id: b9bf31512bf2 - last_write_checksum: sha1:e1a1a10f771bddfe434645a01dc395f768389e40 - pristine_git_object: 994c3c01f230dd29d47df507fbed3f067e56f1c1 + last_write_checksum: sha1:056d852b8060e44fbddd1d674435c10fa62574d1 + pristine_git_object: 6c6d7164367f9bbd50cadfb6afec2e463a3ad56e docs/components/outputshellcallitemaction.mdx: id: e37067fe9cd1 last_write_checksum: sha1:2d3b53d5f5d2a4bcce027d55a3b36f78d13ab197 @@ -4030,16 +4030,24 @@ trackedFiles: pristine_git_object: 6e25f4cdd42f706845c834921a44a7198a09c2f3 docs/components/outputshellcalloutputitem.mdx: id: 2ce46fbb594f - last_write_checksum: sha1:0386175dde77211ad62fef7da9365c518de62984 - pristine_git_object: b8fc79b3a0fac24dd0637837426283675e4d87c1 - docs/components/outputshellcalloutputitemoutput.mdx: - id: d3e6fe7ad91a - last_write_checksum: sha1:12d8f0d5576898fed2328396c52d6dad7c859dbc - pristine_git_object: ca3f63fd3395cb4abcb6f884b16fd9d2b969a30d - docs/components/outputshellcalloutputitemtypeshellcalloutput.mdx: - id: b3771721488e - last_write_checksum: sha1:a2f348d70becceafa08d4d0ebd5dabe7a0395e3d - pristine_git_object: 2bfc5b85b0a0962d951930f1fd22bf3fb230750a + last_write_checksum: sha1:543303f3914a65c38ca292556ddaaa05dff4a191 + pristine_git_object: cf531ef21c79f71170cb0e7711d95841770c7e90 + docs/components/outputshellcalloutputitemtype.mdx: + id: 5d7cecdae902 + last_write_checksum: sha1:c3fc1a2b39289ebf639abd09e22349ba9b204b68 + pristine_git_object: a75efc131736760666676258245184917964077d + docs/components/outputshellservertoolitem.mdx: + id: d505095331df + last_write_checksum: sha1:ef276a16d376220f72271338ac73283c832bc9fb + pristine_git_object: 70d446926468e3f7c85edecf44639c14555167d3 + docs/components/outputshellservertoolitemaction.mdx: + id: 0f70af617523 + last_write_checksum: sha1:77a1972b2435a12de88ac334bf73996a8277cac8 + pristine_git_object: 56f9a9add18a5cf8ecf657295e083956b2f2a548 + docs/components/outputshellservertoolitemtype.mdx: + id: 6ba3a70cfee4 + last_write_checksum: sha1:cf54c37351d4bbef3be6b7a6eae983790d19fa3c + pristine_git_object: 216dd4e765339e50595aa8ccd68a1b4f94e943b5 docs/components/outputsubagentservertoolitem.mdx: id: afeb6acde438 last_write_checksum: sha1:28a36b448ac773fda95281d45bcebb1b4428873c @@ -4746,8 +4754,8 @@ trackedFiles: pristine_git_object: 4b94d8dffe97ab1b43231a40ae4947bc5bd86dc1 docs/components/shellcallitem.mdx: id: 172eabd6add3 - last_write_checksum: sha1:a6a305a8589a1ec230110e823639d7ce13b568cd - pristine_git_object: a43e459881ee109bfee9a4ade1f1c9a24c82fec8 + last_write_checksum: sha1:e74a0f2bfb8fb35ed44c9fc856ac92d1fbc74624 + pristine_git_object: 4e9f17f39aec72ffc81cbe41be18832a42e82755 docs/components/shellcallitemaction.mdx: id: cbd26fb9049f last_write_checksum: sha1:e1f76bee9ea1ac27ffc7bad531335b55de3110e4 @@ -4756,14 +4764,14 @@ trackedFiles: id: c198ee9e7382 last_write_checksum: sha1:933fad7f148c81a73de7bf0d6f2083038fc0803b pristine_git_object: fe8aa0d80f56454a4326d74c8ee8a7793427312d + docs/components/shellcalloutputcontent.mdx: + id: edef6979c20b + last_write_checksum: sha1:9d88c4b49d5b85f86d00f1eb1ae63baf6a466068 + pristine_git_object: 9aaa17fdf863725e77de2784a601626d0b82b7e0 docs/components/shellcalloutputitem.mdx: id: 3c692a7914b0 - last_write_checksum: sha1:190b9acbe6dfbe3795fa404724583b22f6fd559a - pristine_git_object: 7cf2cb9d735df608d9fc52994bd7f99a88c195b9 - docs/components/shellcalloutputitemoutput.mdx: - id: 85a0aef86180 - last_write_checksum: sha1:5b791955f59fa0170ab221c7c28596f3e14361e3 - pristine_git_object: fdfd9aee41199b4bb26482e8d29b4dc60bdcbf32 + last_write_checksum: sha1:6ad5b5863359ce5590ee5b0c2d047d2d7b41a021 + pristine_git_object: 7dcab460c00e513357a94c4c6d87826ec3b1eeae docs/components/shellcalloutputitemtype.mdx: id: 13012771fc34 last_write_checksum: sha1:0bd6909e931eeb3ab3a22dd98b9a51c67f1d0dfa @@ -7246,8 +7254,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:b9eb32a35533987e08d3e8b48330159f52c563fd - pristine_git_object: 6d5eb569679b7dbfd13226b6b5ee01877ca5e47a + last_write_checksum: sha1:461cce938a63d76a3a9c60da3bb3e312671c4a3b + pristine_git_object: a40a9272baf34905d0b1060cb4b7bb4179a4f39a scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -7274,8 +7282,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:14ae4beff235133d72d78bc00df97836d6ad5086 - pristine_git_object: de1436078d61137886e93377ebdcd2dc702e8887 + last_write_checksum: sha1:d0922f7cd84af53a51cf526ce58c6e053a7a865d + pristine_git_object: a6696aa915a48c66616e85550c7594ef07dc3f9a src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:3ea0f1c73fb9c101b7bc5719da4dd7bf62ff469a @@ -7318,8 +7326,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:4873861b268ae7ca8a5761a36d7be42b26f4583b - pristine_git_object: 5521c2bba2263ca396bafdb33ed7515d39ac1daf + last_write_checksum: sha1:1038d7f0c962e487787582da4d527b819f122aee + pristine_git_object: 84f9a9561ebe764a905326d20e6e80ba30922047 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -8470,8 +8478,8 @@ trackedFiles: pristine_git_object: f499cbbb546232f5cfbfe2c44fb41aefb306c87f src/openrouter/components/inputs_union.py: id: 17d6239cb6a7 - last_write_checksum: sha1:ab2d2da2fd44e37609c350ec39889f991e94bd40 - pristine_git_object: 557636cb8660e4c47c77f5c892592a6c201b79a4 + last_write_checksum: sha1:07d9ef297ea849a41c6b8b3df279bc32608dad25 + pristine_git_object: e4eaeb22660855b4951da642fd8595d1d0b1399a src/openrouter/components/inputtext.py: id: a995ae96be99 last_write_checksum: sha1:2da9ff645acc96772701908830151c5a707ed021 @@ -8878,8 +8886,8 @@ trackedFiles: pristine_git_object: 919f2bb6ec91d62dcb223c15e2a25d2830b75ac9 src/openrouter/components/outputbashservertoolitem.py: id: 39d03767e214 - last_write_checksum: sha1:4131ffc72dc8453a69519123865251149ff61a2c - pristine_git_object: 6a1f46ff0c467c6fffdb24aa58d45067e521f3f3 + last_write_checksum: sha1:4b61effcebc1cfcbc29342cc6ac4cb5da68dcc1c + pristine_git_object: 58a109b4e1dc863ce5db689b2154451bcd4d20e4 src/openrouter/components/outputbrowseruseservertoolitem.py: id: 73bff94d7284 last_write_checksum: sha1:6835f17b73a909e8a49ce9ba1257d43c62eeb690 @@ -8914,8 +8922,8 @@ trackedFiles: pristine_git_object: 5be878556b892a54a5931400f92d0f171224428b src/openrouter/components/outputfilesservertoolitem.py: id: 552155de1bb4 - last_write_checksum: sha1:7f77012ef034ec1635c2bdf6219b6b1e0b46834d - pristine_git_object: 5f30e958618a659ecc83c746240144961c6bf6e6 + last_write_checksum: sha1:81c1b468f7c438d0c343ef6cf4c92a54dcc56e21 + pristine_git_object: 371f5baa613d7f95bf837a8b5f358d21c2c266b2 src/openrouter/components/outputfunctioncallitem.py: id: 516ed67b5406 last_write_checksum: sha1:7bffd3f5f8e3b728c1e3c91bd2193f190bb90e94 @@ -8938,8 +8946,8 @@ trackedFiles: pristine_git_object: 94af810bbdb87fb8c6800645354f7ec4dd067e7f src/openrouter/components/outputitems.py: id: 90f107de3116 - last_write_checksum: sha1:3ed1ee5e49484845da550c7dbe3c18fb27e2b769 - pristine_git_object: 3866bb7e4f63ee9d066358bed7f388232de25c6c + last_write_checksum: sha1:fb51f8c5bdd13cc301d85d6d54f7937c50ca6c8b + pristine_git_object: fe6ee4f108a8c06baa786175bb2ee3c357987211 src/openrouter/components/outputmcpservertoolitem.py: id: bb8c2536a58e last_write_checksum: sha1:28d33c9226ff4ce6871457fa1fae384b590f676c @@ -8974,12 +8982,16 @@ trackedFiles: pristine_git_object: b9f5ac2a2c060ebf5f4e348a8ad7523757f37b2d src/openrouter/components/outputshellcallitem.py: id: 9c6a586d3cac - last_write_checksum: sha1:5e15c61abee491ebe71071b5626cc9b2f9fbf4e9 - pristine_git_object: b5840770d05d730618b0314cb97dc7d49e43158b + last_write_checksum: sha1:eee70e899ef087183c4124266941fe2b4894cc9d + pristine_git_object: 23aa9caf8b965f08e7e4acbe6a2e7830b89e3661 src/openrouter/components/outputshellcalloutputitem.py: id: 9962f4d291a9 - last_write_checksum: sha1:4c661e84741d346a7d5586b5df1120d1609e86d7 - pristine_git_object: 18a1f6df264fe768bd78d5c4b7c1c030ecec7b37 + last_write_checksum: sha1:e7bbbbd92cfa0e6386ca03661fb5d7703252bd50 + pristine_git_object: 40507fc7afc6ba3c8f2964491d09cd317826b514 + src/openrouter/components/outputshellservertoolitem.py: + id: 3c1670e937ec + last_write_checksum: sha1:28dfa5e62cb418222770eb5d9906068073cc3398 + pristine_git_object: 16e5a50c79f6aae945327efbabd50e5c17ffec6f src/openrouter/components/outputsubagentservertoolitem.py: id: 7480e835aa08 last_write_checksum: sha1:fcda61a3604f16bed4ce3842b57de32d309316f4 @@ -9342,12 +9354,16 @@ trackedFiles: pristine_git_object: e105a7eb1936e652dadb95209bfa1f5258a2fb4b src/openrouter/components/shellcallitem.py: id: 0b3b4f503413 - last_write_checksum: sha1:460fb9d45c3b4f7392ef5213878c541bb0e922f2 - pristine_git_object: 3eeb48a1f6161424a8a5e66f797863ca8e3a6361 + last_write_checksum: sha1:a38ef2249c5b8a7e20f61bac58c0816c4b76fc47 + pristine_git_object: 91d01b1c13623ece295bbdf451b032891393ff31 + src/openrouter/components/shellcalloutputcontent.py: + id: e48cfc20241f + last_write_checksum: sha1:b44aba028cf75c2cbf08e675e748ea53586e363a + pristine_git_object: 14d6df7ad9970385355b7c1d6752a270a8aa267b src/openrouter/components/shellcalloutputitem.py: id: 54409ebc9cdd - last_write_checksum: sha1:ed00ff681b3558f0a84f86bee8c1fb564ac1ad23 - pristine_git_object: 3996cdd37763964f46cb6bec76bd63803130d402 + last_write_checksum: sha1:34d015222a4f280c5dc8705cacfe70afd72de940 + pristine_git_object: 91d5927aa02a6671c2f62f902ae7db8a15153f05 src/openrouter/components/shellcallstatus.py: id: 3627230aad33 last_write_checksum: sha1:c026c8544f66c0ae9bdfa83b9d63502ee8f2907d @@ -12163,4 +12179,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[]` **Changed**\n * `response` **Changed**\n* `open_router.chat.send()`: \n * `request.tools[].union(SubagentServerTool_OpenRouter).parameters` **Changed**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.tools[].union(SubagentServerTool_OpenRouter).parameters` **Changed**\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[]` **Changed**\n* `open_router.responses.send()`: \n * `request.input.union(Array<>)[]` **Changed**\n * `response` **Changed**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[]` **Changed** (Breaking ⚠️)\n * `response` **Changed** (Breaking ⚠️)\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 * `response` **Changed** (Breaking ⚠️)\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 58c08e60..0daba9e1 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.1.58 + version: 1.1.59 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index dd9719cb..a07cc967 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -11452,6 +11452,7 @@ components: - $ref: '#/components/schemas/OutputAdvisorServerToolItem' - $ref: '#/components/schemas/OutputSubagentServerToolItem' - $ref: '#/components/schemas/OutputFilesServerToolItem' + - $ref: '#/components/schemas/OutputShellServerToolItem' - $ref: '#/components/schemas/LocalShellCallItem' - $ref: '#/components/schemas/LocalShellCallOutputItem' - $ref: '#/components/schemas/ShellCallItem' @@ -18285,10 +18286,14 @@ components: properties: arguments: description: 'The raw tool-call arguments string as emitted by the model.' - type: 'string' + type: + - 'string' + - 'null' call_id: description: 'The model-generated tool call id from the originating turn.' - type: 'string' + type: + - 'string' + - 'null' command: type: 'string' exitCode: @@ -18534,6 +18539,16 @@ components: status: 'completed' type: 'openrouter:files' properties: + arguments: + description: 'The raw tool-call arguments string as emitted by the model.' + type: + - 'string' + - 'null' + call_id: + description: 'The model-generated tool call id from the originating turn.' + type: + - 'string' + - 'null' error: description: 'Error message when the file operation failed.' type: 'string' @@ -19085,6 +19100,7 @@ components: openrouter:image_generation: '#/components/schemas/OutputImageGenerationServerToolItem' openrouter:mcp: '#/components/schemas/OutputMcpServerToolItem' openrouter:memory: '#/components/schemas/OutputMemoryServerToolItem' + openrouter:shell: '#/components/schemas/OutputShellServerToolItem' openrouter:subagent: '#/components/schemas/OutputSubagentServerToolItem' openrouter:text_editor: '#/components/schemas/OutputTextEditorServerToolItem' openrouter:tool_search: '#/components/schemas/OutputToolSearchServerToolItem' @@ -19124,6 +19140,7 @@ components: - $ref: '#/components/schemas/OutputApplyPatchCallItem' - $ref: '#/components/schemas/OutputShellCallItem' - $ref: '#/components/schemas/OutputShellCallOutputItem' + - $ref: '#/components/schemas/OutputShellServerToolItem' - $ref: '#/components/schemas/OutputWebFetchServerToolItem' - $ref: '#/components/schemas/OutputToolSearchServerToolItem' - $ref: '#/components/schemas/OutputMemoryServerToolItem' @@ -19438,6 +19455,11 @@ components: - 'max_output_length' - 'timeout_ms' type: 'object' + arguments: + description: 'The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes.' + type: + - 'string' + - 'null' call_id: type: 'string' id: @@ -19478,37 +19500,7 @@ components: - 'null' output: items: - properties: - outcome: - oneOf: - - properties: - exit_code: - type: 'integer' - type: - enum: - - 'exit' - type: 'string' - required: - - 'type' - - 'exit_code' - type: 'object' - - properties: - type: - enum: - - 'timeout' - type: 'string' - required: - - 'type' - type: 'object' - stderr: - type: 'string' - stdout: - type: 'string' - required: - - 'stdout' - - 'stderr' - - 'outcome' - type: 'object' + $ref: '#/components/schemas/ShellCallOutputContent' type: 'array' status: $ref: '#/components/schemas/ShellCallStatus' @@ -19523,6 +19515,68 @@ components: - 'status' - 'output' type: 'object' + OutputShellServerToolItem: + description: 'An openrouter:shell server tool output item' + example: + action: + commands: + - 'echo hello' + max_output_length: null + timeout_ms: null + call_id: 'call_abc123' + id: 'st_tmp_abc123' + output: + - outcome: + exit_code: 0 + type: 'exit' + stderr: '' + stdout: "hello\n" + status: 'completed' + type: 'openrouter:shell' + properties: + action: + properties: + commands: + items: + type: 'string' + type: 'array' + max_output_length: + type: + - 'integer' + - 'null' + timeout_ms: + type: + - 'integer' + - 'null' + required: + - 'commands' + type: 'object' + arguments: + description: 'The raw tool-call arguments string as emitted by the model.' + type: + - 'string' + - 'null' + call_id: + description: 'The model-generated tool call id from the originating turn.' + type: + - 'string' + - 'null' + id: + type: 'string' + output: + items: + $ref: '#/components/schemas/ShellCallOutputContent' + type: 'array' + status: + $ref: '#/components/schemas/ToolCallStatus' + type: + enum: + - 'openrouter:shell' + type: 'string' + required: + - 'status' + - 'type' + type: 'object' OutputSubagentServerToolItem: description: 'An openrouter:subagent server tool output item' example: @@ -22836,6 +22890,11 @@ components: required: - 'commands' type: 'object' + arguments: + description: 'The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes.' + type: + - 'string' + - 'null' call_id: type: 'string' environment: {} @@ -22856,13 +22915,58 @@ components: - 'call_id' - 'action' type: 'object' + ShellCallOutputContent: + additionalProperties: {} + description: 'Captured stdout and stderr for one command of a shell call, with its exit or timeout outcome.' + example: + outcome: + exit_code: 0 + type: 'exit' + stderr: '' + stdout: "total 0\n" + properties: + outcome: + oneOf: + - additionalProperties: {} + properties: + exit_code: + type: 'integer' + type: + enum: + - 'exit' + type: 'string' + required: + - 'type' + - 'exit_code' + type: 'object' + - additionalProperties: {} + properties: + type: + enum: + - 'timeout' + type: 'string' + required: + - 'type' + type: 'object' + stderr: + type: 'string' + stdout: + type: 'string' + required: + - 'stdout' + - 'stderr' + - 'outcome' + type: 'object' ShellCallOutputItem: description: 'Output from a shell command execution (newer variant)' example: call_id: 'call-abc123' output: - - content: "total 0\n" - type: 'stdout' + - outcome: + exit_code: 0 + type: 'exit' + stderr: '' + stdout: "total 0\n" status: 'completed' type: 'shell_call_output' properties: @@ -22878,21 +22982,7 @@ components: - 'null' output: items: - additionalProperties: {} - properties: - content: - type: - - 'string' - - 'null' - exit_code: - type: - - 'integer' - - 'null' - type: - type: 'string' - required: - - 'type' - type: 'object' + $ref: '#/components/schemas/ShellCallOutputContent' type: 'array' status: anyOf: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 434ea063..2ffbd782 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:6190547682cb41c5b422989543ad234040f0bd8b00eeea2e5bdfe42d222c40c7 - sourceBlobDigest: sha256:a86ecb1bc7b6d32b9bd5052f720c98b42e195fea445e0d02efc7ca3ee3ccde4a + sourceRevisionDigest: sha256:e5f94b78271b3e6e508bb4ab72d889ffe31bb7bacd05c975766869991c7f9b73 + sourceBlobDigest: sha256:2511f671bdd7c80fb2df94c623b8900b060d7ffc166f835b874239c1fbb15955 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:6190547682cb41c5b422989543ad234040f0bd8b00eeea2e5bdfe42d222c40c7 - sourceBlobDigest: sha256:a86ecb1bc7b6d32b9bd5052f720c98b42e195fea445e0d02efc7ca3ee3ccde4a + sourceRevisionDigest: sha256:e5f94b78271b3e6e508bb4ab72d889ffe31bb7bacd05c975766869991c7f9b73 + sourceBlobDigest: sha256:2511f671bdd7c80fb2df94c623b8900b060d7ffc166f835b874239c1fbb15955 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:192a885ca01b61cd92868dc63c2eae4362ea374515c4d219bddd8fff3e45b737 + codeSamplesRevisionDigest: sha256:3cb620a70f2f72fa7df7a51587d6e8adc6d4413b6b1429965d01bebfc9fa6721 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 2c01b37f..e5ef787b 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1369,4 +1369,14 @@ Based on: ### Generated - [python v1.1.58] . ### Releases -- [PyPI v1.1.58] https://pypi.org/project/openrouter/1.1.58 - . \ No newline at end of file +- [PyPI v1.1.58] https://pypi.org/project/openrouter/1.1.58 - . + +## 2026-08-17 20:09:02 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.1.59] . +### Releases +- [PyPI v1.1.59] https://pypi.org/project/openrouter/1.1.59 - . \ No newline at end of file diff --git a/docs/components/inputsunion1.mdx b/docs/components/inputsunion1.mdx index 2e564033..0ffd2524 100644 --- a/docs/components/inputsunion1.mdx +++ b/docs/components/inputsunion1.mdx @@ -208,6 +208,12 @@ value: components.OutputSubagentServerToolItem = /* values here */ value: components.OutputFilesServerToolItem = /* values here */ ``` +### `components.OutputShellServerToolItem` + +```python +value: components.OutputShellServerToolItem = /* values here */ +``` + ### `components.LocalShellCallItem` ```python diff --git a/docs/components/outcomeexit.mdx b/docs/components/outcomeexit.mdx index dd9bda68..56aaef49 100644 --- a/docs/components/outcomeexit.mdx +++ b/docs/components/outcomeexit.mdx @@ -7,4 +7,5 @@ title: "OutcomeExit" | Field | Type | Required | Description | | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | | `exit_code` | *int* | :heavy_check_mark: | N/A | -| `type` | [components.TypeExit](../components/typeexit.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file +| `type` | [components.TypeExit](../components/typeexit.mdx) | :heavy_check_mark: | N/A | +| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/outcometimeout.mdx b/docs/components/outcometimeout.mdx index 6fe515d1..2dc6cbbb 100644 --- a/docs/components/outcometimeout.mdx +++ b/docs/components/outcometimeout.mdx @@ -6,4 +6,5 @@ title: "OutcomeTimeout" | Field | Type | Required | Description | | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `type` | [components.TypeTimeout](../components/typetimeout.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file +| `type` | [components.TypeTimeout](../components/typetimeout.mdx) | :heavy_check_mark: | N/A | +| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/outputbashservertoolitem.mdx b/docs/components/outputbashservertoolitem.mdx index cf5ee887..bbd5a88a 100644 --- a/docs/components/outputbashservertoolitem.mdx +++ b/docs/components/outputbashservertoolitem.mdx @@ -9,8 +9,8 @@ An openrouter:bash server tool output item | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `arguments` | *Optional[str]* | :heavy_minus_sign: | The raw tool-call arguments string as emitted by the model. | | -| `call_id` | *Optional[str]* | :heavy_minus_sign: | The model-generated tool call id from the originating turn. | | +| `arguments` | *OptionalNullable[str]* | :heavy_minus_sign: | The raw tool-call arguments string as emitted by the model. | | +| `call_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The model-generated tool call id from the originating turn. | | | `command` | *Optional[str]* | :heavy_minus_sign: | N/A | | | `exit_code` | *Optional[int]* | :heavy_minus_sign: | N/A | | | `id` | *Optional[str]* | :heavy_minus_sign: | N/A | | diff --git a/docs/components/outputfilesservertoolitem.mdx b/docs/components/outputfilesservertoolitem.mdx index 111b79f0..f4514c8f 100644 --- a/docs/components/outputfilesservertoolitem.mdx +++ b/docs/components/outputfilesservertoolitem.mdx @@ -9,6 +9,8 @@ An openrouter:files server tool output item | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `arguments` | *OptionalNullable[str]* | :heavy_minus_sign: | The raw tool-call arguments string as emitted by the model. | | +| `call_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The model-generated tool call id from the originating turn. | | | `error` | *Optional[str]* | :heavy_minus_sign: | Error message when the file operation failed. | | | `file_id` | *Optional[str]* | :heavy_minus_sign: | The target file id supplied in the tool-call arguments. | | | `filename` | *Optional[str]* | :heavy_minus_sign: | The target filename supplied in the tool-call arguments. | | diff --git a/docs/components/outputitems.mdx b/docs/components/outputitems.mdx index f73cc667..a0d4eb80 100644 --- a/docs/components/outputitems.mdx +++ b/docs/components/outputitems.mdx @@ -133,6 +133,12 @@ value: components.OutputMcpServerToolItem = /* values here */ value: components.OutputMemoryServerToolItem = /* values here */ ``` +### `components.OutputShellServerToolItem` + +```python +value: components.OutputShellServerToolItem = /* values here */ +``` + ### `components.OutputSubagentServerToolItem` ```python diff --git a/docs/components/outputshellcallitem.mdx b/docs/components/outputshellcallitem.mdx index 994c3c01..6c6d7164 100644 --- a/docs/components/outputshellcallitem.mdx +++ b/docs/components/outputshellcallitem.mdx @@ -7,10 +7,11 @@ A native `shell_call` output item matching OpenAI's Responses API shape. Emitted ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `action` | [Optional[components.OutputShellCallItemAction]](../components/outputshellcallitemaction.mdx) | :heavy_minus_sign: | N/A | | -| `call_id` | *str* | :heavy_check_mark: | N/A | | -| `id` | *str* | :heavy_check_mark: | N/A | | -| `status` | [components.ShellCallStatus](../components/shellcallstatus.mdx) | :heavy_check_mark: | Status of a shell call or its output. | completed | -| `type` | [components.OutputShellCallItemType](../components/outputshellcallitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `action` | [Optional[components.OutputShellCallItemAction]](../components/outputshellcallitemaction.mdx) | :heavy_minus_sign: | N/A | | +| `arguments` | *OptionalNullable[str]* | :heavy_minus_sign: | The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes. | | +| `call_id` | *str* | :heavy_check_mark: | N/A | | +| `id` | *str* | :heavy_check_mark: | N/A | | +| `status` | [components.ShellCallStatus](../components/shellcallstatus.mdx) | :heavy_check_mark: | Status of a shell call or its output. | completed | +| `type` | [components.OutputShellCallItemType](../components/outputshellcallitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/outputshellcalloutputitem.mdx b/docs/components/outputshellcalloutputitem.mdx index b8fc79b3..cf531ef2 100644 --- a/docs/components/outputshellcalloutputitem.mdx +++ b/docs/components/outputshellcalloutputitem.mdx @@ -7,11 +7,11 @@ A native `shell_call_output` item matching OpenAI's Responses API shape. Carries ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | -| `call_id` | *str* | :heavy_check_mark: | N/A | | -| `id` | *str* | :heavy_check_mark: | N/A | | -| `max_output_length` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | -| `output` | List[[components.OutputShellCallOutputItemOutput](../components/outputshellcalloutputitemoutput.mdx)] | :heavy_check_mark: | N/A | | -| `status` | [components.ShellCallStatus](../components/shellcallstatus.mdx) | :heavy_check_mark: | Status of a shell call or its output. | completed | -| `type` | [components.OutputShellCallOutputItemTypeShellCallOutput](../components/outputshellcalloutputitemtypeshellcalloutput.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `call_id` | *str* | :heavy_check_mark: | N/A | | +| `id` | *str* | :heavy_check_mark: | N/A | | +| `max_output_length` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | +| `output` | List[[components.ShellCallOutputContent](../components/shellcalloutputcontent.mdx)] | :heavy_check_mark: | N/A | | +| `status` | [components.ShellCallStatus](../components/shellcallstatus.mdx) | :heavy_check_mark: | Status of a shell call or its output. | completed | +| `type` | [components.OutputShellCallOutputItemType](../components/outputshellcalloutputitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/outputshellcalloutputitemoutput.mdx b/docs/components/outputshellcalloutputitemoutput.mdx deleted file mode 100644 index ca3f63fd..00000000 --- a/docs/components/outputshellcalloutputitemoutput.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "OutputShellCallOutputItemOutput" ---- - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | -| `outcome` | [components.Outcome](../components/outcome.mdx) | :heavy_check_mark: | N/A | -| `stderr` | *str* | :heavy_check_mark: | N/A | -| `stdout` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/outputshellcalloutputitemtype.mdx b/docs/components/outputshellcalloutputitemtype.mdx new file mode 100644 index 00000000..a75efc13 --- /dev/null +++ b/docs/components/outputshellcalloutputitemtype.mdx @@ -0,0 +1,15 @@ +--- +title: "OutputShellCallOutputItemType" +--- + +## Example Usage + +```python +from openrouter.components import OutputShellCallOutputItemType +value: OutputShellCallOutputItemType = "shell_call_output" +``` + + +## Values + +- `"shell_call_output"` diff --git a/docs/components/outputshellcalloutputitemtypeshellcalloutput.mdx b/docs/components/outputshellcalloutputitemtypeshellcalloutput.mdx deleted file mode 100644 index 2bfc5b85..00000000 --- a/docs/components/outputshellcalloutputitemtypeshellcalloutput.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "OutputShellCallOutputItemTypeShellCallOutput" ---- - -## Example Usage - -```python -from openrouter.components import OutputShellCallOutputItemTypeShellCallOutput -value: OutputShellCallOutputItemTypeShellCallOutput = "shell_call_output" -``` - - -## Values - -- `"shell_call_output"` diff --git a/docs/components/outputshellservertoolitem.mdx b/docs/components/outputshellservertoolitem.mdx new file mode 100644 index 00000000..70d44692 --- /dev/null +++ b/docs/components/outputshellservertoolitem.mdx @@ -0,0 +1,18 @@ +--- +title: "OutputShellServerToolItem" +--- + +An openrouter:shell server tool output item + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `action` | [Optional[components.OutputShellServerToolItemAction]](../components/outputshellservertoolitemaction.mdx) | :heavy_minus_sign: | N/A | | +| `arguments` | *OptionalNullable[str]* | :heavy_minus_sign: | The raw tool-call arguments string as emitted by the model. | | +| `call_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The model-generated tool call id from the originating turn. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | | +| `output` | List[[components.ShellCallOutputContent](../components/shellcalloutputcontent.mdx)] | :heavy_minus_sign: | N/A | | +| `status` | [components.ToolCallStatus](../components/toolcallstatus.mdx) | :heavy_check_mark: | N/A | completed | +| `type` | [components.OutputShellServerToolItemType](../components/outputshellservertoolitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/shellcalloutputitemoutput.mdx b/docs/components/outputshellservertoolitemaction.mdx similarity index 51% rename from docs/components/shellcalloutputitemoutput.mdx rename to docs/components/outputshellservertoolitemaction.mdx index fdfd9aee..56f9a9ad 100644 --- a/docs/components/shellcalloutputitemoutput.mdx +++ b/docs/components/outputshellservertoolitemaction.mdx @@ -1,12 +1,11 @@ --- -title: "ShellCallOutputItemOutput" +title: "OutputShellServerToolItemAction" --- ## Fields | Field | Type | Required | Description | | ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `content` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `exit_code` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `type` | *str* | :heavy_check_mark: | N/A | -| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `commands` | List[*str*] | :heavy_check_mark: | N/A | +| `max_output_length` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | +| `timeout_ms` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/outputshellservertoolitemtype.mdx b/docs/components/outputshellservertoolitemtype.mdx new file mode 100644 index 00000000..216dd4e7 --- /dev/null +++ b/docs/components/outputshellservertoolitemtype.mdx @@ -0,0 +1,15 @@ +--- +title: "OutputShellServerToolItemType" +--- + +## Example Usage + +```python +from openrouter.components import OutputShellServerToolItemType +value: OutputShellServerToolItemType = "openrouter:shell" +``` + + +## Values + +- `"openrouter:shell"` diff --git a/docs/components/shellcallitem.mdx b/docs/components/shellcallitem.mdx index a43e4598..4e9f17f3 100644 --- a/docs/components/shellcallitem.mdx +++ b/docs/components/shellcallitem.mdx @@ -7,11 +7,12 @@ A shell command execution call (newer variant) ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `action` | [components.ShellCallItemAction](../components/shellcallitemaction.mdx) | :heavy_check_mark: | N/A | | -| `call_id` | *str* | :heavy_check_mark: | N/A | | -| `environment` | *Optional[Any]* | :heavy_minus_sign: | N/A | | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | -| `status` | [OptionalNullable[components.ToolCallStatus]](../components/toolcallstatus.mdx) | :heavy_minus_sign: | N/A | completed | -| `type` | [components.ShellCallItemType](../components/shellcallitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `action` | [components.ShellCallItemAction](../components/shellcallitemaction.mdx) | :heavy_check_mark: | N/A | | +| `arguments` | *OptionalNullable[str]* | :heavy_minus_sign: | The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes. | | +| `call_id` | *str* | :heavy_check_mark: | N/A | | +| `environment` | *Optional[Any]* | :heavy_minus_sign: | N/A | | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `status` | [OptionalNullable[components.ToolCallStatus]](../components/toolcallstatus.mdx) | :heavy_minus_sign: | N/A | completed | +| `type` | [components.ShellCallItemType](../components/shellcallitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/shellcalloutputcontent.mdx b/docs/components/shellcalloutputcontent.mdx new file mode 100644 index 00000000..9aaa17fd --- /dev/null +++ b/docs/components/shellcalloutputcontent.mdx @@ -0,0 +1,15 @@ +--- +title: "ShellCallOutputContent" +--- + +Captured stdout and stderr for one command of a shell call, with its exit or timeout outcome. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `outcome` | [components.Outcome](../components/outcome.mdx) | :heavy_check_mark: | N/A | | +| `stderr` | *str* | :heavy_check_mark: | N/A | | +| `stdout` | *str* | :heavy_check_mark: | N/A | | +| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \{
"outcome": \{
"exit_code": 0,
"type": "exit"
},
"stderr": "",
"stdout": "total 0\n"
} | \ No newline at end of file diff --git a/docs/components/shellcalloutputitem.mdx b/docs/components/shellcalloutputitem.mdx index 7cf2cb9d..7dcab460 100644 --- a/docs/components/shellcalloutputitem.mdx +++ b/docs/components/shellcalloutputitem.mdx @@ -7,11 +7,11 @@ Output from a shell command execution (newer variant) ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `call_id` | *str* | :heavy_check_mark: | N/A | | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | -| `max_output_length` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | -| `output` | List[[components.ShellCallOutputItemOutput](../components/shellcalloutputitemoutput.mdx)] | :heavy_check_mark: | N/A | | -| `status` | [OptionalNullable[components.ToolCallStatus]](../components/toolcallstatus.mdx) | :heavy_minus_sign: | N/A | completed | -| `type` | [components.ShellCallOutputItemType](../components/shellcalloutputitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `call_id` | *str* | :heavy_check_mark: | N/A | | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `max_output_length` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | +| `output` | List[[components.ShellCallOutputContent](../components/shellcalloutputcontent.mdx)] | :heavy_check_mark: | N/A | | +| `status` | [OptionalNullable[components.ToolCallStatus]](../components/toolcallstatus.mdx) | :heavy_minus_sign: | N/A | completed | +| `type` | [components.ShellCallOutputItemType](../components/shellcalloutputitemtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 6d5eb569..a40a9272 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.1.58" +version = "1.1.59" 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 de143607..a6696aa9 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.1.58" +__version__: str = "1.1.59" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.1.58 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.1.59 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 5521c2bb..84f9a956 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2297,20 +2297,16 @@ OutputShellCallItemTypedDict, ) from .outputshellcalloutputitem import ( - Outcome, - OutcomeExit, - OutcomeExitTypedDict, - OutcomeTimeout, - OutcomeTimeoutTypedDict, - OutcomeTypedDict, OutputShellCallOutputItem, - OutputShellCallOutputItemOutput, - OutputShellCallOutputItemOutputTypedDict, - OutputShellCallOutputItemTypeShellCallOutput, + OutputShellCallOutputItemType, OutputShellCallOutputItemTypedDict, - TypeExit, - TypeTimeout, - UnknownOutcome, + ) + from .outputshellservertoolitem import ( + OutputShellServerToolItem, + OutputShellServerToolItemAction, + OutputShellServerToolItemActionTypedDict, + OutputShellServerToolItemType, + OutputShellServerToolItemTypedDict, ) from .outputsubagentservertoolitem import ( OutputSubagentServerToolItem, @@ -2681,10 +2677,21 @@ ShellCallItemType, ShellCallItemTypedDict, ) + from .shellcalloutputcontent import ( + Outcome, + OutcomeExit, + OutcomeExitTypedDict, + OutcomeTimeout, + OutcomeTimeoutTypedDict, + OutcomeTypedDict, + ShellCallOutputContent, + ShellCallOutputContentTypedDict, + TypeExit, + TypeTimeout, + UnknownOutcome, + ) from .shellcalloutputitem import ( ShellCallOutputItem, - ShellCallOutputItemOutput, - ShellCallOutputItemOutputTypedDict, ShellCallOutputItemType, ShellCallOutputItemTypedDict, ) @@ -4681,10 +4688,13 @@ "OutputShellCallItemType", "OutputShellCallItemTypedDict", "OutputShellCallOutputItem", - "OutputShellCallOutputItemOutput", - "OutputShellCallOutputItemOutputTypedDict", - "OutputShellCallOutputItemTypeShellCallOutput", + "OutputShellCallOutputItemType", "OutputShellCallOutputItemTypedDict", + "OutputShellServerToolItem", + "OutputShellServerToolItemAction", + "OutputShellServerToolItemActionTypedDict", + "OutputShellServerToolItemType", + "OutputShellServerToolItemTypedDict", "OutputSubagentServerToolItem", "OutputSubagentServerToolItemType", "OutputSubagentServerToolItemTypedDict", @@ -4984,9 +4994,9 @@ "ShellCallItemActionTypedDict", "ShellCallItemType", "ShellCallItemTypedDict", + "ShellCallOutputContent", + "ShellCallOutputContentTypedDict", "ShellCallOutputItem", - "ShellCallOutputItemOutput", - "ShellCallOutputItemOutputTypedDict", "ShellCallOutputItemType", "ShellCallOutputItemTypedDict", "ShellCallStatus", @@ -7067,20 +7077,14 @@ "OutputShellCallItemActionTypedDict": ".outputshellcallitem", "OutputShellCallItemType": ".outputshellcallitem", "OutputShellCallItemTypedDict": ".outputshellcallitem", - "Outcome": ".outputshellcalloutputitem", - "OutcomeExit": ".outputshellcalloutputitem", - "OutcomeExitTypedDict": ".outputshellcalloutputitem", - "OutcomeTimeout": ".outputshellcalloutputitem", - "OutcomeTimeoutTypedDict": ".outputshellcalloutputitem", - "OutcomeTypedDict": ".outputshellcalloutputitem", "OutputShellCallOutputItem": ".outputshellcalloutputitem", - "OutputShellCallOutputItemOutput": ".outputshellcalloutputitem", - "OutputShellCallOutputItemOutputTypedDict": ".outputshellcalloutputitem", - "OutputShellCallOutputItemTypeShellCallOutput": ".outputshellcalloutputitem", + "OutputShellCallOutputItemType": ".outputshellcalloutputitem", "OutputShellCallOutputItemTypedDict": ".outputshellcalloutputitem", - "TypeExit": ".outputshellcalloutputitem", - "TypeTimeout": ".outputshellcalloutputitem", - "UnknownOutcome": ".outputshellcalloutputitem", + "OutputShellServerToolItem": ".outputshellservertoolitem", + "OutputShellServerToolItemAction": ".outputshellservertoolitem", + "OutputShellServerToolItemActionTypedDict": ".outputshellservertoolitem", + "OutputShellServerToolItemType": ".outputshellservertoolitem", + "OutputShellServerToolItemTypedDict": ".outputshellservertoolitem", "OutputSubagentServerToolItem": ".outputsubagentservertoolitem", "OutputSubagentServerToolItemType": ".outputsubagentservertoolitem", "OutputSubagentServerToolItemTypedDict": ".outputsubagentservertoolitem", @@ -7349,9 +7353,18 @@ "ShellCallItemActionTypedDict": ".shellcallitem", "ShellCallItemType": ".shellcallitem", "ShellCallItemTypedDict": ".shellcallitem", + "Outcome": ".shellcalloutputcontent", + "OutcomeExit": ".shellcalloutputcontent", + "OutcomeExitTypedDict": ".shellcalloutputcontent", + "OutcomeTimeout": ".shellcalloutputcontent", + "OutcomeTimeoutTypedDict": ".shellcalloutputcontent", + "OutcomeTypedDict": ".shellcalloutputcontent", + "ShellCallOutputContent": ".shellcalloutputcontent", + "ShellCallOutputContentTypedDict": ".shellcalloutputcontent", + "TypeExit": ".shellcalloutputcontent", + "TypeTimeout": ".shellcalloutputcontent", + "UnknownOutcome": ".shellcalloutputcontent", "ShellCallOutputItem": ".shellcalloutputitem", - "ShellCallOutputItemOutput": ".shellcalloutputitem", - "ShellCallOutputItemOutputTypedDict": ".shellcalloutputitem", "ShellCallOutputItemType": ".shellcalloutputitem", "ShellCallOutputItemTypedDict": ".shellcalloutputitem", "ShellCallStatus": ".shellcallstatus", diff --git a/src/openrouter/components/inputs_union.py b/src/openrouter/components/inputs_union.py index 557636cb..e4eaeb22 100644 --- a/src/openrouter/components/inputs_union.py +++ b/src/openrouter/components/inputs_union.py @@ -115,6 +115,10 @@ OutputSearchModelsServerToolItem, OutputSearchModelsServerToolItemTypedDict, ) +from .outputshellservertoolitem import ( + OutputShellServerToolItem, + OutputShellServerToolItemTypedDict, +) from .outputsubagentservertoolitem import ( OutputSubagentServerToolItem, OutputSubagentServerToolItemTypedDict, @@ -408,13 +412,13 @@ def serialize_model(self, handler): InputsMessageTypedDict, ShellCallOutputItemTypedDict, OutputComputerCallItemTypedDict, - ShellCallItemTypedDict, McpCallItemTypedDict, AgentMessageItemTypedDict, + OutputShellServerToolItemTypedDict, OutputCodeInterpreterCallItemTypedDict, + ShellCallItemTypedDict, OutputAdvisorServerToolItemTypedDict, InputsReasoningTypedDict, - OutputFilesServerToolItemTypedDict, OutputWebFetchServerToolItemTypedDict, ReasoningItemTypedDict, OutputImageGenerationServerToolItemTypedDict, @@ -423,6 +427,7 @@ def serialize_model(self, handler): OutputFunctionCallItemTypedDict, OutputBashServerToolItemTypedDict, FunctionCallItemTypedDict, + OutputFilesServerToolItemTypedDict, OutputSubagentServerToolItemTypedDict, ], ) @@ -464,13 +469,13 @@ def serialize_model(self, handler): InputsMessage, ShellCallOutputItem, OutputComputerCallItem, - ShellCallItem, McpCallItem, AgentMessageItem, + OutputShellServerToolItem, OutputCodeInterpreterCallItem, + ShellCallItem, OutputAdvisorServerToolItem, InputsReasoning, - OutputFilesServerToolItem, OutputWebFetchServerToolItem, ReasoningItem, OutputImageGenerationServerToolItem, @@ -479,6 +484,7 @@ def serialize_model(self, handler): OutputFunctionCallItem, OutputBashServerToolItem, FunctionCallItem, + OutputFilesServerToolItem, OutputSubagentServerToolItem, ], ) diff --git a/src/openrouter/components/outputbashservertoolitem.py b/src/openrouter/components/outputbashservertoolitem.py index 6a1f46ff..58a109b4 100644 --- a/src/openrouter/components/outputbashservertoolitem.py +++ b/src/openrouter/components/outputbashservertoolitem.py @@ -2,7 +2,13 @@ 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 @@ -17,9 +23,9 @@ class OutputBashServerToolItemTypedDict(TypedDict): status: ToolCallStatus type: OutputBashServerToolItemType - arguments: NotRequired[str] + arguments: NotRequired[Nullable[str]] r"""The raw tool-call arguments string as emitted by the model.""" - call_id: NotRequired[str] + call_id: NotRequired[Nullable[str]] r"""The model-generated tool call id from the originating turn.""" command: NotRequired[str] exit_code: NotRequired[int] @@ -35,10 +41,10 @@ class OutputBashServerToolItem(BaseModel): type: OutputBashServerToolItemType - arguments: Optional[str] = None + arguments: OptionalNullable[str] = UNSET r"""The raw tool-call arguments string as emitted by the model.""" - call_id: Optional[str] = None + call_id: OptionalNullable[str] = UNSET r"""The model-generated tool call id from the originating turn.""" command: Optional[str] = None @@ -56,15 +62,24 @@ def serialize_model(self, handler): optional_fields = set( ["arguments", "call_id", "command", "exitCode", "id", "stderr", "stdout"] ) + nullable_fields = set(["arguments", "call_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: + 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/outputfilesservertoolitem.py b/src/openrouter/components/outputfilesservertoolitem.py index 5f30e958..371f5baa 100644 --- a/src/openrouter/components/outputfilesservertoolitem.py +++ b/src/openrouter/components/outputfilesservertoolitem.py @@ -2,7 +2,13 @@ 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, +) from pydantic import model_serializer from typing import Literal, Optional from typing_extensions import NotRequired, TypedDict @@ -16,6 +22,10 @@ class OutputFilesServerToolItemTypedDict(TypedDict): status: ToolCallStatus type: OutputFilesServerToolItemType + arguments: NotRequired[Nullable[str]] + r"""The raw tool-call arguments string as emitted by the model.""" + call_id: NotRequired[Nullable[str]] + r"""The model-generated tool call id from the originating turn.""" error: NotRequired[str] r"""Error message when the file operation failed.""" file_id: NotRequired[str] @@ -36,6 +46,12 @@ class OutputFilesServerToolItem(BaseModel): type: OutputFilesServerToolItemType + arguments: OptionalNullable[str] = UNSET + r"""The raw tool-call arguments string as emitted by the model.""" + + call_id: OptionalNullable[str] = UNSET + r"""The model-generated tool call id from the originating turn.""" + error: Optional[str] = None r"""Error message when the file operation failed.""" @@ -56,17 +72,35 @@ class OutputFilesServerToolItem(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["error", "file_id", "filename", "id", "operation", "result"] + [ + "arguments", + "call_id", + "error", + "file_id", + "filename", + "id", + "operation", + "result", + ] ) + nullable_fields = set(["arguments", "call_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: + 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/outputitems.py b/src/openrouter/components/outputitems.py index 3866bb7e..fe6ee4f1 100644 --- a/src/openrouter/components/outputitems.py +++ b/src/openrouter/components/outputitems.py @@ -85,6 +85,10 @@ OutputShellCallOutputItem, OutputShellCallOutputItemTypedDict, ) +from .outputshellservertoolitem import ( + OutputShellServerToolItem, + OutputShellServerToolItemTypedDict, +) from .outputsubagentservertoolitem import ( OutputSubagentServerToolItem, OutputSubagentServerToolItemTypedDict, @@ -121,35 +125,36 @@ OutputItemsTypedDict = TypeAliasType( "OutputItemsTypedDict", Union[ - OutputWebSearchServerToolItemTypedDict, OutputFileSearchCallItemTypedDict, - OutputFileSearchServerToolItemTypedDict, OutputToolSearchServerToolItemTypedDict, + OutputFileSearchServerToolItemTypedDict, + OutputWebSearchServerToolItemTypedDict, + OutputMcpServerToolItemTypedDict, + OutputBrowserUseServerToolItemTypedDict, + OutputApplyPatchCallItemTypedDict, OutputApplyPatchServerToolItemTypedDict, - OutputImageGenerationCallItemTypedDict, OutputDatetimeItemTypedDict, OutputWebSearchCallItemTypedDict, - OutputSearchModelsServerToolItemTypedDict, OutputTextEditorServerToolItemTypedDict, - OutputApplyPatchCallItemTypedDict, - OutputMcpServerToolItemTypedDict, - OutputShellCallItemTypedDict, - OutputBrowserUseServerToolItemTypedDict, - OutputComputerCallItemTypedDict, - OutputShellCallOutputItemTypedDict, - OutputCustomToolCallItemTypedDict, + OutputSearchModelsServerToolItemTypedDict, + OutputImageGenerationCallItemTypedDict, OutputMemoryServerToolItemTypedDict, + OutputCustomToolCallItemTypedDict, OutputMessageItemTypedDict, + OutputComputerCallItemTypedDict, + OutputShellCallItemTypedDict, + OutputShellCallOutputItemTypedDict, OutputCodeInterpreterCallItemTypedDict, + OutputShellServerToolItemTypedDict, OutputWebFetchServerToolItemTypedDict, + OutputImageGenerationServerToolItemTypedDict, OutputCodeInterpreterServerToolItemTypedDict, - OutputReasoningItemTypedDict, OutputAdvisorServerToolItemTypedDict, - OutputFilesServerToolItemTypedDict, - OutputImageGenerationServerToolItemTypedDict, + OutputReasoningItemTypedDict, OutputBashServerToolItemTypedDict, OutputFunctionCallItemTypedDict, OutputFusionServerToolItemTypedDict, + OutputFilesServerToolItemTypedDict, OutputSubagentServerToolItemTypedDict, ], ) @@ -188,6 +193,7 @@ class UnknownOutputItems(BaseModel): "openrouter:image_generation": OutputImageGenerationServerToolItem, "openrouter:mcp": OutputMcpServerToolItem, "openrouter:memory": OutputMemoryServerToolItem, + "openrouter:shell": OutputShellServerToolItem, "openrouter:subagent": OutputSubagentServerToolItem, "openrouter:text_editor": OutputTextEditorServerToolItem, "openrouter:tool_search": OutputToolSearchServerToolItem, @@ -223,6 +229,7 @@ class UnknownOutputItems(BaseModel): OutputImageGenerationServerToolItem, OutputMcpServerToolItem, OutputMemoryServerToolItem, + OutputShellServerToolItem, OutputSubagentServerToolItem, OutputTextEditorServerToolItem, OutputToolSearchServerToolItem, diff --git a/src/openrouter/components/outputshellcallitem.py b/src/openrouter/components/outputshellcallitem.py index b5840770..23aa9caf 100644 --- a/src/openrouter/components/outputshellcallitem.py +++ b/src/openrouter/components/outputshellcallitem.py @@ -2,7 +2,13 @@ from __future__ import annotations from .shellcallstatus import ShellCallStatus -from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) from pydantic import model_serializer from typing import List, Literal, Optional from typing_extensions import NotRequired, TypedDict @@ -48,6 +54,8 @@ class OutputShellCallItemTypedDict(TypedDict): r"""Status of a shell call or its output.""" type: OutputShellCallItemType action: NotRequired[OutputShellCallItemActionTypedDict] + arguments: NotRequired[Nullable[str]] + r"""The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes.""" class OutputShellCallItem(BaseModel): @@ -64,18 +72,30 @@ class OutputShellCallItem(BaseModel): action: Optional[OutputShellCallItemAction] = None + arguments: OptionalNullable[str] = UNSET + r"""The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["action"]) + optional_fields = set(["action", "arguments"]) + nullable_fields = set(["arguments"]) 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/outputshellcalloutputitem.py b/src/openrouter/components/outputshellcalloutputitem.py index 18a1f6df..40507fc7 100644 --- a/src/openrouter/components/outputshellcalloutputitem.py +++ b/src/openrouter/components/outputshellcalloutputitem.py @@ -1,8 +1,11 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .shellcalloutputcontent import ( + ShellCallOutputContent, + ShellCallOutputContentTypedDict, +) from .shellcallstatus import ShellCallStatus -from functools import partial from openrouter.types import ( BaseModel, Nullable, @@ -10,88 +13,12 @@ UNSET, UNSET_SENTINEL, ) -from openrouter.utils.unions import parse_open_union -from pydantic import ConfigDict, model_serializer -from pydantic.functional_validators import BeforeValidator -from typing import Any, List, Literal, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -TypeTimeout = Literal["timeout",] - - -class OutcomeTimeoutTypedDict(TypedDict): - type: TypeTimeout - - -class OutcomeTimeout(BaseModel): - type: TypeTimeout - - -TypeExit = Literal["exit",] - - -class OutcomeExitTypedDict(TypedDict): - exit_code: int - type: TypeExit - - -class OutcomeExit(BaseModel): - exit_code: int - - type: TypeExit - - -OutcomeTypedDict = TypeAliasType( - "OutcomeTypedDict", Union[OutcomeTimeoutTypedDict, OutcomeExitTypedDict] -) - - -class UnknownOutcome(BaseModel): - r"""A Outcome variant the SDK doesn't recognize. Preserves the raw payload.""" - - type: Literal["UNKNOWN"] = "UNKNOWN" - raw: Any - is_unknown: Literal[True] = True - - model_config = ConfigDict(frozen=True) - - -_OUTCOME_VARIANTS: dict[str, Any] = { - "exit": OutcomeExit, - "timeout": OutcomeTimeout, -} - - -Outcome = Annotated[ - Union[OutcomeExit, OutcomeTimeout, UnknownOutcome], - BeforeValidator( - partial( - parse_open_union, - disc_key="type", - variants=_OUTCOME_VARIANTS, - unknown_cls=UnknownOutcome, - union_name="Outcome", - ) - ), -] - - -class OutputShellCallOutputItemOutputTypedDict(TypedDict): - outcome: OutcomeTypedDict - stderr: str - stdout: str - - -class OutputShellCallOutputItemOutput(BaseModel): - outcome: Outcome - - stderr: str - - stdout: str +from pydantic import model_serializer +from typing import List, Literal +from typing_extensions import NotRequired, TypedDict -OutputShellCallOutputItemTypeShellCallOutput = Literal["shell_call_output",] +OutputShellCallOutputItemType = Literal["shell_call_output",] class OutputShellCallOutputItemTypedDict(TypedDict): @@ -99,10 +26,10 @@ class OutputShellCallOutputItemTypedDict(TypedDict): call_id: str id: str - output: List[OutputShellCallOutputItemOutputTypedDict] + output: List[ShellCallOutputContentTypedDict] status: ShellCallStatus r"""Status of a shell call or its output.""" - type: OutputShellCallOutputItemTypeShellCallOutput + type: OutputShellCallOutputItemType max_output_length: NotRequired[Nullable[int]] @@ -113,12 +40,12 @@ class OutputShellCallOutputItem(BaseModel): id: str - output: List[OutputShellCallOutputItemOutput] + output: List[ShellCallOutputContent] status: ShellCallStatus r"""Status of a shell call or its output.""" - type: OutputShellCallOutputItemTypeShellCallOutput + type: OutputShellCallOutputItemType max_output_length: OptionalNullable[int] = UNSET diff --git a/src/openrouter/components/outputshellservertoolitem.py b/src/openrouter/components/outputshellservertoolitem.py new file mode 100644 index 00000000..16e5a50c --- /dev/null +++ b/src/openrouter/components/outputshellservertoolitem.py @@ -0,0 +1,119 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .shellcalloutputcontent import ( + ShellCallOutputContent, + ShellCallOutputContentTypedDict, +) +from .toolcallstatus import ToolCallStatus +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +class OutputShellServerToolItemActionTypedDict(TypedDict): + commands: List[str] + max_output_length: NotRequired[Nullable[int]] + timeout_ms: NotRequired[Nullable[int]] + + +class OutputShellServerToolItemAction(BaseModel): + commands: List[str] + + max_output_length: OptionalNullable[int] = UNSET + + timeout_ms: OptionalNullable[int] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["max_output_length", "timeout_ms"]) + nullable_fields = set(["max_output_length", "timeout_ms"]) + 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 + + +OutputShellServerToolItemType = Literal["openrouter:shell",] + + +class OutputShellServerToolItemTypedDict(TypedDict): + r"""An openrouter:shell server tool output item""" + + status: ToolCallStatus + type: OutputShellServerToolItemType + action: NotRequired[OutputShellServerToolItemActionTypedDict] + arguments: NotRequired[Nullable[str]] + r"""The raw tool-call arguments string as emitted by the model.""" + call_id: NotRequired[Nullable[str]] + r"""The model-generated tool call id from the originating turn.""" + id: NotRequired[str] + output: NotRequired[List[ShellCallOutputContentTypedDict]] + + +class OutputShellServerToolItem(BaseModel): + r"""An openrouter:shell server tool output item""" + + status: ToolCallStatus + + type: OutputShellServerToolItemType + + action: Optional[OutputShellServerToolItemAction] = None + + arguments: OptionalNullable[str] = UNSET + r"""The raw tool-call arguments string as emitted by the model.""" + + call_id: OptionalNullable[str] = UNSET + r"""The model-generated tool call id from the originating turn.""" + + id: Optional[str] = None + + output: Optional[List[ShellCallOutputContent]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["action", "arguments", "call_id", "id", "output"]) + nullable_fields = set(["arguments", "call_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/shellcallitem.py b/src/openrouter/components/shellcallitem.py index 3eeb48a1..91d01b1c 100644 --- a/src/openrouter/components/shellcallitem.py +++ b/src/openrouter/components/shellcallitem.py @@ -62,6 +62,8 @@ class ShellCallItemTypedDict(TypedDict): action: ShellCallItemActionTypedDict call_id: str type: ShellCallItemType + arguments: NotRequired[Nullable[str]] + r"""The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes.""" environment: NotRequired[Any] id: NotRequired[Nullable[str]] status: NotRequired[Nullable[ToolCallStatus]] @@ -76,6 +78,9 @@ class ShellCallItem(BaseModel): type: ShellCallItemType + arguments: OptionalNullable[str] = UNSET + r"""The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes.""" + environment: Optional[Any] = None id: OptionalNullable[str] = UNSET @@ -84,8 +89,8 @@ class ShellCallItem(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["environment", "id", "status"]) - nullable_fields = set(["id", "status"]) + optional_fields = set(["arguments", "environment", "id", "status"]) + nullable_fields = set(["arguments", "id", "status"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/shellcalloutputcontent.py b/src/openrouter/components/shellcalloutputcontent.py new file mode 100644 index 00000000..14d6df7a --- /dev/null +++ b/src/openrouter/components/shellcalloutputcontent.py @@ -0,0 +1,128 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from functools import partial +from openrouter.types import BaseModel +from openrouter.utils.unions import parse_open_union +import pydantic +from pydantic import ConfigDict +from pydantic.functional_validators import BeforeValidator +from typing import Any, Dict, Literal, Union +from typing_extensions import Annotated, TypeAliasType, TypedDict + + +TypeTimeout = Literal["timeout",] + + +class OutcomeTimeoutTypedDict(TypedDict): + type: TypeTimeout + + +class OutcomeTimeout(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + type: TypeTimeout + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + +TypeExit = Literal["exit",] + + +class OutcomeExitTypedDict(TypedDict): + exit_code: int + type: TypeExit + + +class OutcomeExit(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + exit_code: int + + type: TypeExit + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + +OutcomeTypedDict = TypeAliasType( + "OutcomeTypedDict", Union[OutcomeTimeoutTypedDict, OutcomeExitTypedDict] +) + + +class UnknownOutcome(BaseModel): + r"""A Outcome variant the SDK doesn't recognize. Preserves the raw payload.""" + + type: Literal["UNKNOWN"] = "UNKNOWN" + raw: Any + is_unknown: Literal[True] = True + + model_config = ConfigDict(frozen=True) + + +_OUTCOME_VARIANTS: dict[str, Any] = { + "exit": OutcomeExit, + "timeout": OutcomeTimeout, +} + + +Outcome = Annotated[ + Union[OutcomeExit, OutcomeTimeout, UnknownOutcome], + BeforeValidator( + partial( + parse_open_union, + disc_key="type", + variants=_OUTCOME_VARIANTS, + unknown_cls=UnknownOutcome, + union_name="Outcome", + ) + ), +] + + +class ShellCallOutputContentTypedDict(TypedDict): + r"""Captured stdout and stderr for one command of a shell call, with its exit or timeout outcome.""" + + outcome: OutcomeTypedDict + stderr: str + stdout: str + + +class ShellCallOutputContent(BaseModel): + r"""Captured stdout and stderr for one command of a shell call, with its exit or timeout outcome.""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + outcome: Outcome + + stderr: str + + stdout: 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] diff --git a/src/openrouter/components/shellcalloutputitem.py b/src/openrouter/components/shellcalloutputitem.py index 3996cdd3..91d5927a 100644 --- a/src/openrouter/components/shellcalloutputitem.py +++ b/src/openrouter/components/shellcalloutputitem.py @@ -1,6 +1,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .shellcalloutputcontent import ( + ShellCallOutputContent, + ShellCallOutputContentTypedDict, +) from .toolcallstatus import ToolCallStatus from openrouter.types import ( BaseModel, @@ -9,67 +13,11 @@ UNSET, UNSET_SENTINEL, ) -import pydantic -from pydantic import ConfigDict, model_serializer -from typing import Any, Dict, List, Literal +from pydantic import model_serializer +from typing import List, Literal from typing_extensions import NotRequired, TypedDict -class ShellCallOutputItemOutputTypedDict(TypedDict): - type: str - content: NotRequired[Nullable[str]] - exit_code: NotRequired[Nullable[int]] - - -class ShellCallOutputItemOutput(BaseModel): - model_config = ConfigDict( - populate_by_name=True, arbitrary_types_allowed=True, extra="allow" - ) - __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) - - type: str - - content: OptionalNullable[str] = UNSET - - exit_code: OptionalNullable[int] = UNSET - - @property - def additional_properties(self): - return self.__pydantic_extra__ - - @additional_properties.setter - def additional_properties(self, value): - self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["content", "exit_code"]) - nullable_fields = set(["content", "exit_code"]) - 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)) - serialized.pop(k, serialized.pop(n, None)) - 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 - for k, v in serialized.items(): - m[k] = v - - return m - - ShellCallOutputItemType = Literal["shell_call_output",] @@ -77,7 +25,7 @@ class ShellCallOutputItemTypedDict(TypedDict): r"""Output from a shell command execution (newer variant)""" call_id: str - output: List[ShellCallOutputItemOutputTypedDict] + output: List[ShellCallOutputContentTypedDict] type: ShellCallOutputItemType id: NotRequired[Nullable[str]] max_output_length: NotRequired[Nullable[int]] @@ -89,7 +37,7 @@ class ShellCallOutputItem(BaseModel): call_id: str - output: List[ShellCallOutputItemOutput] + output: List[ShellCallOutputContent] type: ShellCallOutputItemType diff --git a/uv.lock b/uv.lock index cb33d088..f4bc1154 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.1.58" +version = "1.1.59" source = { editable = "." } dependencies = [ { name = "httpcore" },