diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 943cbc20..5f9243c3 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: 2d045ec7-2ebb-4f4d-ad25-40953b132161 management: - docChecksum: b5e9004e334f10e92bcdd2dda5add214 + docChecksum: 55730589b8aa15c220d6d72eff876af4 docVersion: 1.0.0 speakeasyVersion: 1.754.0 generationVersion: 2.862.0 - releaseVersion: 2.1.2 - configChecksum: eae98dd1cf81d8778436fcccb0cf416a + releaseVersion: 2.1.3 + configChecksum: f9314a8eb94dfdb80621f196b6abfd9c repoURL: https://github.com/mistralai/client-python.git installationURL: https://github.com/mistralai/client-python.git published: true persistentEdits: - generation_id: 5d5e9fc0-fa6b-4de0-a07a-341d5253e0bf - pristine_commit_hash: 71e334fc50f03122723915e87292d042754cf256 - pristine_tree_hash: 707ae8319edbeab9bafba92a056d810909f31a61 + generation_id: 8fcdbb7f-ada3-4a90-970d-e275c2dd2090 + pristine_commit_hash: c03ad2205c9bdefd33787d6b6d3ffc96b56c6f87 + pristine_tree_hash: 015ef7e1d24817483937f656f5f7a5d15ada1e8f features: python: acceptHeaders: 3.0.0 @@ -579,6 +579,10 @@ trackedFiles: id: 844c1f489684 last_write_checksum: sha1:e36ac8ff28ee258340868f8aa4f3172ed3b82ef3 pristine_git_object: c45148b97aad128744e0e6ccebb00bf22d400eff + docs/models/connectorlisttoolsv1request.md: + id: 43698382d3c4 + last_write_checksum: sha1:3c6e01a8fa0283300f3801bf7022599d75d12162 + pristine_git_object: e080455b986aa3aded7613a5654636c1188085d1 docs/models/connectorlistv1request.md: id: 68b7a11faff6 last_write_checksum: sha1:e08effc0f17a95383c3ba96b06b1dba80f4dc767 @@ -1539,6 +1543,18 @@ trackedFiles: id: 0b20f03adab8 last_write_checksum: sha1:d66113a4b0486f144b1f73f423559360ec751631 pristine_git_object: b0ae7da069119f7477ffa5ad756f353f56f213f1 + docs/models/mcptool.md: + id: f809e227a108 + last_write_checksum: sha1:90833e29c750ca8452cec010f91e451ead93049c + pristine_git_object: 006802b47caa662f9087357bf7fea45141b76788 + docs/models/mcptoolmeta.md: + id: 271159bcac6f + last_write_checksum: sha1:f88fc0a6c65c02b9fd6945a9db0b5704eed79c9e + pristine_git_object: 23e8b64c9584f1ef5f2ad56b70d5b57732159608 + docs/models/mcpuitoolmeta.md: + id: 95390caf0719 + last_write_checksum: sha1:e40fd3d493e32bb28fdb0ffc8fa7acb79acc1d30 + pristine_git_object: c09b29ad40fd96b944f7f9bf320b3a67bd587d5b docs/models/messageentries.md: id: 9af3a27b862b last_write_checksum: sha1:a3eb6e37b780644313738f84e6c5ac653b4686bc @@ -1867,6 +1883,14 @@ trackedFiles: id: 583c991c7a30 last_write_checksum: sha1:0791cb4aa4045708ab64d42bf67bd6ab74bc7752 pristine_git_object: ff67925758959b87992b47a1a32c224eeeb599e3 + docs/models/responseconnectorlisttoolsv11.md: + id: 6a5e4a2ba10b + last_write_checksum: sha1:9f2f54bdfb137736b24bafbc0d32c9826ffabfee + pristine_git_object: 9b5c98c6c4b3ba1292e18edccaafd9d78f934e76 + docs/models/responseconnectorlisttoolsv12.md: + id: c422816d84f9 + last_write_checksum: sha1:7db23fc2c5ade5ea4b04c70ebc629596545ccdb0 + pristine_git_object: 0266f66da4668a6fe33ed2b9a88278c57056576b docs/models/responsedoneevent.md: id: 38c38c3c065b last_write_checksum: sha1:4ac3a0fd91d5ebaccce7f4098ae416b56e08416f @@ -2011,6 +2035,10 @@ trackedFiles: id: d8cd08c55c3c last_write_checksum: sha1:3ef23d504527602f2d0789d2cfb1a6629115f41a pristine_git_object: 8321a3090910115b586be900bcf23da5baf4c245 + docs/models/tasksupport.md: + id: 58be1f1aef25 + last_write_checksum: sha1:2005c0e15f36bd315c17688daa4dd9a8c260b009 + pristine_git_object: 2d16da9de0af99ca5cecd7aab3349e13d22c7013 docs/models/textchunk.md: id: 6cd12e0ef110 last_write_checksum: sha1:d9fe94c670c5e0578212752c11a0c405a9da8518 @@ -2039,6 +2067,10 @@ trackedFiles: id: 8966139dbeed last_write_checksum: sha1:1725bf53fc9f1ca3f332322d91de24c9d58adc6a pristine_git_object: fb661f72887271d5bb470e4edf025a32b00ade17 + docs/models/toolannotations.md: + id: ac541d142ff4 + last_write_checksum: sha1:54d9bfd3cd764d11cd993f7ff87784bd6d11f14d + pristine_git_object: f3c8fc3cf7d9b4587b47afaf67eb14608eb58b48 docs/models/toolcall.md: id: 80892ea1a051 last_write_checksum: sha1:cb27b9d36cfe6227978c7a7a01b1349b6bac99d9 @@ -2059,6 +2091,10 @@ trackedFiles: id: 06bfa2c4e662 last_write_checksum: sha1:9b619977375f228c76f09d48d6e2833add6c07e2 pristine_git_object: 89286a172124ce3473bcb081de6e4db8c95afefa + docs/models/toolexecution.md: + id: 0c47c08eaa46 + last_write_checksum: sha1:1af09b39f042e21e47ac09f73301ca9bbb521029 + pristine_git_object: 8d385132baca782d1a7ec0d586136a29751f6ec8 docs/models/toolexecutiondeltaevent.md: id: f2fc876ef7c6 last_write_checksum: sha1:ae1462a9b5cb56002b41f477ce262cb64ccf2f4e @@ -2115,6 +2151,10 @@ trackedFiles: id: c2210d74792a last_write_checksum: sha1:368add3ac6df876bc85bb4968de840ac578ae623 pristine_git_object: 999f7c34885015a687c4213d067b144f1585c946 + docs/models/tooltype.md: + id: 5e2ddf7b3863 + last_write_checksum: sha1:3aa9c92e9872fe75032e53e311bf050dbab51e98 + pristine_git_object: 2a64e130e526f8d99e623e7cbc0c7add82d8fab0 docs/models/tooltypes.md: id: adb50fe63ea2 last_write_checksum: sha1:d0d67b717773cbc99add6716e0287e64f04d24df @@ -2159,6 +2199,14 @@ trackedFiles: id: 69a13554b554 last_write_checksum: sha1:d969f462034ed356f2c8713b601ee7d873d4ce07 pristine_git_object: 77bd0ddcf8a1d95707fa9e041de3a47bb9e7f56d + docs/models/turbinetoollocale.md: + id: 57197dc9a955 + last_write_checksum: sha1:8ec2a585bfc0f5dca7bbad5fe143d21b9e5f6cb8 + pristine_git_object: 283dd339629448669557acf2d6eda10dea735421 + docs/models/turbinetoolmeta.md: + id: f99b41288e88 + last_write_checksum: sha1:092cd9ae293706419a86fd69c490cbc6587965d3 + pristine_git_object: 2f61a2c4d8be1634ccbb1ef0adacde0c6722a9bd docs/models/typeenum.md: id: d306d1d601a4 last_write_checksum: sha1:f0f0bfac75bf5e5fcd972d0cb196961d512d40ad @@ -2255,6 +2303,10 @@ trackedFiles: id: 304bdf06ef8b last_write_checksum: sha1:1f297f34069668f6107f2c0389606efe413ff5a8 pristine_git_object: 5bcea5b5d12e72222720af2c014d64ec4bdfee4a + docs/models/visibility.md: + id: 69ecc096de1e + last_write_checksum: sha1:30226db515dbfeef9316552cf871cf6882f597d2 + pristine_git_object: 924f2bdd9bcaa0bc59ba7a28733ce53fa968f822 docs/models/voicecreaterequest.md: id: 1014a6e8d549 last_write_checksum: sha1:2eba4e618f2767df9ca52b8b352e3060e9d0f04e @@ -2321,8 +2373,8 @@ trackedFiles: pristine_git_object: dc0f4984380b5b137266421e87a1505af5260e89 docs/sdks/connectors/README.md: id: 7633a87d946d - last_write_checksum: sha1:0b4056d65c780ae2b3a6e4a9ea71ca0c38e7ff42 - pristine_git_object: f23a09f780eaaed4aeb7ee8f4a0347ce5de3efd4 + last_write_checksum: sha1:d236c2895bbc9f1797817578d3ad8530798af3bb + pristine_git_object: 99892188389f4d53ddb45459f641475954a1ee03 docs/sdks/conversations/README.md: id: e22a9d2c5424 last_write_checksum: sha1:e0b78791f14b76d486688c5aa829877d58ae36da @@ -2413,8 +2465,8 @@ trackedFiles: pristine_git_object: 036d44b8cfc51599873bd5c401a6aed30450536c src/mistralai/client/_version.py: id: cc807b30de19 - last_write_checksum: sha1:d7a3abfbd260f39e87a405377e56d9dd8a48439f - pristine_git_object: a5ba9a2a6bcff1a4b62db94c38d18b40c88813cc + last_write_checksum: sha1:4119527b41471c1a6571b0a33c6f5368dbae4077 + pristine_git_object: 68da4e561a187ec72d7a25b962d05112688779ee src/mistralai/client/accesses.py: id: 76fc53bfcf59 last_write_checksum: sha1:4b1cf5d760f690d35582f9037df44c97c11e7e14 @@ -2465,8 +2517,8 @@ trackedFiles: pristine_git_object: 67199b601e38dff6fc6a4317eb845fbde6c25de0 src/mistralai/client/connectors.py: id: 39da03126050 - last_write_checksum: sha1:80a42736f56e43ad286308010d494e0ed19597f0 - pristine_git_object: b72ca9a39a225cec099f6606afaf4463c294a97e + last_write_checksum: sha1:60d5d04e3650f48487df3cbb682c5646bf3c3a81 + pristine_git_object: e0c4793e40098f9055735edcfce4a1168f99918b src/mistralai/client/conversations.py: id: 40692a878064 last_write_checksum: sha1:f5f2e6d1d78b75177d6b831b69b212956926eede @@ -2545,8 +2597,8 @@ trackedFiles: pristine_git_object: b8728362b87349118ac6f163f50613dd18c43340 src/mistralai/client/models/__init__.py: id: e0e8dad92725 - last_write_checksum: sha1:a1e0aa6e1959ee7380d30eea984d79bcd84a6203 - pristine_git_object: 05756e5b68c67b3697636bc49939edc6e5b701e8 + last_write_checksum: sha1:299d59da943dc58f2bc4bf694d76d7172cbbd30e + pristine_git_object: 3ace7584ab83c9ee6d7fddfb5b0211fba63763b8 src/mistralai/client/models/agent.py: id: 1336849c84fb last_write_checksum: sha1:2574866d9855cb0b6314ac94ca288d59f3196c73 @@ -2883,6 +2935,10 @@ trackedFiles: id: 73ca3a446dcc last_write_checksum: sha1:74ce85c377be5d7f86506d8a8d97249708c246b8 pristine_git_object: 780afac9281bf78c4263c7bd32faa04a718695d2 + src/mistralai/client/models/connector_list_tools_v1op.py: + id: 4c6ad704479b + last_write_checksum: sha1:cc6b39ad84831a838e0a70748c31c7acae946cee + pristine_git_object: eb5de3213915c8d748648796bd5f582acd2d24e3 src/mistralai/client/models/connector_list_v1op.py: id: 5ec0889995f5 last_write_checksum: sha1:17c0a5965d058a4aacb891d37db3481a907ff091 @@ -3675,6 +3731,18 @@ trackedFiles: id: a5b508a322d7 last_write_checksum: sha1:0dd9bac0684864bf6264ddded7f27c8c88b804f5 pristine_git_object: 293ab37505a1098241631dd83435a0e91d073551 + src/mistralai/client/models/mcptool.py: + id: 5a696c8478cb + last_write_checksum: sha1:c4b180a023664313dea583377b79bf53f0f93262 + pristine_git_object: 908ff8ce20773a4ca1fd80e47a588acc9ba401af + src/mistralai/client/models/mcptoolmeta.py: + id: 07cf1c0762c9 + last_write_checksum: sha1:01af35e36f16d4ab4318633b6d773550c8403108 + pristine_git_object: edbf39a9b4c066ea495471cf6ff21b08d8a390a6 + src/mistralai/client/models/mcpuitoolmeta.py: + id: 7c54fb6157a9 + last_write_checksum: sha1:a115ada5e6c22925919160a88a8358c16129bce2 + pristine_git_object: 287192a67a4fe1c22a209996db9b9e8df1a93359 src/mistralai/client/models/messageentries.py: id: e13f9009902b last_write_checksum: sha1:43aebdc9eaecc8341298dc6b281d0d57edf4e9e6 @@ -4075,6 +4143,10 @@ trackedFiles: id: 48b4f6f50fe9 last_write_checksum: sha1:ed3725d5da10e6a201f73724a2bbf618bdbb2a33 pristine_git_object: 1d1c5ce557321c33b036949fa4c625fb25e38f95 + src/mistralai/client/models/toolannotations.py: + id: 2ae257a35b01 + last_write_checksum: sha1:6f7c174966fc9a9fee5de7c8dfa4dbf2064c10e4 + pristine_git_object: b2e9b94808b96b859d29c42aa0d5ca994761a395 src/mistralai/client/models/toolcall.py: id: fb34a1a3f3c2 last_write_checksum: sha1:a0e14e69a107d88239e1ee43d2e8fd498eb034a4 @@ -4095,6 +4167,10 @@ trackedFiles: id: faec24b75066 last_write_checksum: sha1:caa6c41ccb0825034bb9cab4e3fcd1a2547b66a9 pristine_git_object: eb3d14e5517a60c1fbac1b1feb7d5daadd877a90 + src/mistralai/client/models/toolexecution.py: + id: 69fcb691327a + last_write_checksum: sha1:85bcd4a5d30aab54425bccec9c2374137fad6736 + pristine_git_object: 9c55e7bb9db0be106d30b9bf37153aaf8d7b61ff src/mistralai/client/models/toolexecutiondeltaevent.py: id: df8f17cf3e07 last_write_checksum: sha1:77da4c0bca920d4ea77a64faa039fb3c07df46ed @@ -4123,6 +4199,10 @@ trackedFiles: id: 822e9f3e70de last_write_checksum: sha1:2e489c4b2360741a3e4a20710361511a0d9158ea pristine_git_object: 391724edbb7eea3d3acd1a4b3302045970cb5e31 + src/mistralai/client/models/tooltype.py: + id: cbe8c44aee50 + last_write_checksum: sha1:53949106f192944a13a8fcbeb37b3d08478b7bbc + pristine_git_object: 1a7781fc2c1001002785d512ed7909ce91a9129f src/mistralai/client/models/tooltypes.py: id: 86c3b54272fd last_write_checksum: sha1:e90c15c1e645a5f207af0c7ac728cb0a521c6706 @@ -4163,6 +4243,14 @@ trackedFiles: id: 6086dc081147 last_write_checksum: sha1:968b4bc32731be6c63be3fd90eb26f4357f891a3 pristine_git_object: 42f0ffb7f16bee4f68f9db9807aa4ec3d9ae5176 + src/mistralai/client/models/turbinetoollocale.py: + id: 2699936a7546 + last_write_checksum: sha1:9fa6910a64b464068a660b3d5bf5e09109da283b + pristine_git_object: 42682ee15e542672c190e1b82e713539a6c9b22e + src/mistralai/client/models/turbinetoolmeta.py: + id: cdb07c3837f7 + last_write_checksum: sha1:c2339efbf6dac10bf5e3f42491fa971982d4a998 + pristine_git_object: bcd4d5f2da000bcc4af9c41bf7e92efdaf99b039 src/mistralai/client/models/unarchivemodelresponse.py: id: 22e2ccbb0c80 last_write_checksum: sha1:8ebdd49f2bef3c5934395808bf71701b46e512be @@ -4301,8 +4389,8 @@ trackedFiles: pristine_git_object: 712e92e05c7fd3016431ec62ecb7b7789c8b7071 src/mistralai/client/speech.py: id: 5c1f1109aa5e - last_write_checksum: sha1:64856e4330b793618c25288d44dfba000295ddcf - pristine_git_object: e548df4444f8fd0b5de58890de371b3a9bb31aed + last_write_checksum: sha1:22b38977bf8e1f53219a2146b15f471ad1ebf4f7 + pristine_git_object: fe57e2fa80ced90774b9ea60199e138ce781c9a3 src/mistralai/client/transcriptions.py: id: 75b45780c978 last_write_checksum: sha1:27a5b7dd6ed47b0f79b95fbb8599d439512ef344 @@ -6397,9 +6485,26 @@ examples: application/json: "" "422": application/json: {} + connector_list_tools_v1: + speakeasy-default-connector-list-tools-v1: + parameters: + path: + connector_id_or_name: "" + query: + page: 1 + page_size: 100 + refresh: false + pretty: false + responses: + "200": + application/json: [{}] + "422": + application/json: {} examplesVersion: 1.0.2 generatedTests: {} -releaseNotes: "## Python SDK Changes:\n* `mistral.beta.conversations.start()`: \n * `request.tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.conversations.list()`: `response.[].union(ModelConversation).tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.conversations.get()`: `response.union(ModelConversation).tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.conversations.start_stream()`: \n * `request.tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.agents.create()`: \n * `request.tools[]` **Changed** (Breaking ⚠️)\n * `response.tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.agents.list()`: `response.[].tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.agents.get()`: `response.tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.agents.update()`: \n * `request.tools[]` **Changed** (Breaking ⚠️)\n * `response.tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.agents.update_version()`: `response.tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.agents.list_versions()`: `response.[].tools[]` **Changed** (Breaking ⚠️)\n* `mistral.beta.agents.get_version()`: `response.tools[]` **Changed** (Breaking ⚠️)\n* `mistral.chat.complete()`: \n * `request` **Changed** (Breaking ⚠️)\n * `response.choices[]` **Changed** (Breaking ⚠️)\n* `mistral.chat.stream()`: `request` **Changed** (Breaking ⚠️)\n* `mistral.fim.complete()`: `response.choices[]` **Changed** (Breaking ⚠️)\n* `mistral.agents.complete()`: \n * `request` **Changed** (Breaking ⚠️)\n * `response.choices[]` **Changed** (Breaking ⚠️)\n* `mistral.agents.stream()`: `request` **Changed** (Breaking ⚠️)\n" +releaseNotes: | + ## Python SDK Changes: + * `mistral.beta.connectors.list_tools()`: **Added** generatedFiles: - .gitattributes - .vscode/settings.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 38910bfd..390116a2 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false python: - version: 2.1.2 + version: 2.1.3 additionalDependencies: dev: pytest: ^8.2.2 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 69bef81b..105cdb2a 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -16,8 +16,8 @@ sources: - speakeasy-sdk-regen-1773084660 mistral-openapi: sourceNamespace: mistral-openapi - sourceRevisionDigest: sha256:2796a05e4b9f32ebc2ffa6b195b959507d7d2683f6b06593781cc8ebdcd7cb6f - sourceBlobDigest: sha256:9e5029c7cf5ae151e2b0a123e70013dc6d9a58b8127884cf33e85fa3be32abee + sourceRevisionDigest: sha256:480366372609b8e74697827a161a478dd87aa95460d0e078ecc73b5dfa0d00ff + sourceBlobDigest: sha256:23523b81989fa5223902dea44dd6bebf8eb7b1dceec5cc3aa4dbb969ecde6652 tags: - latest targets: @@ -38,10 +38,10 @@ targets: mistralai-sdk: source: mistral-openapi sourceNamespace: mistral-openapi - sourceRevisionDigest: sha256:2796a05e4b9f32ebc2ffa6b195b959507d7d2683f6b06593781cc8ebdcd7cb6f - sourceBlobDigest: sha256:9e5029c7cf5ae151e2b0a123e70013dc6d9a58b8127884cf33e85fa3be32abee + sourceRevisionDigest: sha256:480366372609b8e74697827a161a478dd87aa95460d0e078ecc73b5dfa0d00ff + sourceBlobDigest: sha256:23523b81989fa5223902dea44dd6bebf8eb7b1dceec5cc3aa4dbb969ecde6652 codeSamplesNamespace: mistral-openapi-code-samples - codeSamplesRevisionDigest: sha256:5aa694bacc4be160d5afb6c05c08407744acbc82e951d650b2a2faaeb13e4271 + codeSamplesRevisionDigest: sha256:6d406cd8dd3e8da23675c1d278548dc5f54c616af47c94b0a704711a6b27d561 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.754.0 diff --git a/README-PYPI.md b/README-PYPI.md index 625c6558..1a0b2402 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -512,6 +512,7 @@ print(res.choices[0].message.content) * [list](https://github.com/mistralai/client-python/blob/main/docs/sdks/connectors/README.md#list) - List all connectors. * [get_auth_url](https://github.com/mistralai/client-python/blob/main/docs/sdks/connectors/README.md#get_auth_url) - Get the auth URL for a connector. * [call_tool](https://github.com/mistralai/client-python/blob/main/docs/sdks/connectors/README.md#call_tool) - Call Connector Tool +* [list_tools](https://github.com/mistralai/client-python/blob/main/docs/sdks/connectors/README.md#list_tools) - List tools for a connector. * [get](https://github.com/mistralai/client-python/blob/main/docs/sdks/connectors/README.md#get) - Get a connector. * [update](https://github.com/mistralai/client-python/blob/main/docs/sdks/connectors/README.md#update) - Update a connector. * [delete](https://github.com/mistralai/client-python/blob/main/docs/sdks/connectors/README.md#delete) - Delete a connector. @@ -850,8 +851,8 @@ with Mistral( **Inherit from [`MistralError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/mistralerror.py)**: -* [`HTTPValidationError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 68 of 130 methods.* -* [`ObservabilityError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/observabilityerror.py): Bad Request - Invalid request parameters or data. Applicable to 41 of 130 methods.* +* [`HTTPValidationError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 69 of 131 methods.* +* [`ObservabilityError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/observabilityerror.py): Bad Request - Invalid request parameters or data. Applicable to 41 of 131 methods.* * [`ResponseValidationError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute. diff --git a/README.md b/README.md index 54374697..46ad3c76 100644 --- a/README.md +++ b/README.md @@ -512,6 +512,7 @@ print(res.choices[0].message.content) * [list](docs/sdks/connectors/README.md#list) - List all connectors. * [get_auth_url](docs/sdks/connectors/README.md#get_auth_url) - Get the auth URL for a connector. * [call_tool](docs/sdks/connectors/README.md#call_tool) - Call Connector Tool +* [list_tools](docs/sdks/connectors/README.md#list_tools) - List tools for a connector. * [get](docs/sdks/connectors/README.md#get) - Get a connector. * [update](docs/sdks/connectors/README.md#update) - Update a connector. * [delete](docs/sdks/connectors/README.md#delete) - Delete a connector. @@ -850,8 +851,8 @@ with Mistral( **Inherit from [`MistralError`](./src/mistralai/client/errors/mistralerror.py)**: -* [`HTTPValidationError`](./src/mistralai/client/errors/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 68 of 130 methods.* -* [`ObservabilityError`](./src/mistralai/client/errors/observabilityerror.py): Bad Request - Invalid request parameters or data. Applicable to 41 of 130 methods.* +* [`HTTPValidationError`](./src/mistralai/client/errors/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 69 of 131 methods.* +* [`ObservabilityError`](./src/mistralai/client/errors/observabilityerror.py): Bad Request - Invalid request parameters or data. Applicable to 41 of 131 methods.* * [`ResponseValidationError`](./src/mistralai/client/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute. diff --git a/RELEASES.md b/RELEASES.md index c557596d..954b2675 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -478,4 +478,14 @@ Based on: ### Generated - [python v2.1.2] . ### Releases -- [PyPI v2.1.2] https://pypi.org/project/mistralai/2.1.2 - . \ No newline at end of file +- [PyPI v2.1.2] https://pypi.org/project/mistralai/2.1.2 - . + +## 2026-03-23 14:35:45 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.754.0 (2.862.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v2.1.3] . +### Releases +- [PyPI v2.1.3] https://pypi.org/project/mistralai/2.1.3 - . \ No newline at end of file diff --git a/docs/models/connectorlisttoolsv1request.md b/docs/models/connectorlisttoolsv1request.md new file mode 100644 index 00000000..e080455b --- /dev/null +++ b/docs/models/connectorlisttoolsv1request.md @@ -0,0 +1,12 @@ +# ConnectorListToolsV1Request + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `page` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `page_size` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `refresh` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `pretty` | *Optional[bool]* | :heavy_minus_sign: | Return a simplified payload with only name, description, annotations, and a compact inputSchema. | +| `connector_id_or_name` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/mcptool.md b/docs/models/mcptool.md new file mode 100644 index 00000000..006802b4 --- /dev/null +++ b/docs/models/mcptool.md @@ -0,0 +1,17 @@ +# MCPTool + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `name` | *str* | :heavy_check_mark: | N/A | +| `title` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `input_schema` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `output_schema` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | +| `icons` | List[[models.MCPServerIcon](../models/mcpservericon.md)] | :heavy_minus_sign: | N/A | +| `annotations` | [OptionalNullable[models.ToolAnnotations]](../models/toolannotations.md) | :heavy_minus_sign: | N/A | +| `meta` | [OptionalNullable[models.MCPToolMeta]](../models/mcptoolmeta.md) | :heavy_minus_sign: | N/A | +| `execution` | [OptionalNullable[models.ToolExecution]](../models/toolexecution.md) | :heavy_minus_sign: | N/A | +| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/mcptoolmeta.md b/docs/models/mcptoolmeta.md new file mode 100644 index 00000000..23e8b64c --- /dev/null +++ b/docs/models/mcptoolmeta.md @@ -0,0 +1,14 @@ +# MCPToolMeta + +Typed _meta for MCP tools. + +Only the 'ui' field is typed. Other fields are allowed via extra="allow". + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `ui` | [OptionalNullable[models.MCPUIToolMeta]](../models/mcpuitoolmeta.md) | :heavy_minus_sign: | N/A | +| `ai_mistral_turbine` | [OptionalNullable[models.TurbineToolMeta]](../models/turbinetoolmeta.md) | :heavy_minus_sign: | N/A | +| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/mcpuitoolmeta.md b/docs/models/mcpuitoolmeta.md new file mode 100644 index 00000000..c09b29ad --- /dev/null +++ b/docs/models/mcpuitoolmeta.md @@ -0,0 +1,12 @@ +# MCPUIToolMeta + +UI metadata for tools that reference UI resources. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `resource_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `visibility` | List[[models.Visibility](../models/visibility.md)] | :heavy_minus_sign: | N/A | +| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/responseconnectorlisttoolsv11.md b/docs/models/responseconnectorlisttoolsv11.md new file mode 100644 index 00000000..9b5c98c6 --- /dev/null +++ b/docs/models/responseconnectorlisttoolsv11.md @@ -0,0 +1,17 @@ +# ResponseConnectorListToolsV11 + + +## Supported Types + +### `models.ConnectorTool` + +```python +value: models.ConnectorTool = /* values here */ +``` + +### `models.MCPTool` + +```python +value: models.MCPTool = /* values here */ +``` + diff --git a/docs/models/responseconnectorlisttoolsv12.md b/docs/models/responseconnectorlisttoolsv12.md new file mode 100644 index 00000000..0266f66d --- /dev/null +++ b/docs/models/responseconnectorlisttoolsv12.md @@ -0,0 +1,19 @@ +# ResponseConnectorListToolsV12 + +Successful Response + + +## Supported Types + +### `List[models.ResponseConnectorListToolsV11]` + +```python +value: List[models.ResponseConnectorListToolsV11] = /* values here */ +``` + +### `List[Dict[str, Any]]` + +```python +value: List[Dict[str, Any]] = /* values here */ +``` + diff --git a/docs/models/tasksupport.md b/docs/models/tasksupport.md new file mode 100644 index 00000000..2d16da9d --- /dev/null +++ b/docs/models/tasksupport.md @@ -0,0 +1,19 @@ +# TaskSupport + +## Example Usage + +```python +from mistralai.client.models import TaskSupport + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: TaskSupport = "forbidden" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"forbidden"` +- `"optional"` +- `"required"` diff --git a/docs/models/toolannotations.md b/docs/models/toolannotations.md new file mode 100644 index 00000000..f3c8fc3c --- /dev/null +++ b/docs/models/toolannotations.md @@ -0,0 +1,22 @@ +# ToolAnnotations + +Additional properties describing a Tool to clients. + +NOTE: all properties in ToolAnnotations are **hints**. +They are not guaranteed to provide a faithful description of +tool behavior (including descriptive properties like `title`). + +Clients should never make tool use decisions based on ToolAnnotations +received from untrusted servers. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `title` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `read_only_hint` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `destructive_hint` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `idempotent_hint` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `open_world_hint` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/toolexecution.md b/docs/models/toolexecution.md new file mode 100644 index 00000000..8d385132 --- /dev/null +++ b/docs/models/toolexecution.md @@ -0,0 +1,11 @@ +# ToolExecution + +Execution-related properties for a tool. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `task_support` | [OptionalNullable[models.TaskSupport]](../models/tasksupport.md) | :heavy_minus_sign: | N/A | +| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/tooltype.md b/docs/models/tooltype.md new file mode 100644 index 00000000..2a64e130 --- /dev/null +++ b/docs/models/tooltype.md @@ -0,0 +1,20 @@ +# ToolType + +## Example Usage + +```python +from mistralai.client.models import ToolType + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ToolType = "rag" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"rag"` +- `"image"` +- `"code"` +- `"event"` diff --git a/docs/models/turbinetoollocale.md b/docs/models/turbinetoollocale.md new file mode 100644 index 00000000..283dd339 --- /dev/null +++ b/docs/models/turbinetoollocale.md @@ -0,0 +1,12 @@ +# TurbineToolLocale + + +## Fields + +| Field | Type | Required | Description | +| --------------------- | --------------------- | --------------------- | --------------------- | +| `name` | Dict[str, *str*] | :heavy_minus_sign: | N/A | +| `description` | Dict[str, *str*] | :heavy_minus_sign: | N/A | +| `usage_sentence` | Dict[str, *str*] | :heavy_minus_sign: | N/A | +| `working_description` | Dict[str, *str*] | :heavy_minus_sign: | N/A | +| `done_description` | Dict[str, *str*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/turbinetoolmeta.md b/docs/models/turbinetoolmeta.md new file mode 100644 index 00000000..2f61a2c4 --- /dev/null +++ b/docs/models/turbinetoolmeta.md @@ -0,0 +1,11 @@ +# TurbineToolMeta + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `locale` | [OptionalNullable[models.TurbineToolLocale]](../models/turbinetoollocale.md) | :heavy_minus_sign: | N/A | +| `tool_type` | [OptionalNullable[models.ToolType]](../models/tooltype.md) | :heavy_minus_sign: | N/A | +| `timeout` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `private_execution` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/visibility.md b/docs/models/visibility.md new file mode 100644 index 00000000..924f2bdd --- /dev/null +++ b/docs/models/visibility.md @@ -0,0 +1,18 @@ +# Visibility + +## Example Usage + +```python +from mistralai.client.models import Visibility + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Visibility = "model" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"model"` +- `"app"` diff --git a/docs/sdks/connectors/README.md b/docs/sdks/connectors/README.md index f23a09f7..99892188 100644 --- a/docs/sdks/connectors/README.md +++ b/docs/sdks/connectors/README.md @@ -10,6 +10,7 @@ * [list](#list) - List all connectors. * [get_auth_url](#get_auth_url) - Get the auth URL for a connector. * [call_tool](#call_tool) - Call Connector Tool +* [list_tools](#list_tools) - List tools for a connector. * [get](#get) - Get a connector. * [update](#update) - Update a connector. * [delete](#delete) - Delete a connector. @@ -190,6 +191,51 @@ with Mistral( | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | +## list_tools + +List all tools available for an MCP connector. + +### Example Usage + + +```python +from mistralai.client import Mistral +import os + + +with Mistral( + api_key=os.getenv("MISTRAL_API_KEY", ""), +) as mistral: + + res = mistral.beta.connectors.list_tools(connector_id_or_name="", page=1, page_size=100, refresh=False, pretty=False) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `connector_id_or_name` | *str* | :heavy_check_mark: | N/A | +| `page` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `page_size` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `refresh` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `pretty` | *Optional[bool]* | :heavy_minus_sign: | Return a simplified payload with only name, description, annotations, and a compact inputSchema. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.ResponseConnectorListToolsV12](../../models/responseconnectorlisttoolsv12.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors.HTTPValidationError | 422 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + ## get Get a connector by its ID or name. diff --git a/pyproject.toml b/pyproject.toml index 504b6414..7be2c9e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mistralai" -version = "2.1.2" +version = "2.1.3" description = "Python Client SDK for the Mistral AI API." authors = [{ name = "Mistral" }] requires-python = ">=3.10" diff --git a/src/mistralai/client/_version.py b/src/mistralai/client/_version.py index a5ba9a2a..68da4e56 100644 --- a/src/mistralai/client/_version.py +++ b/src/mistralai/client/_version.py @@ -4,10 +4,10 @@ import importlib.metadata __title__: str = "mistralai" -__version__: str = "2.1.2" +__version__: str = "2.1.3" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.862.0" -__user_agent__: str = "speakeasy-sdk/python 2.1.2 2.862.0 1.0.0 mistralai" +__user_agent__: str = "speakeasy-sdk/python 2.1.3 2.862.0 1.0.0 mistralai" try: if __package__ is not None: diff --git a/src/mistralai/client/connectors.py b/src/mistralai/client/connectors.py index b72ca9a3..e0c4793e 100644 --- a/src/mistralai/client/connectors.py +++ b/src/mistralai/client/connectors.py @@ -845,6 +845,214 @@ async def call_tool_async( raise errors.SDKError("Unexpected response received", http_res) + def list_tools( + self, + *, + connector_id_or_name: str, + page: Optional[int] = 1, + page_size: Optional[int] = 100, + refresh: Optional[bool] = False, + pretty: Optional[bool] = False, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.ResponseConnectorListToolsV12: + r"""List tools for a connector. + + List all tools available for an MCP connector. + + :param connector_id_or_name: + :param page: + :param page_size: + :param refresh: + :param pretty: Return a simplified payload with only name, description, annotations, and a compact inputSchema. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.ConnectorListToolsV1Request( + page=page, + page_size=page_size, + refresh=refresh, + pretty=pretty, + connector_id_or_name=connector_id_or_name, + ) + + req = self._build_request( + method="GET", + path="/v1/connectors/{connector_id_or_name}/tools", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="connector_list_tools_v1", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + models.ResponseConnectorListToolsV12, http_res + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = unmarshal_json_response( + errors.HTTPValidationErrorData, http_res + ) + raise errors.HTTPValidationError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError("API error occurred", http_res, http_res_text) + + raise errors.SDKError("Unexpected response received", http_res) + + async def list_tools_async( + self, + *, + connector_id_or_name: str, + page: Optional[int] = 1, + page_size: Optional[int] = 100, + refresh: Optional[bool] = False, + pretty: Optional[bool] = False, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.ResponseConnectorListToolsV12: + r"""List tools for a connector. + + List all tools available for an MCP connector. + + :param connector_id_or_name: + :param page: + :param page_size: + :param refresh: + :param pretty: Return a simplified payload with only name, description, annotations, and a compact inputSchema. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.ConnectorListToolsV1Request( + page=page, + page_size=page_size, + refresh=refresh, + pretty=pretty, + connector_id_or_name=connector_id_or_name, + ) + + req = self._build_request_async( + method="GET", + path="/v1/connectors/{connector_id_or_name}/tools", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="connector_list_tools_v1", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + models.ResponseConnectorListToolsV12, http_res + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = unmarshal_json_response( + errors.HTTPValidationErrorData, http_res + ) + raise errors.HTTPValidationError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError("API error occurred", http_res, http_res_text) + + raise errors.SDKError("Unexpected response received", http_res) + def get( self, *, diff --git a/src/mistralai/client/models/__init__.py b/src/mistralai/client/models/__init__.py index 05756e5b..3ace7584 100644 --- a/src/mistralai/client/models/__init__.py +++ b/src/mistralai/client/models/__init__.py @@ -344,6 +344,14 @@ ConnectorGetV1Request, ConnectorGetV1RequestTypedDict, ) + from .connector_list_tools_v1op import ( + ConnectorListToolsV1Request, + ConnectorListToolsV1RequestTypedDict, + ResponseConnectorListToolsV11, + ResponseConnectorListToolsV11TypedDict, + ResponseConnectorListToolsV12, + ResponseConnectorListToolsV12TypedDict, + ) from .connector_list_v1op import ( ConnectorListV1Request, ConnectorListV1RequestTypedDict, @@ -1056,6 +1064,9 @@ ) from .listsharingresponse import ListSharingResponse, ListSharingResponseTypedDict from .mcpservericon import MCPServerIcon, MCPServerIconTypedDict + from .mcptool import MCPTool, MCPToolTypedDict + from .mcptoolmeta import MCPToolMeta, MCPToolMetaTypedDict + from .mcpuitoolmeta import MCPUIToolMeta, MCPUIToolMetaTypedDict, Visibility from .messageentries import MessageEntries, MessageEntriesTypedDict from .messageinputcontentchunks import ( MessageInputContentChunks, @@ -1326,6 +1337,7 @@ from .thinkchunk import ThinkChunk, ThinkChunkTypedDict, Thinking, ThinkingTypedDict from .timestampgranularity import TimestampGranularity from .tool import Tool, ToolTypedDict + from .toolannotations import ToolAnnotations, ToolAnnotationsTypedDict from .toolcall import ToolCall, ToolCallTypedDict from .toolcallconfirmation import ( Confirmation, @@ -1335,6 +1347,7 @@ from .toolchoice import ToolChoice, ToolChoiceTypedDict from .toolchoiceenum import ToolChoiceEnum from .toolconfiguration import ToolConfiguration, ToolConfigurationTypedDict + from .toolexecution import TaskSupport, ToolExecution, ToolExecutionTypedDict from .toolexecutiondeltaevent import ( ToolExecutionDeltaEvent, ToolExecutionDeltaEventName, @@ -1377,6 +1390,7 @@ ToolReferenceChunkToolTypedDict, ToolReferenceChunkTypedDict, ) + from .tooltype import ToolType from .tooltypes import ToolTypes from .trainingfile import TrainingFile, TrainingFileTypedDict from .transcriptionresponse import ( @@ -1411,6 +1425,8 @@ TranscriptionStreamTextDelta, TranscriptionStreamTextDeltaTypedDict, ) + from .turbinetoollocale import TurbineToolLocale, TurbineToolLocaleTypedDict + from .turbinetoolmeta import TurbineToolMeta, TurbineToolMetaTypedDict from .unarchivemodelresponse import ( UnarchiveModelResponse, UnarchiveModelResponseTypedDict, @@ -1751,6 +1767,8 @@ "ConnectorGetAuthURLV1RequestTypedDict", "ConnectorGetV1Request", "ConnectorGetV1RequestTypedDict", + "ConnectorListToolsV1Request", + "ConnectorListToolsV1RequestTypedDict", "ConnectorListV1Request", "ConnectorListV1RequestTypedDict", "ConnectorTool", @@ -2211,6 +2229,12 @@ "LocTypedDict", "MCPServerIcon", "MCPServerIconTypedDict", + "MCPTool", + "MCPToolMeta", + "MCPToolMetaTypedDict", + "MCPToolTypedDict", + "MCPUIToolMeta", + "MCPUIToolMetaTypedDict", "MessageEntries", "MessageEntriesTypedDict", "MessageInputContentChunks", @@ -2364,6 +2388,10 @@ "ResourceTypedDict", "ResourceVisibility", "Response", + "ResponseConnectorListToolsV11", + "ResponseConnectorListToolsV11TypedDict", + "ResponseConnectorListToolsV12", + "ResponseConnectorListToolsV12TypedDict", "ResponseDoneEvent", "ResponseDoneEventTypedDict", "ResponseErrorEvent", @@ -2426,6 +2454,7 @@ "SystemMessageContentTypedDict", "SystemMessageTypedDict", "TableFormat", + "TaskSupport", "TextChunk", "TextChunkTypedDict", "TextContent", @@ -2438,6 +2467,8 @@ "ThinkingTypedDict", "TimestampGranularity", "Tool", + "ToolAnnotations", + "ToolAnnotationsTypedDict", "ToolCall", "ToolCallConfirmation", "ToolCallConfirmationTypedDict", @@ -2447,6 +2478,7 @@ "ToolChoiceTypedDict", "ToolConfiguration", "ToolConfigurationTypedDict", + "ToolExecution", "ToolExecutionDeltaEvent", "ToolExecutionDeltaEventName", "ToolExecutionDeltaEventNameTypedDict", @@ -2463,6 +2495,7 @@ "ToolExecutionStartedEventName", "ToolExecutionStartedEventNameTypedDict", "ToolExecutionStartedEventTypedDict", + "ToolExecutionTypedDict", "ToolFileChunk", "ToolFileChunkTool", "ToolFileChunkToolTypedDict", @@ -2475,6 +2508,7 @@ "ToolReferenceChunkTool", "ToolReferenceChunkToolTypedDict", "ToolReferenceChunkTypedDict", + "ToolType", "ToolTypedDict", "ToolTypes", "TrainingFile", @@ -2496,6 +2530,10 @@ "TranscriptionStreamSegmentDeltaTypedDict", "TranscriptionStreamTextDelta", "TranscriptionStreamTextDeltaTypedDict", + "TurbineToolLocale", + "TurbineToolLocaleTypedDict", + "TurbineToolMeta", + "TurbineToolMetaTypedDict", "TypeEnum", "UnarchiveModelResponse", "UnarchiveModelResponseTypedDict", @@ -2564,6 +2602,7 @@ "UserMessageTypedDict", "ValidationError", "ValidationErrorTypedDict", + "Visibility", "VoiceCreateRequest", "VoiceCreateRequestTypedDict", "VoiceListResponse", @@ -2822,6 +2861,12 @@ "ConnectorGetAuthURLV1RequestTypedDict": ".connector_get_auth_url_v1op", "ConnectorGetV1Request": ".connector_get_v1op", "ConnectorGetV1RequestTypedDict": ".connector_get_v1op", + "ConnectorListToolsV1Request": ".connector_list_tools_v1op", + "ConnectorListToolsV1RequestTypedDict": ".connector_list_tools_v1op", + "ResponseConnectorListToolsV11": ".connector_list_tools_v1op", + "ResponseConnectorListToolsV11TypedDict": ".connector_list_tools_v1op", + "ResponseConnectorListToolsV12": ".connector_list_tools_v1op", + "ResponseConnectorListToolsV12TypedDict": ".connector_list_tools_v1op", "ConnectorListV1Request": ".connector_list_v1op", "ConnectorListV1RequestTypedDict": ".connector_list_v1op", "ConnectorUpdateV1Request": ".connector_update_v1op", @@ -3302,6 +3347,13 @@ "ListSharingResponseTypedDict": ".listsharingresponse", "MCPServerIcon": ".mcpservericon", "MCPServerIconTypedDict": ".mcpservericon", + "MCPTool": ".mcptool", + "MCPToolTypedDict": ".mcptool", + "MCPToolMeta": ".mcptoolmeta", + "MCPToolMetaTypedDict": ".mcptoolmeta", + "MCPUIToolMeta": ".mcpuitoolmeta", + "MCPUIToolMetaTypedDict": ".mcpuitoolmeta", + "Visibility": ".mcpuitoolmeta", "MessageEntries": ".messageentries", "MessageEntriesTypedDict": ".messageentries", "MessageInputContentChunks": ".messageinputcontentchunks", @@ -3521,6 +3573,8 @@ "TimestampGranularity": ".timestampgranularity", "Tool": ".tool", "ToolTypedDict": ".tool", + "ToolAnnotations": ".toolannotations", + "ToolAnnotationsTypedDict": ".toolannotations", "ToolCall": ".toolcall", "ToolCallTypedDict": ".toolcall", "Confirmation": ".toolcallconfirmation", @@ -3531,6 +3585,9 @@ "ToolChoiceEnum": ".toolchoiceenum", "ToolConfiguration": ".toolconfiguration", "ToolConfigurationTypedDict": ".toolconfiguration", + "TaskSupport": ".toolexecution", + "ToolExecution": ".toolexecution", + "ToolExecutionTypedDict": ".toolexecution", "ToolExecutionDeltaEvent": ".toolexecutiondeltaevent", "ToolExecutionDeltaEventName": ".toolexecutiondeltaevent", "ToolExecutionDeltaEventNameTypedDict": ".toolexecutiondeltaevent", @@ -3559,6 +3616,7 @@ "ToolReferenceChunkTool": ".toolreferencechunk", "ToolReferenceChunkToolTypedDict": ".toolreferencechunk", "ToolReferenceChunkTypedDict": ".toolreferencechunk", + "ToolType": ".tooltype", "ToolTypes": ".tooltypes", "TrainingFile": ".trainingfile", "TrainingFileTypedDict": ".trainingfile", @@ -3580,6 +3638,10 @@ "TranscriptionStreamSegmentDeltaTypedDict": ".transcriptionstreamsegmentdelta", "TranscriptionStreamTextDelta": ".transcriptionstreamtextdelta", "TranscriptionStreamTextDeltaTypedDict": ".transcriptionstreamtextdelta", + "TurbineToolLocale": ".turbinetoollocale", + "TurbineToolLocaleTypedDict": ".turbinetoollocale", + "TurbineToolMeta": ".turbinetoolmeta", + "TurbineToolMetaTypedDict": ".turbinetoolmeta", "UnarchiveModelResponse": ".unarchivemodelresponse", "UnarchiveModelResponseTypedDict": ".unarchivemodelresponse", "UpdateDatasetRecordPayloadV1ObservabilityDatasetRecordsDatasetRecordIDPayloadPutRequest": ".update_dataset_record_payload_v1_observability_dataset_records_dataset_record_id_payload_putop", diff --git a/src/mistralai/client/models/connector_list_tools_v1op.py b/src/mistralai/client/models/connector_list_tools_v1op.py new file mode 100644 index 00000000..eb5de321 --- /dev/null +++ b/src/mistralai/client/models/connector_list_tools_v1op.py @@ -0,0 +1,88 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# @generated-id: 4c6ad704479b + +from __future__ import annotations +from .connectortool import ConnectorTool, ConnectorToolTypedDict +from .mcptool import MCPTool, MCPToolTypedDict +from mistralai.client.types import BaseModel, UNSET_SENTINEL +from mistralai.client.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata +from pydantic import model_serializer +from typing import Any, Dict, List, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class ConnectorListToolsV1RequestTypedDict(TypedDict): + connector_id_or_name: str + page: NotRequired[int] + page_size: NotRequired[int] + refresh: NotRequired[bool] + pretty: NotRequired[bool] + r"""Return a simplified payload with only name, description, annotations, and a compact inputSchema.""" + + +class ConnectorListToolsV1Request(BaseModel): + connector_id_or_name: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + page: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 1 + + page_size: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 100 + + refresh: Annotated[ + Optional[bool], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = False + + pretty: Annotated[ + Optional[bool], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = False + r"""Return a simplified payload with only name, description, annotations, and a compact inputSchema.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["page", "page_size", "refresh", "pretty"]) + 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)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +ResponseConnectorListToolsV11TypedDict = TypeAliasType( + "ResponseConnectorListToolsV11TypedDict", + Union[MCPToolTypedDict, ConnectorToolTypedDict], +) + + +ResponseConnectorListToolsV11 = TypeAliasType( + "ResponseConnectorListToolsV11", Union[MCPTool, ConnectorTool] +) + + +ResponseConnectorListToolsV12TypedDict = TypeAliasType( + "ResponseConnectorListToolsV12TypedDict", + Union[List[ResponseConnectorListToolsV11TypedDict], List[Dict[str, Any]]], +) +r"""Successful Response""" + + +ResponseConnectorListToolsV12 = TypeAliasType( + "ResponseConnectorListToolsV12", + Union[List[ResponseConnectorListToolsV11], List[Dict[str, Any]]], +) +r"""Successful Response""" diff --git a/src/mistralai/client/models/mcptool.py b/src/mistralai/client/models/mcptool.py new file mode 100644 index 00000000..908ff8ce --- /dev/null +++ b/src/mistralai/client/models/mcptool.py @@ -0,0 +1,122 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# @generated-id: 5a696c8478cb + +from __future__ import annotations +from .mcpservericon import MCPServerIcon, MCPServerIconTypedDict +from .mcptoolmeta import MCPToolMeta, MCPToolMetaTypedDict +from .toolannotations import ToolAnnotations, ToolAnnotationsTypedDict +from .toolexecution import ToolExecution, ToolExecutionTypedDict +from mistralai.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import ConfigDict, model_serializer +from typing import Any, Dict, List +from typing_extensions import Annotated, NotRequired, TypedDict + + +class MCPToolTypedDict(TypedDict): + name: str + input_schema: Dict[str, Any] + title: NotRequired[Nullable[str]] + description: NotRequired[Nullable[str]] + output_schema: NotRequired[Nullable[Dict[str, Any]]] + icons: NotRequired[Nullable[List[MCPServerIconTypedDict]]] + annotations: NotRequired[Nullable[ToolAnnotationsTypedDict]] + meta: NotRequired[Nullable[MCPToolMetaTypedDict]] + execution: NotRequired[Nullable[ToolExecutionTypedDict]] + + +class MCPTool(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + name: str + + input_schema: Annotated[Dict[str, Any], pydantic.Field(alias="inputSchema")] + + title: OptionalNullable[str] = UNSET + + description: OptionalNullable[str] = UNSET + + output_schema: Annotated[ + OptionalNullable[Dict[str, Any]], pydantic.Field(alias="outputSchema") + ] = UNSET + + icons: OptionalNullable[List[MCPServerIcon]] = UNSET + + annotations: OptionalNullable[ToolAnnotations] = UNSET + + meta: Annotated[OptionalNullable[MCPToolMeta], pydantic.Field(alias="_meta")] = ( + UNSET + ) + + execution: OptionalNullable[ToolExecution] = 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( + [ + "title", + "description", + "outputSchema", + "icons", + "annotations", + "_meta", + "execution", + ] + ) + nullable_fields = set( + [ + "title", + "description", + "outputSchema", + "icons", + "annotations", + "_meta", + "execution", + ] + ) + 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 + + +try: + MCPTool.model_rebuild() +except NameError: + pass diff --git a/src/mistralai/client/models/mcptoolmeta.py b/src/mistralai/client/models/mcptoolmeta.py new file mode 100644 index 00000000..edbf39a9 --- /dev/null +++ b/src/mistralai/client/models/mcptoolmeta.py @@ -0,0 +1,87 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# @generated-id: 07cf1c0762c9 + +from __future__ import annotations +from .mcpuitoolmeta import MCPUIToolMeta, MCPUIToolMetaTypedDict +from .turbinetoolmeta import TurbineToolMeta, TurbineToolMetaTypedDict +from mistralai.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import ConfigDict, model_serializer +from typing import Any, Dict +from typing_extensions import Annotated, NotRequired, TypedDict + + +class MCPToolMetaTypedDict(TypedDict): + r"""Typed _meta for MCP tools. + + Only the 'ui' field is typed. Other fields are allowed via extra=\"allow\". + """ + + ui: NotRequired[Nullable[MCPUIToolMetaTypedDict]] + ai_mistral_turbine: NotRequired[Nullable[TurbineToolMetaTypedDict]] + + +class MCPToolMeta(BaseModel): + r"""Typed _meta for MCP tools. + + Only the 'ui' field is typed. Other fields are allowed via extra=\"allow\". + """ + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + ui: OptionalNullable[MCPUIToolMeta] = UNSET + + ai_mistral_turbine: Annotated[ + OptionalNullable[TurbineToolMeta], pydantic.Field(alias="ai.mistral/turbine") + ] = 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(["ui", "ai.mistral/turbine"]) + nullable_fields = set(["ui", "ai.mistral/turbine"]) + 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 + + +try: + MCPToolMeta.model_rebuild() +except NameError: + pass diff --git a/src/mistralai/client/models/mcpuitoolmeta.py b/src/mistralai/client/models/mcpuitoolmeta.py new file mode 100644 index 00000000..287192a6 --- /dev/null +++ b/src/mistralai/client/models/mcpuitoolmeta.py @@ -0,0 +1,89 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# @generated-id: 7c54fb6157a9 + +from __future__ import annotations +from mistralai.client.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 Annotated, NotRequired, TypedDict + + +Visibility = Union[ + Literal[ + "model", + "app", + ], + UnrecognizedStr, +] + + +class MCPUIToolMetaTypedDict(TypedDict): + r"""UI metadata for tools that reference UI resources.""" + + resource_uri: NotRequired[Nullable[str]] + visibility: NotRequired[Nullable[List[Visibility]]] + + +class MCPUIToolMeta(BaseModel): + r"""UI metadata for tools that reference UI resources.""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + resource_uri: Annotated[ + OptionalNullable[str], pydantic.Field(alias="resourceUri") + ] = UNSET + + visibility: OptionalNullable[List[Visibility]] = 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(["resourceUri", "visibility"]) + nullable_fields = set(["resourceUri", "visibility"]) + 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 + + +try: + MCPUIToolMeta.model_rebuild() +except NameError: + pass diff --git a/src/mistralai/client/models/toolannotations.py b/src/mistralai/client/models/toolannotations.py new file mode 100644 index 00000000..b2e9b948 --- /dev/null +++ b/src/mistralai/client/models/toolannotations.py @@ -0,0 +1,126 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# @generated-id: 2ae257a35b01 + +from __future__ import annotations +from mistralai.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import ConfigDict, model_serializer +from typing import Any, Dict +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ToolAnnotationsTypedDict(TypedDict): + r"""Additional properties describing a Tool to clients. + + NOTE: all properties in ToolAnnotations are **hints**. + They are not guaranteed to provide a faithful description of + tool behavior (including descriptive properties like `title`). + + Clients should never make tool use decisions based on ToolAnnotations + received from untrusted servers. + """ + + title: NotRequired[Nullable[str]] + read_only_hint: NotRequired[Nullable[bool]] + destructive_hint: NotRequired[Nullable[bool]] + idempotent_hint: NotRequired[Nullable[bool]] + open_world_hint: NotRequired[Nullable[bool]] + + +class ToolAnnotations(BaseModel): + r"""Additional properties describing a Tool to clients. + + NOTE: all properties in ToolAnnotations are **hints**. + They are not guaranteed to provide a faithful description of + tool behavior (including descriptive properties like `title`). + + Clients should never make tool use decisions based on ToolAnnotations + received from untrusted servers. + """ + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + title: OptionalNullable[str] = UNSET + + read_only_hint: Annotated[ + OptionalNullable[bool], pydantic.Field(alias="readOnlyHint") + ] = UNSET + + destructive_hint: Annotated[ + OptionalNullable[bool], pydantic.Field(alias="destructiveHint") + ] = UNSET + + idempotent_hint: Annotated[ + OptionalNullable[bool], pydantic.Field(alias="idempotentHint") + ] = UNSET + + open_world_hint: Annotated[ + OptionalNullable[bool], pydantic.Field(alias="openWorldHint") + ] = 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( + [ + "title", + "readOnlyHint", + "destructiveHint", + "idempotentHint", + "openWorldHint", + ] + ) + nullable_fields = set( + [ + "title", + "readOnlyHint", + "destructiveHint", + "idempotentHint", + "openWorldHint", + ] + ) + 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 + + +try: + ToolAnnotations.model_rebuild() +except NameError: + pass diff --git a/src/mistralai/client/models/toolexecution.py b/src/mistralai/client/models/toolexecution.py new file mode 100644 index 00000000..9c55e7bb --- /dev/null +++ b/src/mistralai/client/models/toolexecution.py @@ -0,0 +1,87 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# @generated-id: 69fcb691327a + +from __future__ import annotations +from mistralai.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +import pydantic +from pydantic import ConfigDict, model_serializer +from typing import Any, Dict, Literal, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +TaskSupport = Union[ + Literal[ + "forbidden", + "optional", + "required", + ], + UnrecognizedStr, +] + + +class ToolExecutionTypedDict(TypedDict): + r"""Execution-related properties for a tool.""" + + task_support: NotRequired[Nullable[TaskSupport]] + + +class ToolExecution(BaseModel): + r"""Execution-related properties for a tool.""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + task_support: Annotated[ + OptionalNullable[TaskSupport], pydantic.Field(alias="taskSupport") + ] = 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(["taskSupport"]) + nullable_fields = set(["taskSupport"]) + 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 + + +try: + ToolExecution.model_rebuild() +except NameError: + pass diff --git a/src/mistralai/client/models/tooltype.py b/src/mistralai/client/models/tooltype.py new file mode 100644 index 00000000..1a7781fc --- /dev/null +++ b/src/mistralai/client/models/tooltype.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# @generated-id: cbe8c44aee50 + +from __future__ import annotations +from mistralai.client.types import UnrecognizedStr +from typing import Literal, Union + + +ToolType = Union[ + Literal[ + "rag", + "image", + "code", + "event", + ], + UnrecognizedStr, +] diff --git a/src/mistralai/client/models/turbinetoollocale.py b/src/mistralai/client/models/turbinetoollocale.py new file mode 100644 index 00000000..42682ee1 --- /dev/null +++ b/src/mistralai/client/models/turbinetoollocale.py @@ -0,0 +1,75 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# @generated-id: 2699936a7546 + +from __future__ import annotations +from mistralai.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Dict +from typing_extensions import NotRequired, TypedDict + + +class TurbineToolLocaleTypedDict(TypedDict): + name: NotRequired[Nullable[Dict[str, str]]] + description: NotRequired[Nullable[Dict[str, str]]] + usage_sentence: NotRequired[Nullable[Dict[str, str]]] + working_description: NotRequired[Nullable[Dict[str, str]]] + done_description: NotRequired[Nullable[Dict[str, str]]] + + +class TurbineToolLocale(BaseModel): + name: OptionalNullable[Dict[str, str]] = UNSET + + description: OptionalNullable[Dict[str, str]] = UNSET + + usage_sentence: OptionalNullable[Dict[str, str]] = UNSET + + working_description: OptionalNullable[Dict[str, str]] = UNSET + + done_description: OptionalNullable[Dict[str, str]] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "name", + "description", + "usage_sentence", + "working_description", + "done_description", + ] + ) + nullable_fields = set( + [ + "name", + "description", + "usage_sentence", + "working_description", + "done_description", + ] + ) + 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/mistralai/client/models/turbinetoolmeta.py b/src/mistralai/client/models/turbinetoolmeta.py new file mode 100644 index 00000000..bcd4d5f2 --- /dev/null +++ b/src/mistralai/client/models/turbinetoolmeta.py @@ -0,0 +1,57 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# @generated-id: cdb07c3837f7 + +from __future__ import annotations +from .tooltype import ToolType +from .turbinetoollocale import TurbineToolLocale, TurbineToolLocaleTypedDict +from mistralai.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing_extensions import NotRequired, TypedDict + + +class TurbineToolMetaTypedDict(TypedDict): + locale: NotRequired[Nullable[TurbineToolLocaleTypedDict]] + tool_type: NotRequired[Nullable[ToolType]] + timeout: NotRequired[Nullable[float]] + private_execution: NotRequired[Nullable[bool]] + + +class TurbineToolMeta(BaseModel): + locale: OptionalNullable[TurbineToolLocale] = UNSET + + tool_type: OptionalNullable[ToolType] = UNSET + + timeout: OptionalNullable[float] = UNSET + + private_execution: OptionalNullable[bool] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["locale", "tool_type", "timeout", "private_execution"]) + nullable_fields = set(["locale", "tool_type", "timeout", "private_execution"]) + 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/mistralai/client/speech.py b/src/mistralai/client/speech.py index e548df44..fe57e2fa 100644 --- a/src/mistralai/client/speech.py +++ b/src/mistralai/client/speech.py @@ -8,7 +8,7 @@ from mistralai.client.types import OptionalNullable, UNSET from mistralai.client.utils import eventstreaming, get_security_from_env from mistralai.client.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Dict, Mapping, Optional, Union +from typing import Any, Dict, Literal, Mapping, Optional, Union, overload class CompleteAcceptEnum(str, Enum): @@ -17,6 +17,78 @@ class CompleteAcceptEnum(str, Enum): class Speech(BaseSDK): + @overload + def complete( + self, + *, + input: str, + model: OptionalNullable[str] = UNSET, + metadata: OptionalNullable[ + Union[models.MetadataDict, models.MetadataDictTypedDict] + ] = UNSET, + stream: Union[Literal[False], None] = None, + voice_id: OptionalNullable[str] = UNSET, + ref_audio: OptionalNullable[str] = UNSET, + response_format: Optional[models.SpeechOutputFormat] = None, + additional_properties: Optional[Dict[str, Any]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.SpeechResponse: + r"""Speech + + :param input: Text to generate a speech from + :param model: + :param metadata: + :param stream: + :param voice_id: The preset or custom voice to use for generating the speech. + :param ref_audio: The audio reference for generating the speech. + :param response_format: + :param additional_properties: + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param accept_header_override: Override the default accept header for this method + :param http_headers: Additional headers to set or replace on requests. + """ + + @overload + def complete( + self, + *, + input: str, + model: OptionalNullable[str] = UNSET, + metadata: OptionalNullable[ + Union[models.MetadataDict, models.MetadataDictTypedDict] + ] = UNSET, + stream: Literal[True], + voice_id: OptionalNullable[str] = UNSET, + ref_audio: OptionalNullable[str] = UNSET, + response_format: Optional[models.SpeechOutputFormat] = None, + additional_properties: Optional[Dict[str, Any]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> eventstreaming.EventStream[models.SpeechStreamEvents]: + r"""Speech + + :param input: Text to generate a speech from + :param model: + :param metadata: + :param stream: + :param voice_id: The preset or custom voice to use for generating the speech. + :param ref_audio: The audio reference for generating the speech. + :param response_format: + :param additional_properties: + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param accept_header_override: Override the default accept header for this method + :param http_headers: Additional headers to set or replace on requests. + """ + def complete( self, *, @@ -33,7 +105,6 @@ def complete( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, - accept_header_override: Optional[CompleteAcceptEnum] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> models.SpeechV1AudioSpeechPostResponse: r"""Speech @@ -85,9 +156,7 @@ def complete( request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", - accept_header_value=accept_header_override.value - if accept_header_override is not None - else "application/json;q=1, text/event-stream;q=0", + accept_header_value="text/event-stream" if stream else "application/json", http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( @@ -149,6 +218,78 @@ def complete( http_res_text = utils.stream_to_text(http_res) raise errors.SDKError("Unexpected response received", http_res, http_res_text) + @overload + async def complete_async( + self, + *, + input: str, + model: OptionalNullable[str] = UNSET, + metadata: OptionalNullable[ + Union[models.MetadataDict, models.MetadataDictTypedDict] + ] = UNSET, + stream: Union[Literal[False], None] = None, + voice_id: OptionalNullable[str] = UNSET, + ref_audio: OptionalNullable[str] = UNSET, + response_format: Optional[models.SpeechOutputFormat] = None, + additional_properties: Optional[Dict[str, Any]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.SpeechResponse: + r"""Speech + + :param input: Text to generate a speech from + :param model: + :param metadata: + :param stream: + :param voice_id: The preset or custom voice to use for generating the speech. + :param ref_audio: The audio reference for generating the speech. + :param response_format: + :param additional_properties: + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param accept_header_override: Override the default accept header for this method + :param http_headers: Additional headers to set or replace on requests. + """ + + @overload + async def complete_async( + self, + *, + input: str, + model: OptionalNullable[str] = UNSET, + metadata: OptionalNullable[ + Union[models.MetadataDict, models.MetadataDictTypedDict] + ] = UNSET, + stream: Literal[True], + voice_id: OptionalNullable[str] = UNSET, + ref_audio: OptionalNullable[str] = UNSET, + response_format: Optional[models.SpeechOutputFormat] = None, + additional_properties: Optional[Dict[str, Any]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> eventstreaming.EventStreamAsync[models.SpeechStreamEvents]: + r"""Speech + + :param input: Text to generate a speech from + :param model: + :param metadata: + :param stream: + :param voice_id: The preset or custom voice to use for generating the speech. + :param ref_audio: The audio reference for generating the speech. + :param response_format: + :param additional_properties: + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param accept_header_override: Override the default accept header for this method + :param http_headers: Additional headers to set or replace on requests. + """ + async def complete_async( self, *, @@ -165,7 +306,6 @@ async def complete_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, - accept_header_override: Optional[CompleteAcceptEnum] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> models.SpeechV1AudioSpeechPostResponse: r"""Speech @@ -217,9 +357,7 @@ async def complete_async( request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", - accept_header_value=accept_header_override.value - if accept_header_override is not None - else "application/json;q=1, text/event-stream;q=0", + accept_header_value="text/event-stream" if stream else "application/json", http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( diff --git a/uv.lock b/uv.lock index 95bce4fa..3769cd61 100644 --- a/uv.lock +++ b/uv.lock @@ -560,7 +560,7 @@ wheels = [ [[package]] name = "mistralai" -version = "2.1.2" +version = "2.1.3" source = { editable = "." } dependencies = [ { name = "eval-type-backport" },