diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index aa443ef1..baa46296 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.761.1 +speakeasyVersion: 1.763.6 sources: mistral-azure-source: sourceNamespace: mistral-openapi-azure @@ -9,11 +9,11 @@ sources: - speakeasy-sdk-regen-1773084953 mistral-google-cloud-source: sourceNamespace: mistral-openapi-google-cloud - sourceRevisionDigest: sha256:b2406e82ec4ce411afc0c307d5a037c7737388bcc696bbb41884fe54e22831c9 - sourceBlobDigest: sha256:795c0e010501e770b07cd28f1d0253cdb8f1419381e828b26575fdf149c022da + sourceRevisionDigest: sha256:34edde5edcaf43acc036c9635cf4c60ce4e86f49b3fa2bed8960b995454e8d7c + sourceBlobDigest: sha256:4e9e44f332073700612c1311c0d844241cc4b206140b82d5951879e1efdb0f2d tags: - latest - - speakeasy-sdk-regen-1773084660 + - speakeasy-mistralai-gcp-sdk-26292830187-1 mistral-openapi: sourceNamespace: mistral-openapi sourceRevisionDigest: sha256:6b325264f8e8a60caa875776438b07d4eb5b56283da0796b283e9c5597810e22 @@ -31,10 +31,10 @@ targets: mistralai-gcp-sdk: source: mistral-google-cloud-source sourceNamespace: mistral-openapi-google-cloud - sourceRevisionDigest: sha256:b2406e82ec4ce411afc0c307d5a037c7737388bcc696bbb41884fe54e22831c9 - sourceBlobDigest: sha256:795c0e010501e770b07cd28f1d0253cdb8f1419381e828b26575fdf149c022da + sourceRevisionDigest: sha256:34edde5edcaf43acc036c9635cf4c60ce4e86f49b3fa2bed8960b995454e8d7c + sourceBlobDigest: sha256:4e9e44f332073700612c1311c0d844241cc4b206140b82d5951879e1efdb0f2d codeSamplesNamespace: mistral-openapi-google-cloud-code-samples - codeSamplesRevisionDigest: sha256:c5a968a0454378d7f03ace500b309c0c709ea0b88d79700091d9ca7ea82c55a2 + codeSamplesRevisionDigest: sha256:5da37f5c1b536a390868432838e6bcb81db4a4701a44b28f19c6ebb64c3c499f mistralai-sdk: source: mistral-openapi sourceNamespace: mistral-openapi @@ -44,7 +44,7 @@ targets: codeSamplesRevisionDigest: sha256:95c443855a95966259bd108beec0cbdb8238f6f753dc4b021bf833d398e86c0c workflow: workflowVersion: 1.0.0 - speakeasyVersion: 1.761.1 + speakeasyVersion: 1.763.6 sources: mistral-azure-source: inputs: diff --git a/packages/gcp/.speakeasy/gen.lock b/packages/gcp/.speakeasy/gen.lock index 08289d3a..eb166f15 100644 --- a/packages/gcp/.speakeasy/gen.lock +++ b/packages/gcp/.speakeasy/gen.lock @@ -1,48 +1,49 @@ lockVersion: 2.0.0 id: ec60f2d8-7869-45c1-918e-773d41a8cf74 management: - docChecksum: 6f32cd54fc5f3d2a609ff3933cbf34b8 + docChecksum: 77634408b308396940276ab2a5724949 docVersion: 1.0.0 - speakeasyVersion: 1.729.0 - generationVersion: 2.841.0 - releaseVersion: 2.0.0 - configChecksum: d208fbfc438189901f0d6546484d5f26 + speakeasyVersion: 1.763.6 + generationVersion: 2.884.13 + releaseVersion: 2.1.0 + configChecksum: f42a555f90ecca4a17e379c855efcb4b repoURL: https://github.com/mistralai/client-python.git repoSubDirectory: packages/gcp installationURL: https://github.com/mistralai/client-python.git#subdirectory=packages/gcp published: true persistentEdits: - generation_id: 4c7dd269-a55c-4b55-a90a-e8fec97c6b98 - pristine_commit_hash: 81f2700802a475a353aad9d56a4a9845f061ce74 - pristine_tree_hash: 0984d2a0c850ed3ed1b0ca1e96672c03a46be7d5 + generation_id: d5b7efd4-ee87-4b61-ac4b-42d3fa6730b5 + pristine_commit_hash: 67ca27bd960456dc9531c66d0fb44f21c723b80e + pristine_tree_hash: dc9cd254e0158ad038f5096a54e2c0a6131da35b features: python: additionalDependencies: 1.0.0 additionalProperties: 1.0.1 configurableModuleName: 0.2.0 constsAndDefaults: 1.0.7 - core: 6.0.12 + core: 6.0.22 defaultEnabledRetries: 0.2.0 - enumUnions: 0.1.0 - envVarSecurityUsage: 0.3.2 - examples: 3.0.2 + enumUnions: 0.1.1 + envVarSecurityUsage: 0.3.3 + examples: 3.0.4 flatRequests: 1.0.1 - globalSecurity: 3.0.5 + globalSecurity: 3.0.7 globalSecurityCallbacks: 1.0.0 globalSecurityFlattening: 1.0.0 - globalServerURLs: 3.2.0 + globalServerURLs: 3.2.1 includes: 3.0.0 methodArguments: 1.0.2 nameOverrides: 3.0.3 nullables: 1.0.2 openEnums: 1.0.4 + operationTimeout: 0.3.1 responseFormat: 1.1.0 - retries: 3.0.4 + retries: 3.0.5 sdkHooks: 1.2.1 - serverEvents: 1.0.13 + serverEvents: 1.0.15 serverEventsSentinels: 0.1.0 serverIDs: 3.0.0 - unions: 3.1.4 + unions: 3.1.5 trackedFiles: .gitattributes: id: 24139dae6567 @@ -56,6 +57,10 @@ trackedFiles: id: 7fe2e5327e07 last_write_checksum: sha1:277a46811144643262651853dc6176d21b33573e pristine_git_object: 712a148c3e2305dca4c702851865f9f8c8e674cc + docs/models/apikeyauth.md: + id: 529789e1b079 + last_write_checksum: sha1:edb801076d411a5d6c1f7a3f4fdb4c3612b12ab1 + pristine_git_object: 1fbff10e21eb51df061790f0215cb4916318ebc1 docs/models/arguments.md: id: 7ea5e33709a7 last_write_checksum: sha1:09eea126210d7fd0353e60a76bf1dbed173f13ec @@ -68,22 +73,26 @@ trackedFiles: id: 9f1795bbe642 last_write_checksum: sha1:1ce4066623a8d62d969e5ed3a088d73a9ba26643 pristine_git_object: 047b7cf95f4db203bf2c501680b73ca0562a122d + docs/models/authorization.md: + id: dec4d9809e25 + last_write_checksum: sha1:6bf766a7b49ca2b706bb4eb88ba2d56406e06e1e + pristine_git_object: 11ea5c6a700e7b92f5cbd29e88e41b834f8b8ef4 docs/models/builtinconnectors.md: id: 9d14e972f08a - last_write_checksum: sha1:1f32eb515e32c58685d0bdc15de09656194c508c - pristine_git_object: f96f50444aaa23ca291db2fd0dc69db0d9d149d9 + last_write_checksum: sha1:83b573a69c86ab00e8660c7b6c02c14fdb8e1459 + pristine_git_object: ad9b9823d7e76bb827524701e9995a40dfa83147 docs/models/chatcompletionchoice.md: id: 0d15c59ab501 - last_write_checksum: sha1:a6274a39a4239e054816d08517bf8507cb5c4564 - pristine_git_object: deaa0ea073e1b6c21bd466c10db31db2464066f1 + last_write_checksum: sha1:f3c9fa3cc092674a36bf28552b6900d62871b789 + pristine_git_object: 79d24a335c7ca1acb1469213d60ced2ec4987461 docs/models/chatcompletionchoicefinishreason.md: id: 225764da91d3 - last_write_checksum: sha1:b894d3408cb801e072c3c302a5676ff939d59284 - pristine_git_object: b2f15ecbe88328de95b4961ddb3940fd8a6ee64b + last_write_checksum: sha1:9a0715ecc16437ce4411743e852d8438a313cd41 + pristine_git_object: 53290d8eab975e171c02064fc34097f598633e17 docs/models/chatcompletionrequest.md: id: adffe90369d0 - last_write_checksum: sha1:6374e05aeb66d48137d657acaa89527df2db35c6 - pristine_git_object: 8dbd4a82ad1d7725b9a6ce56daea208ca01b9210 + last_write_checksum: sha1:195c1c434fefe7a6d684622bdd55acc716bef7b5 + pristine_git_object: db61b5c0deafb18c5133e07b9ba69d2b1e8adfe1 docs/models/chatcompletionrequestmessage.md: id: 3f5e170d418c last_write_checksum: sha1:7921c5a508a9f88adc01caab34e26182b8035607 @@ -92,6 +101,10 @@ trackedFiles: id: fcaf5bbea451 last_write_checksum: sha1:71a25f84f0d88c7acf72e801ced6159546201851 pristine_git_object: 749296d420c0671d2a1d6d22483b51f577a86485 + docs/models/chatcompletionrequesttool.md: + id: 01554a1b158a + last_write_checksum: sha1:e7259e65ba3c614e5e70d0d55c88db03e90097d0 + pristine_git_object: 572d12ca006caead244387a5e91000ac33b0aa0e docs/models/chatcompletionrequesttoolchoice.md: id: b97041b2f15b last_write_checksum: sha1:7ad7eb133f70e07d0d6a9def36aadd08b35cf861 @@ -102,8 +115,8 @@ trackedFiles: pristine_git_object: a0465ffbfc5558628953e03fbc53b80bbdc8649b docs/models/chatcompletionstreamrequest.md: id: cf8f29558a68 - last_write_checksum: sha1:e23cf88a5a9b0c99e68d06a8450b8bfb9aee33a2 - pristine_git_object: db76b6c81a71607f94c212a542fe30e082053a90 + last_write_checksum: sha1:3901c8c3e8b2cba3d2510f61e18f47edfda86f7e + pristine_git_object: bd19d37b64d30b110596e438c425c36372faf6e9 docs/models/chatcompletionstreamrequestmessage.md: id: 053a98476cd2 last_write_checksum: sha1:8270692463fab1243d9de4bbef7162daa64e52c5 @@ -112,10 +125,18 @@ trackedFiles: id: d0e89a4dca78 last_write_checksum: sha1:a889e9580fa94bda7c848682d6ba501b7f5c0f41 pristine_git_object: a48460a92ac47fec1de2188ba46b238229736d32 + docs/models/chatcompletionstreamrequesttool.md: + id: cbfb16fb3b03 + last_write_checksum: sha1:163ad1e31d7ba4eaef7797b399d1323465e97110 + pristine_git_object: 48998fcbb16a8ce5f5a4fd8b2794125d97e935ac docs/models/chatcompletionstreamrequesttoolchoice.md: id: 210d5e5b1413 last_write_checksum: sha1:0543164caf3f4fb2bef3061dbd1a5e6b34b17ae9 pristine_git_object: 43f3ca3809bf1a2a040e2ad7c19a2b22db0b73f8 + docs/models/codeinterpretertool.md: + id: f009740c6e54 + last_write_checksum: sha1:a2114d61a98a48b4365a77c0c75c06ca834367ad + pristine_git_object: 6302fc627d7c49442b6c9aec19c70fdceaf7c519 docs/models/completionchunk.md: id: 60cb30423c60 last_write_checksum: sha1:61b976fe2e71236cf7941ee1635decc31bd304b2 @@ -130,8 +151,8 @@ trackedFiles: pristine_git_object: 1532c25b8fc065d486f52d4610a7f757e5340875 docs/models/completionresponsestreamchoicefinishreason.md: id: 5f1fbfc90b8e - last_write_checksum: sha1:20824b4a223cbd3658b32440973a7d47dcd108b9 - pristine_git_object: 0fece473297227c75db4e7ded63417a2f117cac0 + last_write_checksum: sha1:0d6278fdfec974d1e8782c5bfca0fad5300a2125 + pristine_git_object: 7b37dc06c1d30d19ae969fde2170d0cc3ad052ef docs/models/contentchunk.md: id: d2d3a32080cd last_write_checksum: sha1:5839a26cdc412b78caad7fb59df97bdcea57be6d @@ -140,18 +161,26 @@ trackedFiles: id: e8f2f9e54b8e last_write_checksum: sha1:4c14b386f9f89d98f4dd9487ab030f10478c0e63 pristine_git_object: 107f1bd428b1f39b36f75e5a10532bc462967ce5 + docs/models/customconnector.md: + id: 7bcc77607afa + last_write_checksum: sha1:ce9e8ffac3f83e08269fbed5d2dffbfeb9f8649a + pristine_git_object: 0a0b69217abb0fbcbe30fad32c239aea070d3740 docs/models/deltamessage.md: id: 6c5ed6b60968 - last_write_checksum: sha1:00052476b9b2474dbc149f18dd18c71c86d0fc74 - pristine_git_object: e0ee575f3fce7c312114ce8c5390efc5c4854952 + last_write_checksum: sha1:c49575abe1bb581db1ae497b7a3b1ff2820abfbc + pristine_git_object: c2395e1bb06f983a2f56ab5900f126ed99ae9c11 docs/models/deltamessagecontent.md: id: 7307bedc8733 last_write_checksum: sha1:a1211b8cb576ad1358e68983680ee326c3920a5e pristine_git_object: 8142772d7ea33ad8a75cf9cf822564ba3f630de2 + docs/models/documentlibrarytool.md: + id: 68083b0ef8f3 + last_write_checksum: sha1:76b9f47c399915a338abe929cb10c1b37282eadf + pristine_git_object: 95c3fa52ee3ff29e72bc0240a98c0afaa0cd5f62 docs/models/fimcompletionrequest.md: id: b44677ecc293 - last_write_checksum: sha1:24bcb54d39b3fabd487549a27b4c0a65dd5ffe50 - pristine_git_object: fde0b625c29340e8dce1eb3026ce644b1885e53a + last_write_checksum: sha1:87a83a59fb3772ca6c7e60bcef27ca15f349ce46 + pristine_git_object: c0c52b6634c0a12b7e52686875805164d99b4c64 docs/models/fimcompletionrequeststop.md: id: ea5475297a83 last_write_checksum: sha1:a6cdb4bda01ac58016a71f35da48a5d10df11623 @@ -162,8 +191,8 @@ trackedFiles: pristine_git_object: cd62d0349503fd8b13582d0ba47ab9cff40f6b28 docs/models/fimcompletionstreamrequest.md: id: c881d7e27637 - last_write_checksum: sha1:f8755bc554dd44568c42eb5b6dde04db464647ab - pristine_git_object: ba62d854f030390418597cbd8febae0e1ce27ea8 + last_write_checksum: sha1:3574398ad561e06a8c2c95ffcb1456fe62cf7320 + pristine_git_object: c02b622c7e4113d7ca99ede3d735f17dc2ab26e7 docs/models/fimcompletionstreamrequeststop.md: id: c97a11b764e9 last_write_checksum: sha1:958d5087050fdeb128745884ebcf565b4fdc3886 @@ -180,18 +209,26 @@ trackedFiles: id: 4b3bd62c0f26 last_write_checksum: sha1:754fe32bdffe53c1057b302702f5516f4e551cfb pristine_git_object: 87d7b4852de629015166605b273deb9341202dc0 + docs/models/guardrailconfig.md: + id: f60bf2eefb45 + last_write_checksum: sha1:e8dd384d2fd18d731753ba8d45a2975379c97052 + pristine_git_object: 1276462cc43fbd940f12282b1dca05e6fc7a16f9 docs/models/imagedetail.md: id: f8217529b496 - last_write_checksum: sha1:fdf19ac9459f64616240955cb81a84ef03e775c8 - pristine_git_object: 1e5ba3fd405a14e5e2872cc85504584dca19b726 + last_write_checksum: sha1:165fedf9506a2cef070fd6d910beef431dd2f32d + pristine_git_object: 15cc63e77da0ae4fa6926b8045f58678dff91265 + docs/models/imagegenerationtool.md: + id: d5deb6b06d28 + last_write_checksum: sha1:a1813ef99e4a0990fd073bb2311c475e88072029 + pristine_git_object: b476b6f2733a49767d7f7a4ad091fc321ab514f4 docs/models/imageurl.md: id: e75dd23cec1d last_write_checksum: sha1:a5cf621ce58a9cc7c96afa7de53367eac7b4cb0b pristine_git_object: 6358e0acb2dea4816203413842243704ca955783 docs/models/imageurlchunk.md: id: 4407097bfff3 - last_write_checksum: sha1:30b72826963e22cadf76ac0b7604288dbc4fb943 - pristine_git_object: a84dac32b99390e3fd0559714ca43795742192c6 + last_write_checksum: sha1:705bdd81424cc35eeba9f280dda5124d8091d1af + pristine_git_object: 73e1ed5a07333e86310575a80a7baa61dadd61bf docs/models/imageurlunion.md: id: 9d3c691a9db0 last_write_checksum: sha1:4e32bcd7d44746d2ddbfafbef96152bb2bdb2a15 @@ -206,24 +243,56 @@ trackedFiles: pristine_git_object: d6094ac2c6e0326c039dad2f6b89158694ef6aa7 docs/models/mistralpromptmode.md: id: d17d5db4d3b6 - last_write_checksum: sha1:abcb7205c5086169c7d9449d15ac142448a7d258 - pristine_git_object: c3409d03b9646e21a3793372d06dcae6fef95463 + last_write_checksum: sha1:d6b2f03f1d6999a77991735ef1f86ff6cf3f7bd0 + pristine_git_object: 921f81a4379b6a20fab6e97a942023f27ff2eff1 + docs/models/moderationllmaction.md: + id: 26373b4ad9cd + last_write_checksum: sha1:8687fc217e476dab04380a72720a546d1ba94c67 + pristine_git_object: e0077a32956f08393fc440364384f580317625cc + docs/models/moderationllmv1categorythresholds.md: + id: b474ca28a6e7 + last_write_checksum: sha1:9080b6f5a7a6a00ed04c1cb32a43cb997cbeb5d5 + pristine_git_object: 90ae213feda5e63ad71fbd7bb0bfb07ee7b1e2c1 + docs/models/moderationllmv1config.md: + id: e39a45c3e458 + last_write_checksum: sha1:63b7677d0b488d44312417d9335abd595f9b6fa9 + pristine_git_object: bdb5812b87a69af904eb9cdc0fffff6e73d96cd3 + docs/models/moderationllmv2categorythresholds.md: + id: 401d3285071c + last_write_checksum: sha1:6fbfadaba4db8bed9fc7d38ad77cd47a089dd5f0 + pristine_git_object: e95b81b0315cf77724d027dbf8ff0f524ad1d068 + docs/models/moderationllmv2config.md: + id: 64c1e213e7cc + last_write_checksum: sha1:851923395e5a4097b82d184e070a85bf648a9e8c + pristine_git_object: e928506c8d210b865e8aee9739a35433ca136872 + docs/models/oauth2tokenauth.md: + id: f23959dcc4b0 + last_write_checksum: sha1:ca434f8479c3f5e868db1269e86efa5e0d9070e2 + pristine_git_object: 89f80436474e3c2293bb4fcafce11e626e2cdf79 docs/models/prediction.md: id: 3c70b2262201 last_write_checksum: sha1:ca8a77219e6113f2358a5363e935288d90df0725 pristine_git_object: fae3c1ca4ba2c2ddb3b7de401ecdc8d56dcc7740 + docs/models/reasoningeffort.md: + id: c8fd630d3f07 + last_write_checksum: sha1:b0933ea955ebeacb7fcbdf59be935216d2ab999b + pristine_git_object: 87e0ae7696172b508326028224b10de557057ad7 docs/models/referencechunk.md: id: 07895f9debfd - last_write_checksum: sha1:4384049375a2566c7567599f97ce1ec19e9f6276 - pristine_git_object: d847e24845a399c7ca93d54701832fb65e01b3ab + last_write_checksum: sha1:3d35227a4f7612301fd5f17a445c4c2b712f0bf1 + pristine_git_object: 0186d3c358e27d01617c982f61db0910039a049a + docs/models/referenceid.md: + id: 22fa492a467e + last_write_checksum: sha1:80161796acbc185876a3656ee8cbdde4df7e23d0 + pristine_git_object: 1d29397fd96b42b7dc33bd10184bef55de5ae066 docs/models/responseformat.md: id: 50a1e4140614 last_write_checksum: sha1:e877b2e81470ef5eec5675dfb91a47e74d5d3add pristine_git_object: 5cab22f2bf1c412699f6a7ed18ef801ecbc3ee4b docs/models/responseformats.md: id: cf1f250b82db - last_write_checksum: sha1:105e1f9181913104b554051838cbdd0f728aa2c4 - pristine_git_object: 2f5f1e5511b048323fee18a0ffdd506fe2b3d56f + last_write_checksum: sha1:947c2b47f8a73e5c299585c1109bad626675112e + pristine_git_object: 5d9aeb3e9193e621df527095aedd26fbf5ec5096 docs/models/security.md: id: 452e4d4eb67a last_write_checksum: sha1:ce2871b49c1632d50e22d0b1ebe4999021d52313 @@ -246,28 +315,32 @@ trackedFiles: pristine_git_object: b266619dcb57222ec343f373c43b2b5cef5b8b93 docs/models/thinkchunk.md: id: bca24d7153f6 - last_write_checksum: sha1:2b8ff7737fa7255673ca31da7cb2e6803fce9e02 - pristine_git_object: b07f598ebc5f0e9c041186c081dc98bc21104bdb + last_write_checksum: sha1:db29812dbc6f9be7a385322d25a5cd98bfb3ef1e + pristine_git_object: d825497ee09624b829965d2b5bea2ddc54a32608 docs/models/thinking.md: id: 07234f8dd364 last_write_checksum: sha1:90c0b34284137712678b0671e9f4bfb319548cbf pristine_git_object: d9e51d7dc93b24edd807b018393eab38143d46f4 docs/models/tool.md: id: 8966139dbeed - last_write_checksum: sha1:1725bf53fc9f1ca3f332322d91de24c9d58adc6a - pristine_git_object: fb661f72887271d5bb470e4edf025a32b00ade17 + last_write_checksum: sha1:2ab2016846da06ab38751176ba80fb6527c2818b + pristine_git_object: 85888d01cf439be601c8d1df4048c90161cf47df docs/models/toolcall.md: id: 80892ea1a051 - last_write_checksum: sha1:cb27b9d36cfe6227978c7a7a01b1349b6bac99d9 - pristine_git_object: 3819236b9f3eee2f6878818cfbbe2817e97f7de2 + last_write_checksum: sha1:621dc83981e13cbcbc21f2e16a34178c322c4566 + pristine_git_object: 9d236e8b289977d2aa7bded0d633b224c5ec9e57 docs/models/toolchoice.md: id: "097076343426" - last_write_checksum: sha1:25b33b34da02c3b46349dc8b6223f9ae18370d16 - pristine_git_object: 373046bbbc834169293b4f4ae8b2e238f952ddde + last_write_checksum: sha1:65a2794a1102fdcba6fa5a3f497630fbaf98f94b + pristine_git_object: a457f96f6e295d590a5ef75f83a5a6c4fdd41c47 docs/models/toolchoiceenum.md: id: 15410de51ffc - last_write_checksum: sha1:ca0cf9bf128bebc8faedd9333cc6a56b30f58130 - pristine_git_object: 0be3d6c54b13a8bf30773398a2c12e0d30d3ae58 + last_write_checksum: sha1:8b5e1a5e3df1e72baad48cd526299a31dc766e39 + pristine_git_object: c97bf91224c7bbb1e5f35d6d9da737313bfd1296 + docs/models/toolconfiguration.md: + id: 06bfa2c4e662 + last_write_checksum: sha1:9b619977375f228c76f09d48d6e2833add6c07e2 + pristine_git_object: 89286a172124ce3473bcb081de6e4db8c95afefa docs/models/toolmessage.md: id: 0553747c37a1 last_write_checksum: sha1:ac61e644ba7c6da607cb479eafd1db78d8e8012e @@ -278,16 +351,12 @@ trackedFiles: pristine_git_object: 5c76091fbd2c8e0d768921fab19c7b761df73411 docs/models/toolreferencechunk.md: id: 10414b39b7b3 - last_write_checksum: sha1:a0e93881de5ecaf765300d45a18ab21dcffe54f9 - pristine_git_object: 9fc10399fe4ce9eb3b5e87a6bc609643d6a2cb3a - docs/models/tooltypes.md: - id: adb50fe63ea2 - last_write_checksum: sha1:f224c3d8732450b9c969b3e04027b7df7892694c - pristine_git_object: 84e49253c9b9bd1bd314e2a126106404cbb52f16 - docs/models/toolunion.md: - id: ad708b0ce4e0 - last_write_checksum: sha1:61909a56240c784e05f13dff8d9787272e1aa8bc - pristine_git_object: 2dcb3deec9f05d1e578c485a47a8ddd10b375f48 + last_write_checksum: sha1:ea3bdfc83177c6b7183ad51fddb2d15aee0f0729 + pristine_git_object: 49ea4ca7b05e5fcaaf914f781e3a28483199d82d + docs/models/toolreferencechunktool.md: + id: c2210d74792a + last_write_checksum: sha1:368add3ac6df876bc85bb4968de840ac578ae623 + pristine_git_object: 999f7c34885015a687c4213d067b144f1585c946 docs/models/usageinfo.md: id: ec6fe65028a9 last_write_checksum: sha1:cf71fb9676d870eba7c4d10a69636e1db4054adc @@ -308,6 +377,14 @@ trackedFiles: id: 304bdf06ef8b last_write_checksum: sha1:1f297f34069668f6107f2c0389606efe413ff5a8 pristine_git_object: 5bcea5b5d12e72222720af2c014d64ec4bdfee4a + docs/models/websearchpremiumtool.md: + id: 267988aa8c3f + last_write_checksum: sha1:38f80a43f73a13ddedc7730f853c092a48b665f9 + pristine_git_object: 78b736cd314617caa0d77f3c42015212e37ab539 + docs/models/websearchtool.md: + id: fc4df52fb9b5 + last_write_checksum: sha1:72636dc7ae74264bb5158d284ef6f83da5290b27 + pristine_git_object: 4ca7333c412ad819e3e02c61debe402e3f9b0af9 py.typed: id: 258c3ed47ae4 last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 @@ -316,10 +393,6 @@ trackedFiles: id: 7ce8b9f946e6 last_write_checksum: sha1:8f871a5aac4b10bff724c9d91b8d7496eb1fbdde pristine_git_object: 0391ac11bdc5526b697b69d047d568a611ce87d0 - scripts/prepare_readme.py: - id: e0c5957a6035 - last_write_checksum: sha1:eb988bc0e00ed4bb14e9a3572845af14f06c9b42 - pristine_git_object: ae27b555c05c3c9f35d84e8bbe6a7c9f80cf94b2 scripts/publish.sh: id: fe273b08f514 last_write_checksum: sha1:b290b25b36dca3d5eb1a2e66a2e1bcf2e7326cf3 @@ -342,16 +415,16 @@ trackedFiles: pristine_git_object: ea95bed210db9180824efddfb1b3e47f5bf96489 src/mistralai/gcp/client/_version.py: id: f87319e32c7b - last_write_checksum: sha1:2c22a5ebb7568968607db20612021af35240f714 - pristine_git_object: 377c9836b5f8bdf65e87ba375232422114af2966 + last_write_checksum: sha1:a8381a446688258017504fe271c6c05db83f5b6f + pristine_git_object: e6a19a24aeb633a7c6741fac4aa1cd935f6eff3d src/mistralai/gcp/client/basesdk.py: id: 4d594572857b - last_write_checksum: sha1:d8ef9e2f4fa97d402eb9f5472ceb80fb39693991 - pristine_git_object: b3edcb0aca1882d0cbe4d499cfba9cb5464c5b58 + last_write_checksum: sha1:09816f367408668addafe77aa5f69e6a089f8fca + pristine_git_object: 1c518adee8029a46ec5d6951cc6804465e1c3355 src/mistralai/gcp/client/chat.py: id: 4c41f05f786e - last_write_checksum: sha1:60b2697e2ecfb62eebed910007e62ab1df565eec - pristine_git_object: 925d69eda2fdac458045cc12327ca72997e07600 + last_write_checksum: sha1:ab6973161c8faa694e5132d7a8838d975ec23e55 + pristine_git_object: 8a9abf59a633510f6086a520e755debd40d9b641 src/mistralai/gcp/client/errors/__init__.py: id: c51c8ed21629 last_write_checksum: sha1:29f08ad600a712ff572843a250839ef92efac19b @@ -378,76 +451,92 @@ trackedFiles: pristine_git_object: 6980924626fa5fbf67fb62a30fd23d5883dbe650 src/mistralai/gcp/client/fim.py: id: 13d2d208e0ef - last_write_checksum: sha1:1027165887446ce0764ad542ca52f61b460c71b8 - pristine_git_object: 4202102ae5218784a10ee93ada5a0643d23a1d0c + last_write_checksum: sha1:cd7d11744022f12d4fa5889746f3861a563537b6 + pristine_git_object: cd5abaf8a8174536cca8ee3e5451fe6ce0379540 src/mistralai/gcp/client/httpclient.py: id: a53dd7be6a4c last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/mistralai/gcp/client/models/__init__.py: id: d9e976d01972 - last_write_checksum: sha1:9ba03a47ef26bb6d64366ec4a2b466a6d417aa82 - pristine_git_object: e42ed4bb30a39afd1d63dc2f9918e86981f2bf94 + last_write_checksum: sha1:f4b9b23318c8e44f32d4becc4ad1afd0faee3715 + pristine_git_object: f7a311a2f7cd41b491e0b5cd4203c711b31873f6 + src/mistralai/gcp/client/models/apikeyauth.py: + id: 6b9f6832e632 + last_write_checksum: sha1:6ec18425d5aa90f6c131763d39a8bf4d74944b7d + pristine_git_object: 99d2ad79e388b0b77baafd431c890e3b9cd1032e src/mistralai/gcp/client/models/assistantmessage.py: id: d39c4bdd289e - last_write_checksum: sha1:c813783bcbeec4e40f12e007d1dde4aed8ec71cf - pristine_git_object: 702ac4708abb95fc18d138500b8353715c2dbc98 + last_write_checksum: sha1:c4714e1d6eea548e68118c44a5fcac63548c7605 + pristine_git_object: 63f3b0dd9b7348e06c63d8ac2bdcc2d7faa59853 src/mistralai/gcp/client/models/builtinconnectors.py: id: 7bbec8f3c9c7 last_write_checksum: sha1:4e94744e3854d4cdc9d1272e4f1d9371f9829a5f pristine_git_object: 6a3b2476d54096722eb3e7a271629d108028bd35 src/mistralai/gcp/client/models/chatcompletionchoice.py: id: 8e65b56f3e6d - last_write_checksum: sha1:e6d1382e9f880b866130d900fd866997aaf80e45 - pristine_git_object: ae5a2fbf38afbd86233dcaa8aa1c8441f5ed9eba + last_write_checksum: sha1:022f638fc4c28e3983c804e4b24b7f7a9f6542ea + pristine_git_object: 89f4868b1262e1aac6d0898409b5d2e27ffc209a src/mistralai/gcp/client/models/chatcompletionrequest.py: id: 4694a31c0003 - last_write_checksum: sha1:80fcbbcde773c22c93cf2db63beef2cfe3777497 - pristine_git_object: 8229c5bb13ded84039f3d8ddb95ac0a9c184e1bd + last_write_checksum: sha1:298b0d06dec99a85d086b19314c3361622451bd0 + pristine_git_object: 0e3de41307489a6ee395c535ebbd42303c971c63 src/mistralai/gcp/client/models/chatcompletionresponse.py: id: dd9e4796fca9 last_write_checksum: sha1:76d7257583389ff5021e320a8f9a45a6deb07c7c pristine_git_object: 317c4d84e378c14294d58c5aefd8c55ffe28754a src/mistralai/gcp/client/models/chatcompletionstreamrequest.py: id: 7294862af8ea - last_write_checksum: sha1:899210f881bdbe0a0d94e29fe7044fabbccc578c - pristine_git_object: 3c228d2e7edf08c36f310e190a8dedc7b4958459 + last_write_checksum: sha1:6dbe04dd7c8b3f509e0ada777aac7e77c1ad4cb8 + pristine_git_object: 2adc781281387122f81527547624ac6a68a08787 + src/mistralai/gcp/client/models/codeinterpretertool.py: + id: dae8864ee549 + last_write_checksum: sha1:25508d287514c3b28f5902a84e09461e8eef595f + pristine_git_object: 9fdedce7f27cfe6fc8981cdb9fb6df8235c6da9c src/mistralai/gcp/client/models/completionchunk.py: id: 6b9ed8c30877 - last_write_checksum: sha1:f1f091e94e3c1c1aefd3c3bb60c8de8236ab0ead - pristine_git_object: a0b1ae2fa3109a2c2b76bbc483b691d88dc9a15c + last_write_checksum: sha1:c19d80a18060082a73b7e7fcc6af6fccac0cf5d6 + pristine_git_object: 3f8d8c6b62b4ba5d158e0243382110c39c1f3140 src/mistralai/gcp/client/models/completionevent.py: id: 3f55c4b8fc75 last_write_checksum: sha1:66665d921fd27df6ef0efce996a5446e49b989d8 pristine_git_object: bb1550093ce9adcb9bcd0548b69796e82f4f260b src/mistralai/gcp/client/models/completionresponsestreamchoice.py: id: ad9b98ca7e1c - last_write_checksum: sha1:c4f9d733461bdb9a0d6c96e82212de7dddc04ffe - pristine_git_object: e58d4c88009ed3696d2a3a57f3796d8fb067019d + last_write_checksum: sha1:03cf7a80e925662eff06a16e55206f0f1f9f09dd + pristine_git_object: 0f189b553a81308dca9e4a96831bbd4a8910962e src/mistralai/gcp/client/models/contentchunk.py: id: 8714d3bf2698 last_write_checksum: sha1:acab1b53b1d324544c6aa6c4126a3fb5265278d2 pristine_git_object: 18d481505e17d2125e380d796b0c406b0e66d601 + src/mistralai/gcp/client/models/customconnector.py: + id: a86074dd071e + last_write_checksum: sha1:52168a13fb6e6a4e1addd6b4efeb8448de2abbd3 + pristine_git_object: 3829972679bba9567d1277e3b6f64851d2d8f2a8 src/mistralai/gcp/client/models/deltamessage.py: id: 404fc85f1a4c - last_write_checksum: sha1:982c2d15a570c7f4d5e1c3b012db46ea3bac609b - pristine_git_object: 63e6a7f3e50c138f235f5a36277aa8668f85cef1 + last_write_checksum: sha1:7e043f7d5335255efbd80813e6cfdf44bf92bd4b + pristine_git_object: 1943aec72be09f7fafdf2e2976d4765962dbd897 + src/mistralai/gcp/client/models/documentlibrarytool.py: + id: 265f6eb0b1b0 + last_write_checksum: sha1:02390e6d5a0061a442453f588447923dfc7e17c9 + pristine_git_object: 36fb81e59dbcd42983f20df16cae29e35e81bd9d src/mistralai/gcp/client/models/fimcompletionrequest.py: id: 5b79e2595d31 - last_write_checksum: sha1:80a2e3d5e10c240869cd96c41936d714cf8bf801 - pristine_git_object: e460f76c59315c22c75194936f1f3b232331f83c + last_write_checksum: sha1:78e0ea727e094b45a444251776aaccd9d273bffe + pristine_git_object: 5b6013f6a4c11591f2c5e0c0c204845e7c2caeb6 src/mistralai/gcp/client/models/fimcompletionresponse.py: id: 402f602d29b8 last_write_checksum: sha1:cfe26848c7b14d6e374b7944d7ad44df822990b0 pristine_git_object: 5b80da3f03e4e99dfca971a53af1cf6472c889bb src/mistralai/gcp/client/models/fimcompletionstreamrequest.py: id: 31190cf25070 - last_write_checksum: sha1:a95ab8c20b2fdff48102f08258a556af9f382ffa - pristine_git_object: fffc305499e578f77e42fb7992b59e933ae0ae7c + last_write_checksum: sha1:13d68fffdc4f0984732b64d12cfcc781ace0a757 + pristine_git_object: d2e86d406c255ecf2ae0242391be81f09c377572 src/mistralai/gcp/client/models/function.py: id: 2285a899b32e - last_write_checksum: sha1:6439f7f781174ae56b2b02ccbb4d02b08d8d5a03 - pristine_git_object: 439e831355444e0f9e82d23636651201f0db4bfc + last_write_checksum: sha1:3f8f9274cb5acacabb8f5bcbfef5bf4070a8f87b + pristine_git_object: 877b72737f1b21319c3d1b20ad7d8335118e1d8b src/mistralai/gcp/client/models/functioncall.py: id: 17bb51f08e5f last_write_checksum: sha1:b5fe2f061ea5f47057ee50011babc80de27e0ee6 @@ -456,38 +545,74 @@ trackedFiles: id: 313a6001145f last_write_checksum: sha1:fe1eefaed314efa788bd15beb63bf6b81abb307e pristine_git_object: 585b9e39762e49356823e211ad86f701bca389b8 + src/mistralai/gcp/client/models/guardrailconfig.py: + id: e3ef48444e1d + last_write_checksum: sha1:4ce14efae5297fe180dfc6478bde73cf5dcd3c45 + pristine_git_object: abc5decaebbc2d40b3a578e0198c7209f93b9ca5 src/mistralai/gcp/client/models/imagedetail.py: id: a28b2f3e2cb5 last_write_checksum: sha1:a4874529961952019eaa86a2fa0989626f537a4c pristine_git_object: 68ed76080716eb1424b13f182479f57e51a4fabf + src/mistralai/gcp/client/models/imagegenerationtool.py: + id: 4839c86ce5cc + last_write_checksum: sha1:e193a8b758b91c5fa57b8839fba5f315773b6254 + pristine_git_object: e6b289207b3cae97db469a46670d0749ed5cc574 src/mistralai/gcp/client/models/imageurl.py: id: 4e330f3eae74 - last_write_checksum: sha1:6c0bee7d7c765fb2611131c7d270041671b428b8 - pristine_git_object: 903d0a1a45eeb7c5e8cde80f624b6e039de1f4cc + last_write_checksum: sha1:19cd630d12f901879c5014b550261cc2f156eb07 + pristine_git_object: 99e555985d4478c286470d7e2430848cd876cdd3 src/mistralai/gcp/client/models/imageurlchunk.py: id: e68a4a393e9b - last_write_checksum: sha1:eae1d0e69a90b2f7513492e4cd0ed68d647f0b5d - pristine_git_object: 4bec0eec882c1eeee8a80f663ff7d686ca677ea0 + last_write_checksum: sha1:54bbaac8e5f3b0d42e7da9463ebe30b6f82b2a94 + pristine_git_object: e939c34b76aeabb53d82abb42d80828010f89e78 src/mistralai/gcp/client/models/jsonschema.py: id: 39c6e7d412a0 - last_write_checksum: sha1:19b34a5e3f5c00d1a1b96f91a6e02f5ad12240c7 - pristine_git_object: 684ac09f0460bef1f26bf0030b79bbc7141ab99b + last_write_checksum: sha1:0a1f92793e57e8357d395f4d99756d1c237baa3a + pristine_git_object: f500fa5636ef18e1eb47a8ea7e7fbe023cd46025 src/mistralai/gcp/client/models/mistralpromptmode.py: id: 8be4a4a683e4 last_write_checksum: sha1:c958567e95490abf3941fde69be69733e8afb90e pristine_git_object: c765e4f1a0b86735255771231377f13d62f3d7a6 + src/mistralai/gcp/client/models/moderationllmaction.py: + id: 27fbed8d6919 + last_write_checksum: sha1:fbc27faa2fbaa51a66bee21935c4bce350291f5e + pristine_git_object: cff03d9aa6de26ce3daa9edbc065ec3f759b5ee6 + src/mistralai/gcp/client/models/moderationllmv1categorythresholds.py: + id: 9c3f2837e5c3 + last_write_checksum: sha1:bcd4b4632002d240091bcf20cc643257e8559de5 + pristine_git_object: 3f5713fe1aa8f988af9964961b803f4ad890536b + src/mistralai/gcp/client/models/moderationllmv1config.py: + id: 348cd52230bd + last_write_checksum: sha1:5f252b76d5c9fe9ebba7cb2bee49a3ab8bacb16a + pristine_git_object: 579acd736d23bb75e8aba284a261a3506e83d0b3 + src/mistralai/gcp/client/models/moderationllmv2categorythresholds.py: + id: a1f948710f49 + last_write_checksum: sha1:1ac252d7c87caf344454a2c839cddeb9e92169d9 + pristine_git_object: 8b9252604ea4786365fa1b7273d6b99acef7c134 + src/mistralai/gcp/client/models/moderationllmv2config.py: + id: 17b6f1e661fd + last_write_checksum: sha1:96fa77b745e084aa25cfb1baf7914e580b89ecc4 + pristine_git_object: 000d2e2c70accf7434f99f803e6b2d5d13ea4c2f + src/mistralai/gcp/client/models/oauth2tokenauth.py: + id: e04fbd0e98a6 + last_write_checksum: sha1:34d2464532aae4a6d025d5d87024c31ee645fca5 + pristine_git_object: d1b4c93503cf990a56ab7641f2eadf5d6d3ab4c7 src/mistralai/gcp/client/models/prediction.py: id: 7a5463285bc8 - last_write_checksum: sha1:67c4a9b06d3e98552409a26960e0afd64f829b53 - pristine_git_object: 2e325289fd6c2a987ad270fd808f7b9a3f423440 + last_write_checksum: sha1:6a375252b2c5bdad129aa10462b8ac7613ef6c1d + pristine_git_object: 1e290f334a502cc643e33f53d30695b75c93c2ec + src/mistralai/gcp/client/models/reasoningeffort.py: + id: 9e62d78449a6 + last_write_checksum: sha1:703d87ae8c89b9fa9284833c45daa77752c3a8e8 + pristine_git_object: 43ffa02b8407ab64d41f23c3a56c02fe275e38de src/mistralai/gcp/client/models/referencechunk.py: id: 523e477f8725 - last_write_checksum: sha1:aade1dc05c2a2672630eb17626e4f49367d6bfe6 - pristine_git_object: 261c4755641093a38f97b17dce3a387623e69ead + last_write_checksum: sha1:5da5e54980082fec24a7f0700d7f4fa32793d342 + pristine_git_object: eca4c4dea0f8672be08727106bdd06110ba38246 src/mistralai/gcp/client/models/responseformat.py: id: 06774bb65b42 - last_write_checksum: sha1:7e64de46ef34718003cf0d198868a193f2122178 - pristine_git_object: f3aa9930e0f8a009dac628300d66c6209a538031 + last_write_checksum: sha1:92b8c399f81f9da7ed503c5fa0c298bdf16dd49c + pristine_git_object: afd1bd307ec231be64094f7263975eb4450b9607 src/mistralai/gcp/client/models/responseformats.py: id: 18112ad0f6db last_write_checksum: sha1:a212e85d286b5b49219f57d071a2232ff8b5263b @@ -510,48 +635,56 @@ trackedFiles: pristine_git_object: 690322725c0f852a005d08c5b722c41709868b22 src/mistralai/gcp/client/models/thinkchunk.py: id: 59a1d1ef2020 - last_write_checksum: sha1:f2f07f8bf1094cff718fb0f3ef760890c54e4003 - pristine_git_object: d534fc1ecc2a127d9ac9ac3d7a7aba7156faf7c2 + last_write_checksum: sha1:5896f44bd4868c2c14b83be15e536e129ad30752 + pristine_git_object: 34397d30a28dd42d06617e1b0863cfef6696a8c8 src/mistralai/gcp/client/models/tool.py: id: 4b27d45e56ad - last_write_checksum: sha1:cb0d879a55218fd7753bdd005be8a155982feb8f - pristine_git_object: 670aa81f8767e7c079105cf5995225168b4d6eb6 + last_write_checksum: sha1:e97109b00c31a731920e963ce0a346c3e8059448 + pristine_git_object: e95b303696e3881c58a9df16e059d22ba2e2b11b src/mistralai/gcp/client/models/toolcall.py: id: e6c25869a579 - last_write_checksum: sha1:f88e69a8e352025ca4b6897f6c16e1f7e4cd7264 - pristine_git_object: 3ea8e283c8f695bcc1fbc734b0074d37c2efeac8 + last_write_checksum: sha1:49733947b95332a77156893623bb58845518cdb8 + pristine_git_object: 4e4c2581af45686e0e4fe3c5cce9670f7f07d0c5 src/mistralai/gcp/client/models/toolchoice.py: id: cb13a9f64c92 - last_write_checksum: sha1:71be72b1aae19aef1f8a461c89b71ad6daa009b7 - pristine_git_object: 6e795fd72792f740c8aa5b4da7d1f516018f2c2e + last_write_checksum: sha1:613b18868534759b45e26e00e5a83c8f8b14b006 + pristine_git_object: 528cc801e876cd978be94027f36b83449136800b src/mistralai/gcp/client/models/toolchoiceenum.py: id: d62e9c92d93c last_write_checksum: sha1:3dbba9a58c5569aafe115f3f7713a52b01ad8620 pristine_git_object: 01f6f677b379f9e3c99db9d1ad248cb0033a2804 + src/mistralai/gcp/client/models/toolconfiguration.py: + id: c64c4cb6272c + last_write_checksum: sha1:f16ad6049988244f20f2ec3454236ae50c4198a1 + pristine_git_object: 724ed8c65f4b77d74d72898d3566843947de5f82 src/mistralai/gcp/client/models/toolmessage.py: id: b3774786c2e9 - last_write_checksum: sha1:3d414da8132467d1472ebe485802ffc78eb6f7e4 - pristine_git_object: ce160391f37ce3568daf2877f8dc1aa0f3694821 + last_write_checksum: sha1:7807f5b2b124643126cf6d141af40924838dba28 + pristine_git_object: a5a9645dda134345f5a023d49c8d5dbe9dd135ec src/mistralai/gcp/client/models/toolreferencechunk.py: id: 16363389756d - last_write_checksum: sha1:42abb2395ed4aa06831723288ce3d20f53f38da7 - pristine_git_object: 0a2a7fa3b80417ac2462126c4fae1e9f777df534 - src/mistralai/gcp/client/models/tooltypes.py: - id: 5926c64f5229 - last_write_checksum: sha1:ffd576511eed9f823c3d67df9fc5574d8d53c54b - pristine_git_object: fd1aa13d7b8c5d9bdb0922e04b8bd653ff843f60 + last_write_checksum: sha1:b70e37ab08799a0332a23856314b3a1a3cdf16b5 + pristine_git_object: eb2b80e409d2b929d6a4018f3ef80a2d61c06ab0 src/mistralai/gcp/client/models/usageinfo.py: id: 3aab1af66cff - last_write_checksum: sha1:c0c949ac48ed35efe1e8fbf820b8e390edd9c3ce - pristine_git_object: cb6feb6e8d173d39b828d8f5b38af75173b4f7f2 + last_write_checksum: sha1:432d75c62a44820c9b068e8e14c15fcfdb0931e8 + pristine_git_object: df40efab5b7a0457b4d8f62d46a7a8820fec8cc4 src/mistralai/gcp/client/models/usermessage.py: id: 9cfa7260463e - last_write_checksum: sha1:780984241b84a7dfe1f6ad6eccace1204bfec8bd - pristine_git_object: e237e900421a9e65fd15aede29ade0e510b189f6 + last_write_checksum: sha1:8d3eb6d719e8fb0bff460c1e7acc5ef2a5633882 + pristine_git_object: 8199f2936c2a2cc1e971400813acc508e4242e2f src/mistralai/gcp/client/models/validationerror.py: id: 6b4f4910ea9c - last_write_checksum: sha1:1fd1ffba68b202465f3a0269d7099b4fee5c85c9 - pristine_git_object: 3ff872c15f6380c3a7f9dc9be1b80be159f752ba + last_write_checksum: sha1:e595fb93b91fd9d1d1b48cb551c277be9c0a9dbd + pristine_git_object: 653b63e906c0a341e4fef6e7d7a253314e545f8c + src/mistralai/gcp/client/models/websearchpremiumtool.py: + id: 0f6734458e65 + last_write_checksum: sha1:64842c599d3ff0161c4b9fbca2dde21b75ab1ac2 + pristine_git_object: e416f96472bc8956d5ff44c061f725e10fa0a317 + src/mistralai/gcp/client/models/websearchtool.py: + id: 40ee5a5ac881 + last_write_checksum: sha1:36287a70e58b48968effec4feb9bc9dbfbb9cd94 + pristine_git_object: 69d6e04373c665012103489006f4e39bd85cd565 src/mistralai/gcp/client/py.typed: id: 98b8ab80ab0d last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 @@ -590,8 +723,8 @@ trackedFiles: pristine_git_object: 3324e1bc2668c54c4d5f5a1a845675319757a828 src/mistralai/gcp/client/utils/eventstreaming.py: id: bb66f0c3e0dc - last_write_checksum: sha1:ffa870a25a7e4e2015bfd7a467ccd3aa1de97f0e - pristine_git_object: f2052fc22d9fd6c663ba3dce019fe234ca37108b + last_write_checksum: sha1:620d78a8b4e3b854e08d136e02e40a01a786bd70 + pristine_git_object: 3bdcd6d3d4fc772cb7f5fca8685dcdc8c85e13e8 src/mistralai/gcp/client/utils/forms.py: id: ebf34781d6bd last_write_checksum: sha1:0ca31459b99f761fcc6d0557a0a38daac4ad50f4 @@ -606,8 +739,8 @@ trackedFiles: pristine_git_object: b661aff65d38b77d035149699aea09b2785d2fc6 src/mistralai/gcp/client/utils/metadata.py: id: ff0e832b8b9c - last_write_checksum: sha1:c6a560bd0c63ab158582f34dadb69433ea73b3d4 - pristine_git_object: 173b3e5ce658675c2f504222a56b3daaaa68107d + last_write_checksum: sha1:e703e5cbb5255144aacf86898d1420529afaaff8 + pristine_git_object: 5abddd588837ac297050ca3b543627faadb350a9 src/mistralai/gcp/client/utils/queryparams.py: id: 133b8408e73e last_write_checksum: sha1:b94c3f314fd3da0d1d215afc2731f48748e2aa59 @@ -622,12 +755,12 @@ trackedFiles: pristine_git_object: af07d4e941007af4213c5ec9047ef8a2fca04e5e src/mistralai/gcp/client/utils/security.py: id: 5273152365f4 - last_write_checksum: sha1:435dd8b180cefcd733e635b9fa45512da091d9c0 - pristine_git_object: 17996bd54b8624009802fbbdf30bcb4225b8dfed + last_write_checksum: sha1:c11eef495b6aaa249178c24c796940cc540b7a00 + pristine_git_object: 42d8d78e9981eed7507670014d99588e27ab325a src/mistralai/gcp/client/utils/serializers.py: id: a7836e553d41 - last_write_checksum: sha1:ce1d8d7f500a9ccba0aeca5057cee9c271f4dfd7 - pristine_git_object: 14321eb479de81d0d9580ec8291e0ff91bf29e57 + last_write_checksum: sha1:61009f2e4ef6613a1a5af813fe020373dae5a492 + pristine_git_object: d2149f8b909cb96628db140ac3cddb1b1e981367 src/mistralai/gcp/client/utils/unions.py: id: 8abba1cf1b6d last_write_checksum: sha1:6e38049f323e0b5fb4bd0e88ab51ec447197ccb0 @@ -664,20 +797,19 @@ examples: stream_fim: speakeasy-default-stream-fim: requestBody: - application/json: {"model": "codestral-latest", "top_p": 1, "stream": true, "prompt": "def", "suffix": "return a+b"} + application/json: {"model": "codestral-latest", "stream": true, "prompt": "def", "suffix": "return a+b"} responses: "422": application/json: {} fim_completion_v1_fim_completions_post: userExample: requestBody: - application/json: {"model": "codestral-latest", "top_p": 1, "stream": false, "prompt": "def", "suffix": "return a+b"} + application/json: {"model": "codestral-latest", "stream": false, "prompt": "def", "suffix": "return a+b"} responses: "200": application/json: {"id": "447e3e0d457e42e98248b5d2ef52a2a3", "object": "chat.completion", "model": "codestral-2508", "usage": {"prompt_tokens": 8, "completion_tokens": 91, "total_tokens": 99}, "created": 1759496862, "choices": [{"index": 0, "message": {"role": "assistant", "content": "add_numbers(a: int, b: int) -> int:\n \"\"\"\n You are given two integers `a` and `b`. Your task is to write a function that\n returns the sum of these two integers. The function should be implemented in a\n way that it can handle very large integers (up to 10^18). As a reminder, your\n code has to be in python\n \"\"\"\n", "tool_calls": null, "prefix": false}, "finish_reason": "stop"}]} examplesVersion: 1.0.2 generatedTests: {} -releaseNotes: "## Python SDK Changes:\n* `mistral_gcp.chat.stream()`: \n * `request.messages[].union(system).content.union(Array)[].union(thinking).thinking[].union(ToolReferenceChunk)` **Added**\n * `error.detail[]` **Changed**\n* `mistral_gcp.chat.complete()`: \n * `request.messages[].union(system).content.union(Array)[].union(thinking).thinking[].union(ToolReferenceChunk)` **Added**\n * `error.detail[]` **Changed**\n* `mistral_gcp.fim.stream()`: `error.detail[]` **Changed**\n* `mistral_gcp.fim.complete()`: `error.detail[]` **Changed**\n" generatedFiles: - .gitattributes - .vscode/settings.json diff --git a/packages/gcp/.speakeasy/gen.yaml b/packages/gcp/.speakeasy/gen.yaml index 27793130..ebf8a3a0 100644 --- a/packages/gcp/.speakeasy/gen.yaml +++ b/packages/gcp/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false python: - version: 2.0.0 + version: 2.1.0 additionalDependencies: dev: pytest: ^8.2.2 diff --git a/packages/gcp/RELEASES.md b/packages/gcp/RELEASES.md index 30d3e580..9cf7beb2 100644 --- a/packages/gcp/RELEASES.md +++ b/packages/gcp/RELEASES.md @@ -38,4 +38,14 @@ Based on: ### Generated - [python v2.0.0] packages/gcp ### Releases -- [PyPI v2.0.0] https://pypi.org/project/mistralai-gcp/2.0.0 - packages/gcp \ No newline at end of file +- [PyPI v2.0.0] https://pypi.org/project/mistralai-gcp/2.0.0 - packages/gcp + +## 2026-05-22 14:13:02 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.763.6 (2.884.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v2.1.0] packages/gcp +### Releases +- [PyPI v2.1.0] https://pypi.org/project/mistralai-gcp/2.1.0 - packages/gcp \ No newline at end of file diff --git a/packages/gcp/docs/models/apikeyauth.md b/packages/gcp/docs/models/apikeyauth.md new file mode 100644 index 00000000..1fbff10e --- /dev/null +++ b/packages/gcp/docs/models/apikeyauth.md @@ -0,0 +1,9 @@ +# APIKeyAuth + + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `type` | *Literal["api-key"]* | :heavy_check_mark: | N/A | +| `value` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/authorization.md b/packages/gcp/docs/models/authorization.md new file mode 100644 index 00000000..11ea5c6a --- /dev/null +++ b/packages/gcp/docs/models/authorization.md @@ -0,0 +1,17 @@ +# Authorization + + +## Supported Types + +### `models.APIKeyAuth` + +```python +value: models.APIKeyAuth = /* values here */ +``` + +### `models.OAuth2TokenAuth` + +```python +value: models.OAuth2TokenAuth = /* values here */ +``` + diff --git a/packages/gcp/docs/models/builtinconnectors.md b/packages/gcp/docs/models/builtinconnectors.md index f96f5044..ad9b9823 100644 --- a/packages/gcp/docs/models/builtinconnectors.md +++ b/packages/gcp/docs/models/builtinconnectors.md @@ -1,12 +1,17 @@ # BuiltInConnectors +## Example Usage + +```python +from mistralai.gcp.client.models import BuiltInConnectors +value: BuiltInConnectors = "web_search" +``` + ## Values -| Name | Value | -| -------------------- | -------------------- | -| `WEB_SEARCH` | web_search | -| `WEB_SEARCH_PREMIUM` | web_search_premium | -| `CODE_INTERPRETER` | code_interpreter | -| `IMAGE_GENERATION` | image_generation | -| `DOCUMENT_LIBRARY` | document_library | \ No newline at end of file +- `"web_search"` +- `"web_search_premium"` +- `"code_interpreter"` +- `"image_generation"` +- `"document_library"` diff --git a/packages/gcp/docs/models/chatcompletionchoice.md b/packages/gcp/docs/models/chatcompletionchoice.md index deaa0ea0..79d24a33 100644 --- a/packages/gcp/docs/models/chatcompletionchoice.md +++ b/packages/gcp/docs/models/chatcompletionchoice.md @@ -6,5 +6,6 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | `index` | *int* | :heavy_check_mark: | N/A | 0 | -| `message` | [models.AssistantMessage](../models/assistantmessage.md) | :heavy_check_mark: | N/A | | +| `message` | [Optional[models.AssistantMessage]](../models/assistantmessage.md) | :heavy_minus_sign: | N/A | | +| `messages` | List[[models.DeltaMessage](../models/deltamessage.md)] | :heavy_minus_sign: | N/A | | | `finish_reason` | [models.ChatCompletionChoiceFinishReason](../models/chatcompletionchoicefinishreason.md) | :heavy_check_mark: | N/A | stop | \ No newline at end of file diff --git a/packages/gcp/docs/models/chatcompletionchoicefinishreason.md b/packages/gcp/docs/models/chatcompletionchoicefinishreason.md index b2f15ecb..53290d8e 100644 --- a/packages/gcp/docs/models/chatcompletionchoicefinishreason.md +++ b/packages/gcp/docs/models/chatcompletionchoicefinishreason.md @@ -1,12 +1,21 @@ # ChatCompletionChoiceFinishReason +## Example Usage + +```python +from mistralai.gcp.client.models import ChatCompletionChoiceFinishReason + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ChatCompletionChoiceFinishReason = "stop" +``` + ## Values -| Name | Value | -| -------------- | -------------- | -| `STOP` | stop | -| `LENGTH` | length | -| `MODEL_LENGTH` | model_length | -| `ERROR` | error | -| `TOOL_CALLS` | tool_calls | \ No newline at end of file +This is an open enum. Unrecognized values will not fail type checks. + +- `"stop"` +- `"length"` +- `"model_length"` +- `"error"` +- `"tool_calls"` diff --git a/packages/gcp/docs/models/chatcompletionrequest.md b/packages/gcp/docs/models/chatcompletionrequest.md index 78cce437..db61b5c0 100644 --- a/packages/gcp/docs/models/chatcompletionrequest.md +++ b/packages/gcp/docs/models/chatcompletionrequest.md @@ -5,21 +5,23 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `model` | *str* | :heavy_check_mark: | ID of the model to use. You can use the [List Available Models](https://docs.mistral.ai/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](https://docs.mistral.ai/models) for model descriptions. | mistral-large-latest | +| `model` | *str* | :heavy_check_mark: | ID of the model to use. You can use the [List Available Models](/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](/models) for model descriptions. | mistral-large-latest | | `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value. | | -| `top_p` | *Optional[float]* | :heavy_minus_sign: | Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both. | | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both. | | | `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length. | | | `stream` | *Optional[bool]* | :heavy_minus_sign: | Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. | | -| `stop` | [Optional[models.ChatCompletionRequestStop]](../models/chatcompletionrequeststop.md) | :heavy_minus_sign: | Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | | +| `stop` | [OptionalNullable[models.ChatCompletionRequestStop]](../models/chatcompletionrequeststop.md) | :heavy_minus_sign: | Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | | | `random_seed` | *OptionalNullable[int]* | :heavy_minus_sign: | The seed to use for random sampling. If set, different calls will generate deterministic results. | | | `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | | `messages` | List[[models.ChatCompletionRequestMessage](../models/chatcompletionrequestmessage.md)] | :heavy_check_mark: | The prompt(s) to generate completions for, encoded as a list of dict with role and content. | [
{
"role": "user",
"content": "Who is the best French painter? Answer in one short sentence."
}
] | | `response_format` | [Optional[models.ResponseFormat]](../models/responseformat.md) | :heavy_minus_sign: | Specify the format that the model must output. By default it will use `{ "type": "text" }`. Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ "type": "json_schema" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide. | **Example 1:** {
"type": "text"
}
**Example 2:** {
"type": "json_object"
}
**Example 3:** {
"type": "json_schema",
"json_schema": {
"schema": {
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"authors": {
"items": {
"type": "string"
},
"title": "Authors",
"type": "array"
}
},
"required": [
"name",
"authors"
],
"title": "Book",
"type": "object",
"additionalProperties": false
},
"name": "book",
"strict": true
}
} | -| `tools` | List[[models.Tool](../models/tool.md)] | :heavy_minus_sign: | A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for. | | +| `tools` | List[[models.ChatCompletionRequestTool](../models/chatcompletionrequesttool.md)] | :heavy_minus_sign: | A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for. | | | `tool_choice` | [Optional[models.ChatCompletionRequestToolChoice]](../models/chatcompletionrequesttoolchoice.md) | :heavy_minus_sign: | Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. | | -| `presence_penalty` | *Optional[float]* | :heavy_minus_sign: | The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative. | | -| `frequency_penalty` | *Optional[float]* | :heavy_minus_sign: | The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition. | | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative. | | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition. | | | `n` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of completions to return for each request, input tokens are only billed once. | | | `prediction` | [Optional[models.Prediction]](../models/prediction.md) | :heavy_minus_sign: | Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content. | | | `parallel_tool_calls` | *Optional[bool]* | :heavy_minus_sign: | Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel. | | -| `prompt_mode` | [OptionalNullable[models.MistralPromptMode]](../models/mistralpromptmode.md) | :heavy_minus_sign: | Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used. | | \ No newline at end of file +| `reasoning_effort` | [OptionalNullable[models.ReasoningEffort]](../models/reasoningeffort.md) | :heavy_minus_sign: | N/A | | +| `prompt_mode` | [OptionalNullable[models.MistralPromptMode]](../models/mistralpromptmode.md) | :heavy_minus_sign: | Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used. | | +| `guardrails` | List[[models.GuardrailConfig](../models/guardrailconfig.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/packages/gcp/docs/models/chatcompletionrequesttool.md b/packages/gcp/docs/models/chatcompletionrequesttool.md new file mode 100644 index 00000000..572d12ca --- /dev/null +++ b/packages/gcp/docs/models/chatcompletionrequesttool.md @@ -0,0 +1,47 @@ +# ChatCompletionRequestTool + + +## Supported Types + +### `models.Tool` + +```python +value: models.Tool = /* values here */ +``` + +### `models.WebSearchTool` + +```python +value: models.WebSearchTool = /* values here */ +``` + +### `models.WebSearchPremiumTool` + +```python +value: models.WebSearchPremiumTool = /* values here */ +``` + +### `models.CodeInterpreterTool` + +```python +value: models.CodeInterpreterTool = /* values here */ +``` + +### `models.ImageGenerationTool` + +```python +value: models.ImageGenerationTool = /* values here */ +``` + +### `models.DocumentLibraryTool` + +```python +value: models.DocumentLibraryTool = /* values here */ +``` + +### `models.CustomConnector` + +```python +value: models.CustomConnector = /* values here */ +``` + diff --git a/packages/gcp/docs/models/chatcompletionstreamrequest.md b/packages/gcp/docs/models/chatcompletionstreamrequest.md index a26a85d7..bd19d37b 100644 --- a/packages/gcp/docs/models/chatcompletionstreamrequest.md +++ b/packages/gcp/docs/models/chatcompletionstreamrequest.md @@ -5,21 +5,23 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `model` | *str* | :heavy_check_mark: | ID of the model to use. You can use the [List Available Models](https://docs.mistral.ai/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](https://docs.mistral.ai/models) for model descriptions. | mistral-large-latest | +| `model` | *str* | :heavy_check_mark: | ID of the model to use. You can use the [List Available Models](/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](/models) for model descriptions. | mistral-large-latest | | `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value. | | -| `top_p` | *Optional[float]* | :heavy_minus_sign: | Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both. | | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both. | | | `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length. | | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `stop` | [Optional[models.ChatCompletionStreamRequestStop]](../models/chatcompletionstreamrequeststop.md) | :heavy_minus_sign: | Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | | +| `stop` | [OptionalNullable[models.ChatCompletionStreamRequestStop]](../models/chatcompletionstreamrequeststop.md) | :heavy_minus_sign: | Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | | | `random_seed` | *OptionalNullable[int]* | :heavy_minus_sign: | The seed to use for random sampling. If set, different calls will generate deterministic results. | | | `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | | `messages` | List[[models.ChatCompletionStreamRequestMessage](../models/chatcompletionstreamrequestmessage.md)] | :heavy_check_mark: | The prompt(s) to generate completions for, encoded as a list of dict with role and content. | [
{
"role": "user",
"content": "Who is the best French painter? Answer in one short sentence."
}
] | | `response_format` | [Optional[models.ResponseFormat]](../models/responseformat.md) | :heavy_minus_sign: | Specify the format that the model must output. By default it will use `{ "type": "text" }`. Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ "type": "json_schema" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide. | **Example 1:** {
"type": "text"
}
**Example 2:** {
"type": "json_object"
}
**Example 3:** {
"type": "json_schema",
"json_schema": {
"schema": {
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"authors": {
"items": {
"type": "string"
},
"title": "Authors",
"type": "array"
}
},
"required": [
"name",
"authors"
],
"title": "Book",
"type": "object",
"additionalProperties": false
},
"name": "book",
"strict": true
}
} | -| `tools` | List[[models.Tool](../models/tool.md)] | :heavy_minus_sign: | A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for. | | +| `tools` | List[[models.ChatCompletionStreamRequestTool](../models/chatcompletionstreamrequesttool.md)] | :heavy_minus_sign: | A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for. | | | `tool_choice` | [Optional[models.ChatCompletionStreamRequestToolChoice]](../models/chatcompletionstreamrequesttoolchoice.md) | :heavy_minus_sign: | Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. | | -| `presence_penalty` | *Optional[float]* | :heavy_minus_sign: | The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative. | | -| `frequency_penalty` | *Optional[float]* | :heavy_minus_sign: | The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition. | | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative. | | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition. | | | `n` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of completions to return for each request, input tokens are only billed once. | | | `prediction` | [Optional[models.Prediction]](../models/prediction.md) | :heavy_minus_sign: | Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content. | | | `parallel_tool_calls` | *Optional[bool]* | :heavy_minus_sign: | Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel. | | -| `prompt_mode` | [OptionalNullable[models.MistralPromptMode]](../models/mistralpromptmode.md) | :heavy_minus_sign: | Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used. | | \ No newline at end of file +| `reasoning_effort` | [OptionalNullable[models.ReasoningEffort]](../models/reasoningeffort.md) | :heavy_minus_sign: | N/A | | +| `prompt_mode` | [OptionalNullable[models.MistralPromptMode]](../models/mistralpromptmode.md) | :heavy_minus_sign: | Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used. | | +| `guardrails` | List[[models.GuardrailConfig](../models/guardrailconfig.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/packages/gcp/docs/models/chatcompletionstreamrequesttool.md b/packages/gcp/docs/models/chatcompletionstreamrequesttool.md new file mode 100644 index 00000000..48998fcb --- /dev/null +++ b/packages/gcp/docs/models/chatcompletionstreamrequesttool.md @@ -0,0 +1,47 @@ +# ChatCompletionStreamRequestTool + + +## Supported Types + +### `models.Tool` + +```python +value: models.Tool = /* values here */ +``` + +### `models.WebSearchTool` + +```python +value: models.WebSearchTool = /* values here */ +``` + +### `models.WebSearchPremiumTool` + +```python +value: models.WebSearchPremiumTool = /* values here */ +``` + +### `models.CodeInterpreterTool` + +```python +value: models.CodeInterpreterTool = /* values here */ +``` + +### `models.ImageGenerationTool` + +```python +value: models.ImageGenerationTool = /* values here */ +``` + +### `models.DocumentLibraryTool` + +```python +value: models.DocumentLibraryTool = /* values here */ +``` + +### `models.CustomConnector` + +```python +value: models.CustomConnector = /* values here */ +``` + diff --git a/packages/gcp/docs/models/codeinterpretertool.md b/packages/gcp/docs/models/codeinterpretertool.md new file mode 100644 index 00000000..6302fc62 --- /dev/null +++ b/packages/gcp/docs/models/codeinterpretertool.md @@ -0,0 +1,9 @@ +# CodeInterpreterTool + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `tool_configuration` | [OptionalNullable[models.ToolConfiguration]](../models/toolconfiguration.md) | :heavy_minus_sign: | N/A | +| `type` | *Literal["code_interpreter"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/completionresponsestreamchoicefinishreason.md b/packages/gcp/docs/models/completionresponsestreamchoicefinishreason.md index 0fece473..7b37dc06 100644 --- a/packages/gcp/docs/models/completionresponsestreamchoicefinishreason.md +++ b/packages/gcp/docs/models/completionresponsestreamchoicefinishreason.md @@ -1,11 +1,20 @@ # CompletionResponseStreamChoiceFinishReason +## Example Usage + +```python +from mistralai.gcp.client.models import CompletionResponseStreamChoiceFinishReason + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: CompletionResponseStreamChoiceFinishReason = "stop" +``` + ## Values -| Name | Value | -| ------------ | ------------ | -| `STOP` | stop | -| `LENGTH` | length | -| `ERROR` | error | -| `TOOL_CALLS` | tool_calls | \ No newline at end of file +This is an open enum. Unrecognized values will not fail type checks. + +- `"stop"` +- `"length"` +- `"error"` +- `"tool_calls"` diff --git a/packages/gcp/docs/models/customconnector.md b/packages/gcp/docs/models/customconnector.md new file mode 100644 index 00000000..0a0b6921 --- /dev/null +++ b/packages/gcp/docs/models/customconnector.md @@ -0,0 +1,11 @@ +# CustomConnector + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `type` | *Literal["connector"]* | :heavy_check_mark: | N/A | +| `connector_id` | *str* | :heavy_check_mark: | N/A | +| `authorization` | [OptionalNullable[models.Authorization]](../models/authorization.md) | :heavy_minus_sign: | N/A | +| `tool_configuration` | [OptionalNullable[models.ToolConfiguration]](../models/toolconfiguration.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/deltamessage.md b/packages/gcp/docs/models/deltamessage.md index e0ee575f..c2395e1b 100644 --- a/packages/gcp/docs/models/deltamessage.md +++ b/packages/gcp/docs/models/deltamessage.md @@ -3,8 +3,11 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `role` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `content` | [OptionalNullable[models.DeltaMessageContent]](../models/deltamessagecontent.md) | :heavy_minus_sign: | N/A | -| `tool_calls` | List[[models.ToolCall](../models/toolcall.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `role` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `content` | [OptionalNullable[models.DeltaMessageContent]](../models/deltamessagecontent.md) | :heavy_minus_sign: | N/A | +| `tool_calls` | List[[models.ToolCall](../models/toolcall.md)] | :heavy_minus_sign: | N/A | +| `tool_call_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `index` | *OptionalNullable[int]* | :heavy_minus_sign: | If the completion returns multiple messages, this is to specify which message this delta is for. | +| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/documentlibrarytool.md b/packages/gcp/docs/models/documentlibrarytool.md new file mode 100644 index 00000000..95c3fa52 --- /dev/null +++ b/packages/gcp/docs/models/documentlibrarytool.md @@ -0,0 +1,10 @@ +# DocumentLibraryTool + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `tool_configuration` | [OptionalNullable[models.ToolConfiguration]](../models/toolconfiguration.md) | :heavy_minus_sign: | N/A | +| `type` | *Literal["document_library"]* | :heavy_check_mark: | N/A | +| `library_ids` | List[*str*] | :heavy_check_mark: | Ids of the library in which to search. | \ No newline at end of file diff --git a/packages/gcp/docs/models/fimcompletionrequest.md b/packages/gcp/docs/models/fimcompletionrequest.md index fde0b625..c0c52b66 100644 --- a/packages/gcp/docs/models/fimcompletionrequest.md +++ b/packages/gcp/docs/models/fimcompletionrequest.md @@ -7,10 +7,10 @@ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | *str* | :heavy_check_mark: | ID of the model with FIM to use. | codestral-latest | | `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value. | | -| `top_p` | *Optional[float]* | :heavy_minus_sign: | Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both. | | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both. | | | `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length. | | | `stream` | *Optional[bool]* | :heavy_minus_sign: | Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. | | -| `stop` | [Optional[models.FIMCompletionRequestStop]](../models/fimcompletionrequeststop.md) | :heavy_minus_sign: | Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | | +| `stop` | [OptionalNullable[models.FIMCompletionRequestStop]](../models/fimcompletionrequeststop.md) | :heavy_minus_sign: | Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | | | `random_seed` | *OptionalNullable[int]* | :heavy_minus_sign: | The seed to use for random sampling. If set, different calls will generate deterministic results. | | | `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | | `prompt` | *str* | :heavy_check_mark: | The text/code to complete. | def | diff --git a/packages/gcp/docs/models/fimcompletionstreamrequest.md b/packages/gcp/docs/models/fimcompletionstreamrequest.md index ba62d854..c02b622c 100644 --- a/packages/gcp/docs/models/fimcompletionstreamrequest.md +++ b/packages/gcp/docs/models/fimcompletionstreamrequest.md @@ -7,10 +7,10 @@ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | *str* | :heavy_check_mark: | ID of the model with FIM to use. | codestral-latest | | `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value. | | -| `top_p` | *Optional[float]* | :heavy_minus_sign: | Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both. | | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both. | | | `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length. | | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `stop` | [Optional[models.FIMCompletionStreamRequestStop]](../models/fimcompletionstreamrequeststop.md) | :heavy_minus_sign: | Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | | +| `stop` | [OptionalNullable[models.FIMCompletionStreamRequestStop]](../models/fimcompletionstreamrequeststop.md) | :heavy_minus_sign: | Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | | | `random_seed` | *OptionalNullable[int]* | :heavy_minus_sign: | The seed to use for random sampling. If set, different calls will generate deterministic results. | | | `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | | `prompt` | *str* | :heavy_check_mark: | The text/code to complete. | def | diff --git a/packages/gcp/docs/models/guardrailconfig.md b/packages/gcp/docs/models/guardrailconfig.md new file mode 100644 index 00000000..1276462c --- /dev/null +++ b/packages/gcp/docs/models/guardrailconfig.md @@ -0,0 +1,10 @@ +# GuardrailConfig + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `block_on_error` | *Optional[bool]* | :heavy_minus_sign: | If true, return HTTP 403 and block request in the event of a server-side error | +| `moderation_llm_v1` | [OptionalNullable[models.ModerationLlmv1Config]](../models/moderationllmv1config.md) | :heavy_minus_sign: | N/A | +| `moderation_llm_v2` | [OptionalNullable[models.ModerationLlmv2Config]](../models/moderationllmv2config.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/imagedetail.md b/packages/gcp/docs/models/imagedetail.md index 1e5ba3fd..15cc63e7 100644 --- a/packages/gcp/docs/models/imagedetail.md +++ b/packages/gcp/docs/models/imagedetail.md @@ -1,10 +1,19 @@ # ImageDetail +## Example Usage + +```python +from mistralai.gcp.client.models import ImageDetail + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ImageDetail = "low" +``` + ## Values -| Name | Value | -| ------ | ------ | -| `LOW` | low | -| `AUTO` | auto | -| `HIGH` | high | \ No newline at end of file +This is an open enum. Unrecognized values will not fail type checks. + +- `"low"` +- `"auto"` +- `"high"` diff --git a/packages/gcp/docs/models/imagegenerationtool.md b/packages/gcp/docs/models/imagegenerationtool.md new file mode 100644 index 00000000..b476b6f2 --- /dev/null +++ b/packages/gcp/docs/models/imagegenerationtool.md @@ -0,0 +1,9 @@ +# ImageGenerationTool + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `tool_configuration` | [OptionalNullable[models.ToolConfiguration]](../models/toolconfiguration.md) | :heavy_minus_sign: | N/A | +| `type` | *Literal["image_generation"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/imageurlchunk.md b/packages/gcp/docs/models/imageurlchunk.md index a84dac32..73e1ed5a 100644 --- a/packages/gcp/docs/models/imageurlchunk.md +++ b/packages/gcp/docs/models/imageurlchunk.md @@ -1,6 +1,6 @@ # ImageURLChunk -{"type":"image_url","image_url":{"url":"data:image/png;base64,iVBORw0 +{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"} ## Fields diff --git a/packages/gcp/docs/models/mistralpromptmode.md b/packages/gcp/docs/models/mistralpromptmode.md index c3409d03..921f81a4 100644 --- a/packages/gcp/docs/models/mistralpromptmode.md +++ b/packages/gcp/docs/models/mistralpromptmode.md @@ -4,9 +4,18 @@ Available options to the prompt_mode argument on the chat completion endpoint. Values represent high-level intent. Assignment to actual SPs is handled internally. System prompt may include knowledge cutoff date, model capabilities, tone to use, safety guidelines, etc. +## Example Usage + +```python +from mistralai.gcp.client.models import MistralPromptMode + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: MistralPromptMode = "reasoning" +``` + ## Values -| Name | Value | -| ----------- | ----------- | -| `REASONING` | reasoning | \ No newline at end of file +This is an open enum. Unrecognized values will not fail type checks. + +- `"reasoning"` diff --git a/packages/gcp/docs/models/moderationllmaction.md b/packages/gcp/docs/models/moderationllmaction.md new file mode 100644 index 00000000..e0077a32 --- /dev/null +++ b/packages/gcp/docs/models/moderationllmaction.md @@ -0,0 +1,14 @@ +# ModerationLLMAction + +## Example Usage + +```python +from mistralai.gcp.client.models import ModerationLLMAction +value: ModerationLLMAction = "none" +``` + + +## Values + +- `"none"` +- `"block"` diff --git a/packages/gcp/docs/models/moderationllmv1categorythresholds.md b/packages/gcp/docs/models/moderationllmv1categorythresholds.md new file mode 100644 index 00000000..90ae213f --- /dev/null +++ b/packages/gcp/docs/models/moderationllmv1categorythresholds.md @@ -0,0 +1,16 @@ +# ModerationLlmv1CategoryThresholds + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | +| `sexual` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `hate_and_discrimination` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `violence_and_threats` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `dangerous_and_criminal_content` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `selfharm` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `health` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `financial` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `law` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `pii` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/moderationllmv1config.md b/packages/gcp/docs/models/moderationllmv1config.md new file mode 100644 index 00000000..bdb5812b --- /dev/null +++ b/packages/gcp/docs/models/moderationllmv1config.md @@ -0,0 +1,11 @@ +# ModerationLlmv1Config + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `model_name` | *Optional[str]* | :heavy_minus_sign: | Override model name. Should be omitted in general. | +| `custom_category_thresholds` | [OptionalNullable[models.ModerationLlmv1CategoryThresholds]](../models/moderationllmv1categorythresholds.md) | :heavy_minus_sign: | N/A | +| `ignore_other_categories` | *Optional[bool]* | :heavy_minus_sign: | If true, only evaluate categories in custom_category_thresholds; others are ignored. | +| `action` | [Optional[models.ModerationLLMAction]](../models/moderationllmaction.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/moderationllmv2categorythresholds.md b/packages/gcp/docs/models/moderationllmv2categorythresholds.md new file mode 100644 index 00000000..e95b81b0 --- /dev/null +++ b/packages/gcp/docs/models/moderationllmv2categorythresholds.md @@ -0,0 +1,18 @@ +# ModerationLlmv2CategoryThresholds + + +## Fields + +| Field | Type | Required | Description | +| ------------------------- | ------------------------- | ------------------------- | ------------------------- | +| `sexual` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `hate_and_discrimination` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `violence_and_threats` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `dangerous` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `criminal` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `selfharm` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `health` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `financial` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `law` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `pii` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `jailbreaking` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/moderationllmv2config.md b/packages/gcp/docs/models/moderationllmv2config.md new file mode 100644 index 00000000..e928506c --- /dev/null +++ b/packages/gcp/docs/models/moderationllmv2config.md @@ -0,0 +1,11 @@ +# ModerationLlmv2Config + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `model_name` | *Optional[str]* | :heavy_minus_sign: | Override model name. Should be omitted in general. | +| `custom_category_thresholds` | [OptionalNullable[models.ModerationLlmv2CategoryThresholds]](../models/moderationllmv2categorythresholds.md) | :heavy_minus_sign: | N/A | +| `ignore_other_categories` | *Optional[bool]* | :heavy_minus_sign: | If true, only evaluate categories in custom_category_thresholds; others are ignored. | +| `action` | [Optional[models.ModerationLLMAction]](../models/moderationllmaction.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/oauth2tokenauth.md b/packages/gcp/docs/models/oauth2tokenauth.md new file mode 100644 index 00000000..89f80436 --- /dev/null +++ b/packages/gcp/docs/models/oauth2tokenauth.md @@ -0,0 +1,9 @@ +# OAuth2TokenAuth + + +## Fields + +| Field | Type | Required | Description | +| ------------------------- | ------------------------- | ------------------------- | ------------------------- | +| `type` | *Literal["oauth2-token"]* | :heavy_check_mark: | N/A | +| `value` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/reasoningeffort.md b/packages/gcp/docs/models/reasoningeffort.md new file mode 100644 index 00000000..87e0ae76 --- /dev/null +++ b/packages/gcp/docs/models/reasoningeffort.md @@ -0,0 +1,14 @@ +# ReasoningEffort + +## Example Usage + +```python +from mistralai.gcp.client.models import ReasoningEffort +value: ReasoningEffort = "none" +``` + + +## Values + +- `"none"` +- `"high"` diff --git a/packages/gcp/docs/models/referencechunk.md b/packages/gcp/docs/models/referencechunk.md index d847e248..0186d3c3 100644 --- a/packages/gcp/docs/models/referencechunk.md +++ b/packages/gcp/docs/models/referencechunk.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -| `type` | *Optional[Literal["reference"]]* | :heavy_minus_sign: | N/A | -| `reference_ids` | List[*int*] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `type` | *Optional[Literal["reference"]]* | :heavy_minus_sign: | N/A | +| `reference_ids` | List[[models.ReferenceID](../models/referenceid.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/referenceid.md b/packages/gcp/docs/models/referenceid.md new file mode 100644 index 00000000..1d29397f --- /dev/null +++ b/packages/gcp/docs/models/referenceid.md @@ -0,0 +1,17 @@ +# ReferenceID + + +## Supported Types + +### `int` + +```python +value: int = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/packages/gcp/docs/models/responseformats.md b/packages/gcp/docs/models/responseformats.md index 2f5f1e55..5d9aeb3e 100644 --- a/packages/gcp/docs/models/responseformats.md +++ b/packages/gcp/docs/models/responseformats.md @@ -1,10 +1,15 @@ # ResponseFormats +## Example Usage + +```python +from mistralai.gcp.client.models import ResponseFormats +value: ResponseFormats = "text" +``` + ## Values -| Name | Value | -| ------------- | ------------- | -| `TEXT` | text | -| `JSON_OBJECT` | json_object | -| `JSON_SCHEMA` | json_schema | \ No newline at end of file +- `"text"` +- `"json_object"` +- `"json_schema"` diff --git a/packages/gcp/docs/models/thinkchunk.md b/packages/gcp/docs/models/thinkchunk.md index b07f598e..d825497e 100644 --- a/packages/gcp/docs/models/thinkchunk.md +++ b/packages/gcp/docs/models/thinkchunk.md @@ -7,4 +7,5 @@ | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | `type` | *Literal["thinking"]* | :heavy_check_mark: | N/A | | `thinking` | List[[models.Thinking](../models/thinking.md)] | :heavy_check_mark: | N/A | +| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | Signature to replay some reasoning blocks across turns. | | `closed` | *Optional[bool]* | :heavy_minus_sign: | Whether the thinking chunk is closed or not. Currently only used for prefixing. | \ No newline at end of file diff --git a/packages/gcp/docs/models/tool.md b/packages/gcp/docs/models/tool.md index fb661f72..85888d01 100644 --- a/packages/gcp/docs/models/tool.md +++ b/packages/gcp/docs/models/tool.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `type` | [Optional[models.ToolTypes]](../models/tooltypes.md) | :heavy_minus_sign: | N/A | -| `function` | [models.Function](../models/function.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `type` | *Union[Literal["function"], UnrecognizedStr]* | :heavy_check_mark: | N/A | +| `function` | [models.Function](../models/function.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/toolcall.md b/packages/gcp/docs/models/toolcall.md index 3819236b..9d236e8b 100644 --- a/packages/gcp/docs/models/toolcall.md +++ b/packages/gcp/docs/models/toolcall.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `type` | [Optional[models.ToolTypes]](../models/tooltypes.md) | :heavy_minus_sign: | N/A | -| `function` | [models.FunctionCall](../models/functioncall.md) | :heavy_check_mark: | N/A | -| `index` | *Optional[int]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `type` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `function` | [models.FunctionCall](../models/functioncall.md) | :heavy_check_mark: | N/A | +| `index` | *Optional[int]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/toolchoice.md b/packages/gcp/docs/models/toolchoice.md index 373046bb..a457f96f 100644 --- a/packages/gcp/docs/models/toolchoice.md +++ b/packages/gcp/docs/models/toolchoice.md @@ -7,5 +7,5 @@ ToolChoice is either a ToolChoiceEnum or a ToolChoice | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `type` | [Optional[models.ToolTypes]](../models/tooltypes.md) | :heavy_minus_sign: | N/A | +| `type` | *Optional[str]* | :heavy_minus_sign: | N/A | | `function` | [models.FunctionName](../models/functionname.md) | :heavy_check_mark: | this restriction of `Function` is used to select a specific function to call | \ No newline at end of file diff --git a/packages/gcp/docs/models/toolchoiceenum.md b/packages/gcp/docs/models/toolchoiceenum.md index 0be3d6c5..c97bf912 100644 --- a/packages/gcp/docs/models/toolchoiceenum.md +++ b/packages/gcp/docs/models/toolchoiceenum.md @@ -1,11 +1,16 @@ # ToolChoiceEnum +## Example Usage + +```python +from mistralai.gcp.client.models import ToolChoiceEnum +value: ToolChoiceEnum = "auto" +``` + ## Values -| Name | Value | -| ---------- | ---------- | -| `AUTO` | auto | -| `NONE` | none | -| `ANY` | any | -| `REQUIRED` | required | \ No newline at end of file +- `"auto"` +- `"none"` +- `"any"` +- `"required"` diff --git a/packages/gcp/docs/models/toolconfiguration.md b/packages/gcp/docs/models/toolconfiguration.md new file mode 100644 index 00000000..89286a17 --- /dev/null +++ b/packages/gcp/docs/models/toolconfiguration.md @@ -0,0 +1,10 @@ +# ToolConfiguration + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `exclude` | List[*str*] | :heavy_minus_sign: | N/A | +| `include` | List[*str*] | :heavy_minus_sign: | N/A | +| `requires_confirmation` | List[*str*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/toolreferencechunk.md b/packages/gcp/docs/models/toolreferencechunk.md index 9fc10399..49ea4ca7 100644 --- a/packages/gcp/docs/models/toolreferencechunk.md +++ b/packages/gcp/docs/models/toolreferencechunk.md @@ -3,11 +3,11 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `type` | *Optional[Literal["tool_reference"]]* | :heavy_minus_sign: | N/A | -| `tool` | [models.ToolUnion](../models/toolunion.md) | :heavy_check_mark: | N/A | -| `title` | *str* | :heavy_check_mark: | N/A | -| `url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `favicon` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `type` | *Optional[Literal["tool_reference"]]* | :heavy_minus_sign: | N/A | +| `tool` | [models.ToolReferenceChunkTool](../models/toolreferencechunktool.md) | :heavy_check_mark: | N/A | +| `title` | *str* | :heavy_check_mark: | N/A | +| `url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `favicon` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/toolunion.md b/packages/gcp/docs/models/toolreferencechunktool.md similarity index 87% rename from packages/gcp/docs/models/toolunion.md rename to packages/gcp/docs/models/toolreferencechunktool.md index 2dcb3dee..999f7c34 100644 --- a/packages/gcp/docs/models/toolunion.md +++ b/packages/gcp/docs/models/toolreferencechunktool.md @@ -1,4 +1,4 @@ -# ToolUnion +# ToolReferenceChunkTool ## Supported Types diff --git a/packages/gcp/docs/models/tooltypes.md b/packages/gcp/docs/models/tooltypes.md deleted file mode 100644 index 84e49253..00000000 --- a/packages/gcp/docs/models/tooltypes.md +++ /dev/null @@ -1,8 +0,0 @@ -# ToolTypes - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `FUNCTION` | function | \ No newline at end of file diff --git a/packages/gcp/docs/models/websearchpremiumtool.md b/packages/gcp/docs/models/websearchpremiumtool.md new file mode 100644 index 00000000..78b736cd --- /dev/null +++ b/packages/gcp/docs/models/websearchpremiumtool.md @@ -0,0 +1,9 @@ +# WebSearchPremiumTool + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `tool_configuration` | [OptionalNullable[models.ToolConfiguration]](../models/toolconfiguration.md) | :heavy_minus_sign: | N/A | +| `type` | *Literal["web_search_premium"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/gcp/docs/models/websearchtool.md b/packages/gcp/docs/models/websearchtool.md new file mode 100644 index 00000000..4ca7333c --- /dev/null +++ b/packages/gcp/docs/models/websearchtool.md @@ -0,0 +1,9 @@ +# WebSearchTool + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `tool_configuration` | [OptionalNullable[models.ToolConfiguration]](../models/toolconfiguration.md) | :heavy_minus_sign: | N/A | +| `type` | *Literal["web_search"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/gcp/pyproject.toml b/packages/gcp/pyproject.toml index 5cec57e1..bb0d6ead 100644 --- a/packages/gcp/pyproject.toml +++ b/packages/gcp/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mistralai-gcp" -version = "2.0.0" +version = "2.1.0" description = "Python Client SDK for the Mistral AI API in GCP." authors = [{ name = "Mistral" }] requires-python = ">=3.10" diff --git a/packages/gcp/src/mistralai/gcp/client/_version.py b/packages/gcp/src/mistralai/gcp/client/_version.py index 377c9836..e6a19a24 100644 --- a/packages/gcp/src/mistralai/gcp/client/_version.py +++ b/packages/gcp/src/mistralai/gcp/client/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "mistralai-gcp" -__version__: str = "2.0.0" +__version__: str = "2.1.0" __openapi_doc_version__: str = "1.0.0" -__gen_version__: str = "2.841.0" -__user_agent__: str = "speakeasy-sdk/python 2.0.0 2.841.0 1.0.0 mistralai-gcp" +__gen_version__: str = "2.884.13" +__user_agent__: str = "speakeasy-sdk/python 2.1.0 2.884.13 1.0.0 mistralai-gcp" try: if __package__ is not None: diff --git a/packages/gcp/src/mistralai/gcp/client/basesdk.py b/packages/gcp/src/mistralai/gcp/client/basesdk.py index b3edcb0a..1c518ade 100644 --- a/packages/gcp/src/mistralai/gcp/client/basesdk.py +++ b/packages/gcp/src/mistralai/gcp/client/basesdk.py @@ -7,6 +7,7 @@ AfterErrorContext, AfterSuccessContext, BeforeRequestContext, + HookContext, ) from mistralai.gcp.client.utils import ( RetryConfig, @@ -66,6 +67,7 @@ def _build_request_async( url_override: Optional[str] = None, http_headers: Optional[Mapping[str, str]] = None, allow_empty_value: Optional[List[str]] = None, + allowed_fields: Optional[List[str]] = None, ) -> httpx.Request: client = self.sdk_configuration.async_client return self._build_request_with_client( @@ -87,6 +89,7 @@ def _build_request_async( url_override, http_headers, allow_empty_value, + allowed_fields, ) def _build_request( @@ -110,6 +113,7 @@ def _build_request( url_override: Optional[str] = None, http_headers: Optional[Mapping[str, str]] = None, allow_empty_value: Optional[List[str]] = None, + allowed_fields: Optional[List[str]] = None, ) -> httpx.Request: client = self.sdk_configuration.client return self._build_request_with_client( @@ -131,6 +135,7 @@ def _build_request( url_override, http_headers, allow_empty_value, + allowed_fields, ) def _build_request_with_client( @@ -155,6 +160,7 @@ def _build_request_with_client( url_override: Optional[str] = None, http_headers: Optional[Mapping[str, str]] = None, allow_empty_value: Optional[List[str]] = None, + allowed_fields: Optional[List[str]] = None, ) -> httpx.Request: query_params = {} @@ -188,7 +194,9 @@ def _build_request_with_client( security = security() if security is not None: - security_headers, security_query_params = utils.get_security(security) + security_headers, security_query_params = utils.get_security( + security, allowed_fields + ) headers = {**headers, **security_headers} query_params = {**query_params, **security_query_params} @@ -225,15 +233,15 @@ def _build_request_with_client( data=serialized_request_body.data, files=serialized_request_body.files, headers=headers, - timeout=timeout, + timeout=timeout if timeout is not None else httpx.USE_CLIENT_DEFAULT, ) def do_request( self, - hook_ctx, - request, - error_status_codes, - stream=False, + hook_ctx: HookContext, + request: httpx.Request, + is_error_status_code: Callable[[int], bool], + stream: bool = False, retry_config: Optional[Tuple[RetryConfig, List[str]]] = None, ) -> httpx.Response: client = self.sdk_configuration.client @@ -245,6 +253,8 @@ def do(): http_res = None try: req = hooks.before_request(BeforeRequestContext(hook_ctx), request) + if "timeout" in request.extensions and "timeout" not in req.extensions: + req.extensions["timeout"] = request.extensions["timeout"] logger.debug( "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s", req.method, @@ -275,19 +285,6 @@ def do(): "" if stream else http_res.text, ) - if utils.match_status_codes(error_status_codes, http_res.status_code): - result, err = hooks.after_error( - AfterErrorContext(hook_ctx), http_res, None - ) - if err is not None: - logger.debug("Request Exception", exc_info=True) - raise err - if result is not None: - http_res = result - else: - logger.debug("Raising unexpected SDK error") - raise errors.SDKError("Unexpected error occurred", http_res) - return http_res if retry_config is not None: @@ -295,17 +292,27 @@ def do(): else: http_res = do() - if not utils.match_status_codes(error_status_codes, http_res.status_code): + if is_error_status_code(http_res.status_code): + result, err = hooks.after_error(AfterErrorContext(hook_ctx), http_res, None) + if err is not None: + logger.debug("Request Exception", exc_info=True) + raise err + if result is not None: + http_res = result + else: + logger.debug("Raising unexpected SDK error") + raise errors.SDKError("Unexpected error occurred", http_res) + else: http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res) return http_res async def do_request_async( self, - hook_ctx, - request, - error_status_codes, - stream=False, + hook_ctx: HookContext, + request: httpx.Request, + is_error_status_code: Callable[[int], bool], + stream: bool = False, retry_config: Optional[Tuple[RetryConfig, List[str]]] = None, ) -> httpx.Response: client = self.sdk_configuration.async_client @@ -320,6 +327,8 @@ async def do(): hooks.before_request, BeforeRequestContext(hook_ctx), request ) + if "timeout" in request.extensions and "timeout" not in req.extensions: + req.extensions["timeout"] = request.extensions["timeout"] logger.debug( "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s", req.method, @@ -353,20 +362,6 @@ async def do(): "" if stream else http_res.text, ) - if utils.match_status_codes(error_status_codes, http_res.status_code): - result, err = await run_sync_in_thread( - hooks.after_error, AfterErrorContext(hook_ctx), http_res, None - ) - - if err is not None: - logger.debug("Request Exception", exc_info=True) - raise err - if result is not None: - http_res = result - else: - logger.debug("Raising unexpected SDK error") - raise errors.SDKError("Unexpected error occurred", http_res) - return http_res if retry_config is not None: @@ -376,7 +371,20 @@ async def do(): else: http_res = await do() - if not utils.match_status_codes(error_status_codes, http_res.status_code): + if is_error_status_code(http_res.status_code): + result, err = await run_sync_in_thread( + hooks.after_error, AfterErrorContext(hook_ctx), http_res, None + ) + + if err is not None: + logger.debug("Request Exception", exc_info=True) + raise err + if result is not None: + http_res = result + else: + logger.debug("Raising unexpected SDK error") + raise errors.SDKError("Unexpected error occurred", http_res) + else: http_res = await run_sync_in_thread( hooks.after_success, AfterSuccessContext(hook_ctx), http_res ) diff --git a/packages/gcp/src/mistralai/gcp/client/chat.py b/packages/gcp/src/mistralai/gcp/client/chat.py index 925d69ed..8a9abf59 100644 --- a/packages/gcp/src/mistralai/gcp/client/chat.py +++ b/packages/gcp/src/mistralai/gcp/client/chat.py @@ -21,22 +21,25 @@ def stream( List[models.ChatCompletionStreamRequestMessageTypedDict], ], temperature: OptionalNullable[float] = UNSET, - top_p: Optional[float] = None, + top_p: OptionalNullable[float] = UNSET, max_tokens: OptionalNullable[int] = UNSET, stream: Optional[bool] = True, - stop: Optional[ + stop: OptionalNullable[ Union[ models.ChatCompletionStreamRequestStop, models.ChatCompletionStreamRequestStopTypedDict, ] - ] = None, + ] = UNSET, random_seed: OptionalNullable[int] = UNSET, metadata: OptionalNullable[Dict[str, Any]] = UNSET, response_format: Optional[ Union[models.ResponseFormat, models.ResponseFormatTypedDict] ] = None, tools: OptionalNullable[ - Union[List[models.Tool], List[models.ToolTypedDict]] + Union[ + List[models.ChatCompletionStreamRequestTool], + List[models.ChatCompletionStreamRequestToolTypedDict], + ] ] = UNSET, tool_choice: Optional[ Union[ @@ -44,14 +47,18 @@ def stream( models.ChatCompletionStreamRequestToolChoiceTypedDict, ] ] = None, - presence_penalty: Optional[float] = None, - frequency_penalty: Optional[float] = None, + presence_penalty: OptionalNullable[float] = UNSET, + frequency_penalty: OptionalNullable[float] = UNSET, n: OptionalNullable[int] = UNSET, prediction: Optional[ Union[models.Prediction, models.PredictionTypedDict] ] = None, parallel_tool_calls: Optional[bool] = None, + reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET, prompt_mode: OptionalNullable[models.MistralPromptMode] = UNSET, + guardrails: OptionalNullable[ + Union[List[models.GuardrailConfig], List[models.GuardrailConfigTypedDict]] + ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -78,7 +85,9 @@ def stream( :param n: Number of completions to return for each request, input tokens are only billed once. :param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content. :param parallel_tool_calls: Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel. + :param reasoning_effort: :param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used. + :param guardrails: :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 @@ -89,6 +98,9 @@ def stream( if timeout_ms is None: timeout_ms = self.sdk_configuration.timeout_ms + if timeout_ms is None: + timeout_ms = 60000 + if server_url is not None: base_url = server_url else: @@ -109,7 +121,9 @@ def stream( response_format=utils.get_pydantic_model( response_format, Optional[models.ResponseFormat] ), - tools=utils.get_pydantic_model(tools, OptionalNullable[List[models.Tool]]), + tools=utils.get_pydantic_model( + tools, OptionalNullable[List[models.ChatCompletionStreamRequestTool]] + ), tool_choice=utils.get_pydantic_model( tool_choice, Optional[models.ChatCompletionStreamRequestToolChoice] ), @@ -120,7 +134,11 @@ def stream( prediction, Optional[models.Prediction] ), parallel_tool_calls=parallel_tool_calls, + reasoning_effort=reasoning_effort, prompt_mode=prompt_mode, + guardrails=utils.get_pydantic_model( + guardrails, OptionalNullable[List[models.GuardrailConfig]] + ), ) req = self._build_request( @@ -160,7 +178,7 @@ def stream( security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["422", "4XX", "5XX"], + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), stream=True, retry_config=retry_config, ) @@ -198,22 +216,25 @@ async def stream_async( List[models.ChatCompletionStreamRequestMessageTypedDict], ], temperature: OptionalNullable[float] = UNSET, - top_p: Optional[float] = None, + top_p: OptionalNullable[float] = UNSET, max_tokens: OptionalNullable[int] = UNSET, stream: Optional[bool] = True, - stop: Optional[ + stop: OptionalNullable[ Union[ models.ChatCompletionStreamRequestStop, models.ChatCompletionStreamRequestStopTypedDict, ] - ] = None, + ] = UNSET, random_seed: OptionalNullable[int] = UNSET, metadata: OptionalNullable[Dict[str, Any]] = UNSET, response_format: Optional[ Union[models.ResponseFormat, models.ResponseFormatTypedDict] ] = None, tools: OptionalNullable[ - Union[List[models.Tool], List[models.ToolTypedDict]] + Union[ + List[models.ChatCompletionStreamRequestTool], + List[models.ChatCompletionStreamRequestToolTypedDict], + ] ] = UNSET, tool_choice: Optional[ Union[ @@ -221,14 +242,18 @@ async def stream_async( models.ChatCompletionStreamRequestToolChoiceTypedDict, ] ] = None, - presence_penalty: Optional[float] = None, - frequency_penalty: Optional[float] = None, + presence_penalty: OptionalNullable[float] = UNSET, + frequency_penalty: OptionalNullable[float] = UNSET, n: OptionalNullable[int] = UNSET, prediction: Optional[ Union[models.Prediction, models.PredictionTypedDict] ] = None, parallel_tool_calls: Optional[bool] = None, + reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET, prompt_mode: OptionalNullable[models.MistralPromptMode] = UNSET, + guardrails: OptionalNullable[ + Union[List[models.GuardrailConfig], List[models.GuardrailConfigTypedDict]] + ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -255,7 +280,9 @@ async def stream_async( :param n: Number of completions to return for each request, input tokens are only billed once. :param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content. :param parallel_tool_calls: Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel. + :param reasoning_effort: :param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used. + :param guardrails: :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 @@ -266,6 +293,9 @@ async def stream_async( if timeout_ms is None: timeout_ms = self.sdk_configuration.timeout_ms + if timeout_ms is None: + timeout_ms = 60000 + if server_url is not None: base_url = server_url else: @@ -286,7 +316,9 @@ async def stream_async( response_format=utils.get_pydantic_model( response_format, Optional[models.ResponseFormat] ), - tools=utils.get_pydantic_model(tools, OptionalNullable[List[models.Tool]]), + tools=utils.get_pydantic_model( + tools, OptionalNullable[List[models.ChatCompletionStreamRequestTool]] + ), tool_choice=utils.get_pydantic_model( tool_choice, Optional[models.ChatCompletionStreamRequestToolChoice] ), @@ -297,7 +329,11 @@ async def stream_async( prediction, Optional[models.Prediction] ), parallel_tool_calls=parallel_tool_calls, + reasoning_effort=reasoning_effort, prompt_mode=prompt_mode, + guardrails=utils.get_pydantic_model( + guardrails, OptionalNullable[List[models.GuardrailConfig]] + ), ) req = self._build_request_async( @@ -337,7 +373,7 @@ async def stream_async( security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["422", "4XX", "5XX"], + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), stream=True, retry_config=retry_config, ) @@ -375,22 +411,25 @@ def complete( List[models.ChatCompletionRequestMessageTypedDict], ], temperature: OptionalNullable[float] = UNSET, - top_p: Optional[float] = None, + top_p: OptionalNullable[float] = UNSET, max_tokens: OptionalNullable[int] = UNSET, stream: Optional[bool] = False, - stop: Optional[ + stop: OptionalNullable[ Union[ models.ChatCompletionRequestStop, models.ChatCompletionRequestStopTypedDict, ] - ] = None, + ] = UNSET, random_seed: OptionalNullable[int] = UNSET, metadata: OptionalNullable[Dict[str, Any]] = UNSET, response_format: Optional[ Union[models.ResponseFormat, models.ResponseFormatTypedDict] ] = None, tools: OptionalNullable[ - Union[List[models.Tool], List[models.ToolTypedDict]] + Union[ + List[models.ChatCompletionRequestTool], + List[models.ChatCompletionRequestToolTypedDict], + ] ] = UNSET, tool_choice: Optional[ Union[ @@ -398,14 +437,18 @@ def complete( models.ChatCompletionRequestToolChoiceTypedDict, ] ] = None, - presence_penalty: Optional[float] = None, - frequency_penalty: Optional[float] = None, + presence_penalty: OptionalNullable[float] = UNSET, + frequency_penalty: OptionalNullable[float] = UNSET, n: OptionalNullable[int] = UNSET, prediction: Optional[ Union[models.Prediction, models.PredictionTypedDict] ] = None, parallel_tool_calls: Optional[bool] = None, + reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET, prompt_mode: OptionalNullable[models.MistralPromptMode] = UNSET, + guardrails: OptionalNullable[ + Union[List[models.GuardrailConfig], List[models.GuardrailConfigTypedDict]] + ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -430,7 +473,9 @@ def complete( :param n: Number of completions to return for each request, input tokens are only billed once. :param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content. :param parallel_tool_calls: Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel. + :param reasoning_effort: :param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used. + :param guardrails: :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 @@ -441,6 +486,9 @@ def complete( if timeout_ms is None: timeout_ms = self.sdk_configuration.timeout_ms + if timeout_ms is None: + timeout_ms = 60000 + if server_url is not None: base_url = server_url else: @@ -461,7 +509,9 @@ def complete( response_format=utils.get_pydantic_model( response_format, Optional[models.ResponseFormat] ), - tools=utils.get_pydantic_model(tools, OptionalNullable[List[models.Tool]]), + tools=utils.get_pydantic_model( + tools, OptionalNullable[List[models.ChatCompletionRequestTool]] + ), tool_choice=utils.get_pydantic_model( tool_choice, Optional[models.ChatCompletionRequestToolChoice] ), @@ -472,7 +522,11 @@ def complete( prediction, Optional[models.Prediction] ), parallel_tool_calls=parallel_tool_calls, + reasoning_effort=reasoning_effort, prompt_mode=prompt_mode, + guardrails=utils.get_pydantic_model( + guardrails, OptionalNullable[List[models.GuardrailConfig]] + ), ) req = self._build_request( @@ -512,7 +566,7 @@ def complete( security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["422", "4XX", "5XX"], + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), retry_config=retry_config, ) @@ -542,22 +596,25 @@ async def complete_async( List[models.ChatCompletionRequestMessageTypedDict], ], temperature: OptionalNullable[float] = UNSET, - top_p: Optional[float] = None, + top_p: OptionalNullable[float] = UNSET, max_tokens: OptionalNullable[int] = UNSET, stream: Optional[bool] = False, - stop: Optional[ + stop: OptionalNullable[ Union[ models.ChatCompletionRequestStop, models.ChatCompletionRequestStopTypedDict, ] - ] = None, + ] = UNSET, random_seed: OptionalNullable[int] = UNSET, metadata: OptionalNullable[Dict[str, Any]] = UNSET, response_format: Optional[ Union[models.ResponseFormat, models.ResponseFormatTypedDict] ] = None, tools: OptionalNullable[ - Union[List[models.Tool], List[models.ToolTypedDict]] + Union[ + List[models.ChatCompletionRequestTool], + List[models.ChatCompletionRequestToolTypedDict], + ] ] = UNSET, tool_choice: Optional[ Union[ @@ -565,14 +622,18 @@ async def complete_async( models.ChatCompletionRequestToolChoiceTypedDict, ] ] = None, - presence_penalty: Optional[float] = None, - frequency_penalty: Optional[float] = None, + presence_penalty: OptionalNullable[float] = UNSET, + frequency_penalty: OptionalNullable[float] = UNSET, n: OptionalNullable[int] = UNSET, prediction: Optional[ Union[models.Prediction, models.PredictionTypedDict] ] = None, parallel_tool_calls: Optional[bool] = None, + reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET, prompt_mode: OptionalNullable[models.MistralPromptMode] = UNSET, + guardrails: OptionalNullable[ + Union[List[models.GuardrailConfig], List[models.GuardrailConfigTypedDict]] + ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -597,7 +658,9 @@ async def complete_async( :param n: Number of completions to return for each request, input tokens are only billed once. :param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content. :param parallel_tool_calls: Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel. + :param reasoning_effort: :param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used. + :param guardrails: :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 @@ -608,6 +671,9 @@ async def complete_async( if timeout_ms is None: timeout_ms = self.sdk_configuration.timeout_ms + if timeout_ms is None: + timeout_ms = 60000 + if server_url is not None: base_url = server_url else: @@ -628,7 +694,9 @@ async def complete_async( response_format=utils.get_pydantic_model( response_format, Optional[models.ResponseFormat] ), - tools=utils.get_pydantic_model(tools, OptionalNullable[List[models.Tool]]), + tools=utils.get_pydantic_model( + tools, OptionalNullable[List[models.ChatCompletionRequestTool]] + ), tool_choice=utils.get_pydantic_model( tool_choice, Optional[models.ChatCompletionRequestToolChoice] ), @@ -639,7 +707,11 @@ async def complete_async( prediction, Optional[models.Prediction] ), parallel_tool_calls=parallel_tool_calls, + reasoning_effort=reasoning_effort, prompt_mode=prompt_mode, + guardrails=utils.get_pydantic_model( + guardrails, OptionalNullable[List[models.GuardrailConfig]] + ), ) req = self._build_request_async( @@ -679,7 +751,7 @@ async def complete_async( security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["422", "4XX", "5XX"], + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), retry_config=retry_config, ) diff --git a/packages/gcp/src/mistralai/gcp/client/fim.py b/packages/gcp/src/mistralai/gcp/client/fim.py index 4202102a..cd5abaf8 100644 --- a/packages/gcp/src/mistralai/gcp/client/fim.py +++ b/packages/gcp/src/mistralai/gcp/client/fim.py @@ -18,15 +18,15 @@ def stream( model: str, prompt: str, temperature: OptionalNullable[float] = UNSET, - top_p: Optional[float] = 1, + top_p: OptionalNullable[float] = UNSET, max_tokens: OptionalNullable[int] = UNSET, stream: Optional[bool] = True, - stop: Optional[ + stop: OptionalNullable[ Union[ models.FIMCompletionStreamRequestStop, models.FIMCompletionStreamRequestStopTypedDict, ] - ] = None, + ] = UNSET, random_seed: OptionalNullable[int] = UNSET, metadata: OptionalNullable[Dict[str, Any]] = UNSET, suffix: OptionalNullable[str] = UNSET, @@ -61,6 +61,9 @@ def stream( if timeout_ms is None: timeout_ms = self.sdk_configuration.timeout_ms + if timeout_ms is None: + timeout_ms = 60000 + if server_url is not None: base_url = server_url else: @@ -117,7 +120,7 @@ def stream( security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["422", "4XX", "5XX"], + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), stream=True, retry_config=retry_config, ) @@ -152,15 +155,15 @@ async def stream_async( model: str, prompt: str, temperature: OptionalNullable[float] = UNSET, - top_p: Optional[float] = 1, + top_p: OptionalNullable[float] = UNSET, max_tokens: OptionalNullable[int] = UNSET, stream: Optional[bool] = True, - stop: Optional[ + stop: OptionalNullable[ Union[ models.FIMCompletionStreamRequestStop, models.FIMCompletionStreamRequestStopTypedDict, ] - ] = None, + ] = UNSET, random_seed: OptionalNullable[int] = UNSET, metadata: OptionalNullable[Dict[str, Any]] = UNSET, suffix: OptionalNullable[str] = UNSET, @@ -195,6 +198,9 @@ async def stream_async( if timeout_ms is None: timeout_ms = self.sdk_configuration.timeout_ms + if timeout_ms is None: + timeout_ms = 60000 + if server_url is not None: base_url = server_url else: @@ -251,7 +257,7 @@ async def stream_async( security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["422", "4XX", "5XX"], + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), stream=True, retry_config=retry_config, ) @@ -286,15 +292,15 @@ def complete( model: str, prompt: str, temperature: OptionalNullable[float] = UNSET, - top_p: Optional[float] = 1, + top_p: OptionalNullable[float] = UNSET, max_tokens: OptionalNullable[int] = UNSET, stream: Optional[bool] = False, - stop: Optional[ + stop: OptionalNullable[ Union[ models.FIMCompletionRequestStop, models.FIMCompletionRequestStopTypedDict, ] - ] = None, + ] = UNSET, random_seed: OptionalNullable[int] = UNSET, metadata: OptionalNullable[Dict[str, Any]] = UNSET, suffix: OptionalNullable[str] = UNSET, @@ -329,6 +335,9 @@ def complete( if timeout_ms is None: timeout_ms = self.sdk_configuration.timeout_ms + if timeout_ms is None: + timeout_ms = 60000 + if server_url is not None: base_url = server_url else: @@ -385,7 +394,7 @@ def complete( security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["422", "4XX", "5XX"], + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), retry_config=retry_config, ) @@ -412,15 +421,15 @@ async def complete_async( model: str, prompt: str, temperature: OptionalNullable[float] = UNSET, - top_p: Optional[float] = 1, + top_p: OptionalNullable[float] = UNSET, max_tokens: OptionalNullable[int] = UNSET, stream: Optional[bool] = False, - stop: Optional[ + stop: OptionalNullable[ Union[ models.FIMCompletionRequestStop, models.FIMCompletionRequestStopTypedDict, ] - ] = None, + ] = UNSET, random_seed: OptionalNullable[int] = UNSET, metadata: OptionalNullable[Dict[str, Any]] = UNSET, suffix: OptionalNullable[str] = UNSET, @@ -455,6 +464,9 @@ async def complete_async( if timeout_ms is None: timeout_ms = self.sdk_configuration.timeout_ms + if timeout_ms is None: + timeout_ms = 60000 + if server_url is not None: base_url = server_url else: @@ -511,7 +523,7 @@ async def complete_async( security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["422", "4XX", "5XX"], + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), retry_config=retry_config, ) diff --git a/packages/gcp/src/mistralai/gcp/client/models/__init__.py b/packages/gcp/src/mistralai/gcp/client/models/__init__.py index e42ed4bb..f7a311a2 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/__init__.py +++ b/packages/gcp/src/mistralai/gcp/client/models/__init__.py @@ -5,6 +5,7 @@ from mistralai.gcp.client.utils.dynamic_imports import lazy_getattr, lazy_dir if TYPE_CHECKING: + from .apikeyauth import APIKeyAuth, APIKeyAuthTypedDict from .assistantmessage import ( AssistantMessage, AssistantMessageContent, @@ -23,8 +24,10 @@ ChatCompletionRequestMessageTypedDict, ChatCompletionRequestStop, ChatCompletionRequestStopTypedDict, + ChatCompletionRequestTool, ChatCompletionRequestToolChoice, ChatCompletionRequestToolChoiceTypedDict, + ChatCompletionRequestToolTypedDict, ChatCompletionRequestTypedDict, ) from .chatcompletionresponse import ( @@ -37,10 +40,13 @@ ChatCompletionStreamRequestMessageTypedDict, ChatCompletionStreamRequestStop, ChatCompletionStreamRequestStopTypedDict, + ChatCompletionStreamRequestTool, ChatCompletionStreamRequestToolChoice, ChatCompletionStreamRequestToolChoiceTypedDict, + ChatCompletionStreamRequestToolTypedDict, ChatCompletionStreamRequestTypedDict, ) + from .codeinterpretertool import CodeInterpreterTool, CodeInterpreterToolTypedDict from .completionchunk import CompletionChunk, CompletionChunkTypedDict from .completionevent import CompletionEvent, CompletionEventTypedDict from .completionresponsestreamchoice import ( @@ -49,12 +55,19 @@ CompletionResponseStreamChoiceTypedDict, ) from .contentchunk import ContentChunk, ContentChunkTypedDict, UnknownContentChunk + from .customconnector import ( + Authorization, + AuthorizationTypedDict, + CustomConnector, + CustomConnectorTypedDict, + ) from .deltamessage import ( DeltaMessage, DeltaMessageContent, DeltaMessageContentTypedDict, DeltaMessageTypedDict, ) + from .documentlibrarytool import DocumentLibraryTool, DocumentLibraryToolTypedDict from .fimcompletionrequest import ( FIMCompletionRequest, FIMCompletionRequestStop, @@ -79,7 +92,9 @@ FunctionCallTypedDict, ) from .functionname import FunctionName, FunctionNameTypedDict + from .guardrailconfig import GuardrailConfig, GuardrailConfigTypedDict from .imagedetail import ImageDetail + from .imagegenerationtool import ImageGenerationTool, ImageGenerationToolTypedDict from .imageurl import ImageURL, ImageURLTypedDict from .imageurlchunk import ( ImageURLChunk, @@ -89,8 +104,32 @@ ) from .jsonschema import JSONSchema, JSONSchemaTypedDict from .mistralpromptmode import MistralPromptMode + from .moderationllmaction import ModerationLLMAction + from .moderationllmv1categorythresholds import ( + ModerationLlmv1CategoryThresholds, + ModerationLlmv1CategoryThresholdsTypedDict, + ) + from .moderationllmv1config import ( + ModerationLlmv1Config, + ModerationLlmv1ConfigTypedDict, + ) + from .moderationllmv2categorythresholds import ( + ModerationLlmv2CategoryThresholds, + ModerationLlmv2CategoryThresholdsTypedDict, + ) + from .moderationllmv2config import ( + ModerationLlmv2Config, + ModerationLlmv2ConfigTypedDict, + ) + from .oauth2tokenauth import OAuth2TokenAuth, OAuth2TokenAuthTypedDict from .prediction import Prediction, PredictionTypedDict - from .referencechunk import ReferenceChunk, ReferenceChunkTypedDict + from .reasoningeffort import ReasoningEffort + from .referencechunk import ( + ReferenceChunk, + ReferenceChunkTypedDict, + ReferenceID, + ReferenceIDTypedDict, + ) from .responseformat import ResponseFormat, ResponseFormatTypedDict from .responseformats import ResponseFormats from .security import Security, SecurityTypedDict @@ -110,6 +149,7 @@ from .toolcall import ToolCall, ToolCallTypedDict from .toolchoice import ToolChoice, ToolChoiceTypedDict from .toolchoiceenum import ToolChoiceEnum + from .toolconfiguration import ToolConfiguration, ToolConfigurationTypedDict from .toolmessage import ( ToolMessage, ToolMessageContent, @@ -118,11 +158,10 @@ ) from .toolreferencechunk import ( ToolReferenceChunk, + ToolReferenceChunkTool, + ToolReferenceChunkToolTypedDict, ToolReferenceChunkTypedDict, - ToolUnion, - ToolUnionTypedDict, ) - from .tooltypes import ToolTypes from .usageinfo import UsageInfo, UsageInfoTypedDict from .usermessage import ( UserMessage, @@ -138,14 +177,23 @@ ValidationError, ValidationErrorTypedDict, ) + from .websearchpremiumtool import ( + WebSearchPremiumTool, + WebSearchPremiumToolTypedDict, + ) + from .websearchtool import WebSearchTool, WebSearchToolTypedDict __all__ = [ + "APIKeyAuth", + "APIKeyAuthTypedDict", "Arguments", "ArgumentsTypedDict", "AssistantMessage", "AssistantMessageContent", "AssistantMessageContentTypedDict", "AssistantMessageTypedDict", + "Authorization", + "AuthorizationTypedDict", "BuiltInConnectors", "ChatCompletionChoice", "ChatCompletionChoiceFinishReason", @@ -155,8 +203,10 @@ "ChatCompletionRequestMessageTypedDict", "ChatCompletionRequestStop", "ChatCompletionRequestStopTypedDict", + "ChatCompletionRequestTool", "ChatCompletionRequestToolChoice", "ChatCompletionRequestToolChoiceTypedDict", + "ChatCompletionRequestToolTypedDict", "ChatCompletionRequestTypedDict", "ChatCompletionResponse", "ChatCompletionResponseTypedDict", @@ -165,9 +215,13 @@ "ChatCompletionStreamRequestMessageTypedDict", "ChatCompletionStreamRequestStop", "ChatCompletionStreamRequestStopTypedDict", + "ChatCompletionStreamRequestTool", "ChatCompletionStreamRequestToolChoice", "ChatCompletionStreamRequestToolChoiceTypedDict", + "ChatCompletionStreamRequestToolTypedDict", "ChatCompletionStreamRequestTypedDict", + "CodeInterpreterTool", + "CodeInterpreterToolTypedDict", "CompletionChunk", "CompletionChunkTypedDict", "CompletionEvent", @@ -179,10 +233,14 @@ "ContentChunkTypedDict", "Context", "ContextTypedDict", + "CustomConnector", + "CustomConnectorTypedDict", "DeltaMessage", "DeltaMessageContent", "DeltaMessageContentTypedDict", "DeltaMessageTypedDict", + "DocumentLibraryTool", + "DocumentLibraryToolTypedDict", "FIMCompletionRequest", "FIMCompletionRequestStop", "FIMCompletionRequestStopTypedDict", @@ -199,7 +257,11 @@ "FunctionName", "FunctionNameTypedDict", "FunctionTypedDict", + "GuardrailConfig", + "GuardrailConfigTypedDict", "ImageDetail", + "ImageGenerationTool", + "ImageGenerationToolTypedDict", "ImageURL", "ImageURLChunk", "ImageURLChunkTypedDict", @@ -211,10 +273,24 @@ "Loc", "LocTypedDict", "MistralPromptMode", + "ModerationLLMAction", + "ModerationLlmv1CategoryThresholds", + "ModerationLlmv1CategoryThresholdsTypedDict", + "ModerationLlmv1Config", + "ModerationLlmv1ConfigTypedDict", + "ModerationLlmv2CategoryThresholds", + "ModerationLlmv2CategoryThresholdsTypedDict", + "ModerationLlmv2Config", + "ModerationLlmv2ConfigTypedDict", + "OAuth2TokenAuth", + "OAuth2TokenAuthTypedDict", "Prediction", "PredictionTypedDict", + "ReasoningEffort", "ReferenceChunk", "ReferenceChunkTypedDict", + "ReferenceID", + "ReferenceIDTypedDict", "ResponseFormat", "ResponseFormatTypedDict", "ResponseFormats", @@ -238,16 +314,17 @@ "ToolChoice", "ToolChoiceEnum", "ToolChoiceTypedDict", + "ToolConfiguration", + "ToolConfigurationTypedDict", "ToolMessage", "ToolMessageContent", "ToolMessageContentTypedDict", "ToolMessageTypedDict", "ToolReferenceChunk", + "ToolReferenceChunkTool", + "ToolReferenceChunkToolTypedDict", "ToolReferenceChunkTypedDict", "ToolTypedDict", - "ToolTypes", - "ToolUnion", - "ToolUnionTypedDict", "UnknownContentChunk", "UsageInfo", "UsageInfoTypedDict", @@ -257,9 +334,15 @@ "UserMessageTypedDict", "ValidationError", "ValidationErrorTypedDict", + "WebSearchPremiumTool", + "WebSearchPremiumToolTypedDict", + "WebSearchTool", + "WebSearchToolTypedDict", ] _dynamic_imports: dict[str, str] = { + "APIKeyAuth": ".apikeyauth", + "APIKeyAuthTypedDict": ".apikeyauth", "AssistantMessage": ".assistantmessage", "AssistantMessageContent": ".assistantmessage", "AssistantMessageContentTypedDict": ".assistantmessage", @@ -273,8 +356,10 @@ "ChatCompletionRequestMessageTypedDict": ".chatcompletionrequest", "ChatCompletionRequestStop": ".chatcompletionrequest", "ChatCompletionRequestStopTypedDict": ".chatcompletionrequest", + "ChatCompletionRequestTool": ".chatcompletionrequest", "ChatCompletionRequestToolChoice": ".chatcompletionrequest", "ChatCompletionRequestToolChoiceTypedDict": ".chatcompletionrequest", + "ChatCompletionRequestToolTypedDict": ".chatcompletionrequest", "ChatCompletionRequestTypedDict": ".chatcompletionrequest", "ChatCompletionResponse": ".chatcompletionresponse", "ChatCompletionResponseTypedDict": ".chatcompletionresponse", @@ -283,9 +368,13 @@ "ChatCompletionStreamRequestMessageTypedDict": ".chatcompletionstreamrequest", "ChatCompletionStreamRequestStop": ".chatcompletionstreamrequest", "ChatCompletionStreamRequestStopTypedDict": ".chatcompletionstreamrequest", + "ChatCompletionStreamRequestTool": ".chatcompletionstreamrequest", "ChatCompletionStreamRequestToolChoice": ".chatcompletionstreamrequest", "ChatCompletionStreamRequestToolChoiceTypedDict": ".chatcompletionstreamrequest", + "ChatCompletionStreamRequestToolTypedDict": ".chatcompletionstreamrequest", "ChatCompletionStreamRequestTypedDict": ".chatcompletionstreamrequest", + "CodeInterpreterTool": ".codeinterpretertool", + "CodeInterpreterToolTypedDict": ".codeinterpretertool", "CompletionChunk": ".completionchunk", "CompletionChunkTypedDict": ".completionchunk", "CompletionEvent": ".completionevent", @@ -296,10 +385,16 @@ "ContentChunk": ".contentchunk", "ContentChunkTypedDict": ".contentchunk", "UnknownContentChunk": ".contentchunk", + "Authorization": ".customconnector", + "AuthorizationTypedDict": ".customconnector", + "CustomConnector": ".customconnector", + "CustomConnectorTypedDict": ".customconnector", "DeltaMessage": ".deltamessage", "DeltaMessageContent": ".deltamessage", "DeltaMessageContentTypedDict": ".deltamessage", "DeltaMessageTypedDict": ".deltamessage", + "DocumentLibraryTool": ".documentlibrarytool", + "DocumentLibraryToolTypedDict": ".documentlibrarytool", "FIMCompletionRequest": ".fimcompletionrequest", "FIMCompletionRequestStop": ".fimcompletionrequest", "FIMCompletionRequestStopTypedDict": ".fimcompletionrequest", @@ -318,7 +413,11 @@ "FunctionCallTypedDict": ".functioncall", "FunctionName": ".functionname", "FunctionNameTypedDict": ".functionname", + "GuardrailConfig": ".guardrailconfig", + "GuardrailConfigTypedDict": ".guardrailconfig", "ImageDetail": ".imagedetail", + "ImageGenerationTool": ".imagegenerationtool", + "ImageGenerationToolTypedDict": ".imagegenerationtool", "ImageURL": ".imageurl", "ImageURLTypedDict": ".imageurl", "ImageURLChunk": ".imageurlchunk", @@ -328,10 +427,24 @@ "JSONSchema": ".jsonschema", "JSONSchemaTypedDict": ".jsonschema", "MistralPromptMode": ".mistralpromptmode", + "ModerationLLMAction": ".moderationllmaction", + "ModerationLlmv1CategoryThresholds": ".moderationllmv1categorythresholds", + "ModerationLlmv1CategoryThresholdsTypedDict": ".moderationllmv1categorythresholds", + "ModerationLlmv1Config": ".moderationllmv1config", + "ModerationLlmv1ConfigTypedDict": ".moderationllmv1config", + "ModerationLlmv2CategoryThresholds": ".moderationllmv2categorythresholds", + "ModerationLlmv2CategoryThresholdsTypedDict": ".moderationllmv2categorythresholds", + "ModerationLlmv2Config": ".moderationllmv2config", + "ModerationLlmv2ConfigTypedDict": ".moderationllmv2config", + "OAuth2TokenAuth": ".oauth2tokenauth", + "OAuth2TokenAuthTypedDict": ".oauth2tokenauth", "Prediction": ".prediction", "PredictionTypedDict": ".prediction", + "ReasoningEffort": ".reasoningeffort", "ReferenceChunk": ".referencechunk", "ReferenceChunkTypedDict": ".referencechunk", + "ReferenceID": ".referencechunk", + "ReferenceIDTypedDict": ".referencechunk", "ResponseFormat": ".responseformat", "ResponseFormatTypedDict": ".responseformat", "ResponseFormats": ".responseformats", @@ -356,15 +469,16 @@ "ToolChoice": ".toolchoice", "ToolChoiceTypedDict": ".toolchoice", "ToolChoiceEnum": ".toolchoiceenum", + "ToolConfiguration": ".toolconfiguration", + "ToolConfigurationTypedDict": ".toolconfiguration", "ToolMessage": ".toolmessage", "ToolMessageContent": ".toolmessage", "ToolMessageContentTypedDict": ".toolmessage", "ToolMessageTypedDict": ".toolmessage", "ToolReferenceChunk": ".toolreferencechunk", + "ToolReferenceChunkTool": ".toolreferencechunk", + "ToolReferenceChunkToolTypedDict": ".toolreferencechunk", "ToolReferenceChunkTypedDict": ".toolreferencechunk", - "ToolUnion": ".toolreferencechunk", - "ToolUnionTypedDict": ".toolreferencechunk", - "ToolTypes": ".tooltypes", "UsageInfo": ".usageinfo", "UsageInfoTypedDict": ".usageinfo", "UserMessage": ".usermessage", @@ -377,6 +491,10 @@ "LocTypedDict": ".validationerror", "ValidationError": ".validationerror", "ValidationErrorTypedDict": ".validationerror", + "WebSearchPremiumTool": ".websearchpremiumtool", + "WebSearchPremiumToolTypedDict": ".websearchpremiumtool", + "WebSearchTool": ".websearchtool", + "WebSearchToolTypedDict": ".websearchtool", } diff --git a/packages/gcp/src/mistralai/gcp/client/models/apikeyauth.py b/packages/gcp/src/mistralai/gcp/client/models/apikeyauth.py new file mode 100644 index 00000000..99d2ad79 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/apikeyauth.py @@ -0,0 +1,29 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.gcp.client.types import BaseModel +from mistralai.gcp.client.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, TypedDict + + +class APIKeyAuthTypedDict(TypedDict): + value: str + type: Literal["api-key"] + + +class APIKeyAuth(BaseModel): + value: str + + type: Annotated[ + Annotated[Literal["api-key"], AfterValidator(validate_const("api-key"))], + pydantic.Field(alias="type"), + ] = "api-key" + + +try: + APIKeyAuth.model_rebuild() +except NameError: + pass diff --git a/packages/gcp/src/mistralai/gcp/client/models/assistantmessage.py b/packages/gcp/src/mistralai/gcp/client/models/assistantmessage.py index 702ac470..63f3b0dd 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/assistantmessage.py +++ b/packages/gcp/src/mistralai/gcp/client/models/assistantmessage.py @@ -60,7 +60,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/chatcompletionchoice.py b/packages/gcp/src/mistralai/gcp/client/models/chatcompletionchoice.py index ae5a2fbf..89f4868b 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/chatcompletionchoice.py +++ b/packages/gcp/src/mistralai/gcp/client/models/chatcompletionchoice.py @@ -2,9 +2,11 @@ from __future__ import annotations from .assistantmessage import AssistantMessage, AssistantMessageTypedDict -from mistralai.gcp.client.types import BaseModel, UnrecognizedStr -from typing import Literal, Union -from typing_extensions import TypedDict +from .deltamessage import DeltaMessage, DeltaMessageTypedDict +from mistralai.gcp.client.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict ChatCompletionChoiceFinishReason = Union[ @@ -21,13 +23,32 @@ class ChatCompletionChoiceTypedDict(TypedDict): index: int - message: AssistantMessageTypedDict finish_reason: ChatCompletionChoiceFinishReason + message: NotRequired[AssistantMessageTypedDict] + messages: NotRequired[List[DeltaMessageTypedDict]] class ChatCompletionChoice(BaseModel): index: int - message: AssistantMessage - finish_reason: ChatCompletionChoiceFinishReason + + message: Optional[AssistantMessage] = None + + messages: Optional[List[DeltaMessage]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["message", "messages"]) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/chatcompletionrequest.py b/packages/gcp/src/mistralai/gcp/client/models/chatcompletionrequest.py index 8229c5bb..0e3de413 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/chatcompletionrequest.py +++ b/packages/gcp/src/mistralai/gcp/client/models/chatcompletionrequest.py @@ -2,8 +2,14 @@ from __future__ import annotations from .assistantmessage import AssistantMessage, AssistantMessageTypedDict +from .codeinterpretertool import CodeInterpreterTool, CodeInterpreterToolTypedDict +from .customconnector import CustomConnector, CustomConnectorTypedDict +from .documentlibrarytool import DocumentLibraryTool, DocumentLibraryToolTypedDict +from .guardrailconfig import GuardrailConfig, GuardrailConfigTypedDict +from .imagegenerationtool import ImageGenerationTool, ImageGenerationToolTypedDict from .mistralpromptmode import MistralPromptMode from .prediction import Prediction, PredictionTypedDict +from .reasoningeffort import ReasoningEffort from .responseformat import ResponseFormat, ResponseFormatTypedDict from .systemmessage import SystemMessage, SystemMessageTypedDict from .tool import Tool, ToolTypedDict @@ -11,6 +17,8 @@ from .toolchoiceenum import ToolChoiceEnum from .toolmessage import ToolMessage, ToolMessageTypedDict from .usermessage import UserMessage, UserMessageTypedDict +from .websearchpremiumtool import WebSearchPremiumTool, WebSearchPremiumToolTypedDict +from .websearchtool import WebSearchTool, WebSearchToolTypedDict from mistralai.gcp.client.types import ( BaseModel, Nullable, @@ -58,6 +66,31 @@ ] +ChatCompletionRequestToolTypedDict = TypeAliasType( + "ChatCompletionRequestToolTypedDict", + Union[ + ToolTypedDict, + WebSearchToolTypedDict, + WebSearchPremiumToolTypedDict, + CodeInterpreterToolTypedDict, + ImageGenerationToolTypedDict, + DocumentLibraryToolTypedDict, + CustomConnectorTypedDict, + ], +) + + +ChatCompletionRequestTool = Union[ + Tool, + WebSearchTool, + WebSearchPremiumTool, + CodeInterpreterTool, + ImageGenerationTool, + DocumentLibraryTool, + CustomConnector, +] + + ChatCompletionRequestToolChoiceTypedDict = TypeAliasType( "ChatCompletionRequestToolChoiceTypedDict", Union[ToolChoiceTypedDict, ToolChoiceEnum], @@ -78,26 +111,26 @@ class ChatCompletionRequestTypedDict(TypedDict): r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content.""" temperature: NotRequired[Nullable[float]] r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.""" - top_p: NotRequired[float] + top_p: NotRequired[Nullable[float]] r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.""" max_tokens: NotRequired[Nullable[int]] r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.""" stream: NotRequired[bool] r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.""" - stop: NotRequired[ChatCompletionRequestStopTypedDict] + stop: NotRequired[Nullable[ChatCompletionRequestStopTypedDict]] r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array""" random_seed: NotRequired[Nullable[int]] r"""The seed to use for random sampling. If set, different calls will generate deterministic results.""" metadata: NotRequired[Nullable[Dict[str, Any]]] response_format: NotRequired[ResponseFormatTypedDict] r"""Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.""" - tools: NotRequired[Nullable[List[ToolTypedDict]]] + tools: NotRequired[Nullable[List[ChatCompletionRequestToolTypedDict]]] r"""A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for.""" tool_choice: NotRequired[ChatCompletionRequestToolChoiceTypedDict] r"""Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.""" - presence_penalty: NotRequired[float] + presence_penalty: NotRequired[Nullable[float]] r"""The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.""" - frequency_penalty: NotRequired[float] + frequency_penalty: NotRequired[Nullable[float]] r"""The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.""" n: NotRequired[Nullable[int]] r"""Number of completions to return for each request, input tokens are only billed once.""" @@ -105,8 +138,10 @@ class ChatCompletionRequestTypedDict(TypedDict): r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.""" parallel_tool_calls: NotRequired[bool] r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel.""" + reasoning_effort: NotRequired[Nullable[ReasoningEffort]] prompt_mode: NotRequired[Nullable[MistralPromptMode]] r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.""" + guardrails: NotRequired[Nullable[List[GuardrailConfigTypedDict]]] class ChatCompletionRequest(BaseModel): @@ -119,7 +154,7 @@ class ChatCompletionRequest(BaseModel): temperature: OptionalNullable[float] = UNSET r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.""" - top_p: Optional[float] = None + top_p: OptionalNullable[float] = UNSET r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.""" max_tokens: OptionalNullable[int] = UNSET @@ -128,7 +163,7 @@ class ChatCompletionRequest(BaseModel): stream: Optional[bool] = False r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.""" - stop: Optional[ChatCompletionRequestStop] = None + stop: OptionalNullable[ChatCompletionRequestStop] = UNSET r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array""" random_seed: OptionalNullable[int] = UNSET @@ -139,16 +174,16 @@ class ChatCompletionRequest(BaseModel): response_format: Optional[ResponseFormat] = None r"""Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.""" - tools: OptionalNullable[List[Tool]] = UNSET + tools: OptionalNullable[List[ChatCompletionRequestTool]] = UNSET r"""A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for.""" tool_choice: Optional[ChatCompletionRequestToolChoice] = None r"""Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.""" - presence_penalty: Optional[float] = None + presence_penalty: OptionalNullable[float] = UNSET r"""The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.""" - frequency_penalty: Optional[float] = None + frequency_penalty: OptionalNullable[float] = UNSET r"""The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.""" n: OptionalNullable[int] = UNSET @@ -160,9 +195,13 @@ class ChatCompletionRequest(BaseModel): parallel_tool_calls: Optional[bool] = None r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel.""" + reasoning_effort: OptionalNullable[ReasoningEffort] = UNSET + prompt_mode: OptionalNullable[MistralPromptMode] = UNSET r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.""" + guardrails: OptionalNullable[List[GuardrailConfig]] = UNSET + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -182,18 +221,26 @@ def serialize_model(self, handler): "n", "prediction", "parallel_tool_calls", + "reasoning_effort", "prompt_mode", + "guardrails", ] ) nullable_fields = set( [ "temperature", + "top_p", "max_tokens", + "stop", "random_seed", "metadata", "tools", + "presence_penalty", + "frequency_penalty", "n", + "reasoning_effort", "prompt_mode", + "guardrails", ] ) serialized = handler(self) @@ -201,7 +248,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/chatcompletionstreamrequest.py b/packages/gcp/src/mistralai/gcp/client/models/chatcompletionstreamrequest.py index 3c228d2e..2adc7812 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/chatcompletionstreamrequest.py +++ b/packages/gcp/src/mistralai/gcp/client/models/chatcompletionstreamrequest.py @@ -2,8 +2,14 @@ from __future__ import annotations from .assistantmessage import AssistantMessage, AssistantMessageTypedDict +from .codeinterpretertool import CodeInterpreterTool, CodeInterpreterToolTypedDict +from .customconnector import CustomConnector, CustomConnectorTypedDict +from .documentlibrarytool import DocumentLibraryTool, DocumentLibraryToolTypedDict +from .guardrailconfig import GuardrailConfig, GuardrailConfigTypedDict +from .imagegenerationtool import ImageGenerationTool, ImageGenerationToolTypedDict from .mistralpromptmode import MistralPromptMode from .prediction import Prediction, PredictionTypedDict +from .reasoningeffort import ReasoningEffort from .responseformat import ResponseFormat, ResponseFormatTypedDict from .systemmessage import SystemMessage, SystemMessageTypedDict from .tool import Tool, ToolTypedDict @@ -11,6 +17,8 @@ from .toolchoiceenum import ToolChoiceEnum from .toolmessage import ToolMessage, ToolMessageTypedDict from .usermessage import UserMessage, UserMessageTypedDict +from .websearchpremiumtool import WebSearchPremiumTool, WebSearchPremiumToolTypedDict +from .websearchtool import WebSearchTool, WebSearchToolTypedDict from mistralai.gcp.client.types import ( BaseModel, Nullable, @@ -58,6 +66,31 @@ ] +ChatCompletionStreamRequestToolTypedDict = TypeAliasType( + "ChatCompletionStreamRequestToolTypedDict", + Union[ + ToolTypedDict, + WebSearchToolTypedDict, + WebSearchPremiumToolTypedDict, + CodeInterpreterToolTypedDict, + ImageGenerationToolTypedDict, + DocumentLibraryToolTypedDict, + CustomConnectorTypedDict, + ], +) + + +ChatCompletionStreamRequestTool = Union[ + Tool, + WebSearchTool, + WebSearchPremiumTool, + CodeInterpreterTool, + ImageGenerationTool, + DocumentLibraryTool, + CustomConnector, +] + + ChatCompletionStreamRequestToolChoiceTypedDict = TypeAliasType( "ChatCompletionStreamRequestToolChoiceTypedDict", Union[ToolChoiceTypedDict, ToolChoiceEnum], @@ -78,25 +111,25 @@ class ChatCompletionStreamRequestTypedDict(TypedDict): r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content.""" temperature: NotRequired[Nullable[float]] r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.""" - top_p: NotRequired[float] + top_p: NotRequired[Nullable[float]] r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.""" max_tokens: NotRequired[Nullable[int]] r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.""" stream: NotRequired[bool] - stop: NotRequired[ChatCompletionStreamRequestStopTypedDict] + stop: NotRequired[Nullable[ChatCompletionStreamRequestStopTypedDict]] r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array""" random_seed: NotRequired[Nullable[int]] r"""The seed to use for random sampling. If set, different calls will generate deterministic results.""" metadata: NotRequired[Nullable[Dict[str, Any]]] response_format: NotRequired[ResponseFormatTypedDict] r"""Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.""" - tools: NotRequired[Nullable[List[ToolTypedDict]]] + tools: NotRequired[Nullable[List[ChatCompletionStreamRequestToolTypedDict]]] r"""A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for.""" tool_choice: NotRequired[ChatCompletionStreamRequestToolChoiceTypedDict] r"""Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.""" - presence_penalty: NotRequired[float] + presence_penalty: NotRequired[Nullable[float]] r"""The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.""" - frequency_penalty: NotRequired[float] + frequency_penalty: NotRequired[Nullable[float]] r"""The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.""" n: NotRequired[Nullable[int]] r"""Number of completions to return for each request, input tokens are only billed once.""" @@ -104,8 +137,10 @@ class ChatCompletionStreamRequestTypedDict(TypedDict): r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.""" parallel_tool_calls: NotRequired[bool] r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel.""" + reasoning_effort: NotRequired[Nullable[ReasoningEffort]] prompt_mode: NotRequired[Nullable[MistralPromptMode]] r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.""" + guardrails: NotRequired[Nullable[List[GuardrailConfigTypedDict]]] class ChatCompletionStreamRequest(BaseModel): @@ -118,7 +153,7 @@ class ChatCompletionStreamRequest(BaseModel): temperature: OptionalNullable[float] = UNSET r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.""" - top_p: Optional[float] = None + top_p: OptionalNullable[float] = UNSET r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.""" max_tokens: OptionalNullable[int] = UNSET @@ -126,7 +161,7 @@ class ChatCompletionStreamRequest(BaseModel): stream: Optional[bool] = True - stop: Optional[ChatCompletionStreamRequestStop] = None + stop: OptionalNullable[ChatCompletionStreamRequestStop] = UNSET r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array""" random_seed: OptionalNullable[int] = UNSET @@ -137,16 +172,16 @@ class ChatCompletionStreamRequest(BaseModel): response_format: Optional[ResponseFormat] = None r"""Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.""" - tools: OptionalNullable[List[Tool]] = UNSET + tools: OptionalNullable[List[ChatCompletionStreamRequestTool]] = UNSET r"""A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for.""" tool_choice: Optional[ChatCompletionStreamRequestToolChoice] = None r"""Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.""" - presence_penalty: Optional[float] = None + presence_penalty: OptionalNullable[float] = UNSET r"""The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.""" - frequency_penalty: Optional[float] = None + frequency_penalty: OptionalNullable[float] = UNSET r"""The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.""" n: OptionalNullable[int] = UNSET @@ -158,9 +193,13 @@ class ChatCompletionStreamRequest(BaseModel): parallel_tool_calls: Optional[bool] = None r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel.""" + reasoning_effort: OptionalNullable[ReasoningEffort] = UNSET + prompt_mode: OptionalNullable[MistralPromptMode] = UNSET r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.""" + guardrails: OptionalNullable[List[GuardrailConfig]] = UNSET + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -180,18 +219,26 @@ def serialize_model(self, handler): "n", "prediction", "parallel_tool_calls", + "reasoning_effort", "prompt_mode", + "guardrails", ] ) nullable_fields = set( [ "temperature", + "top_p", "max_tokens", + "stop", "random_seed", "metadata", "tools", + "presence_penalty", + "frequency_penalty", "n", + "reasoning_effort", "prompt_mode", + "guardrails", ] ) serialized = handler(self) @@ -199,7 +246,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/codeinterpretertool.py b/packages/gcp/src/mistralai/gcp/client/models/codeinterpretertool.py new file mode 100644 index 00000000..9fdedce7 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/codeinterpretertool.py @@ -0,0 +1,65 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .toolconfiguration import ToolConfiguration, ToolConfigurationTypedDict +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.gcp.client.utils import validate_const +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CodeInterpreterToolTypedDict(TypedDict): + tool_configuration: NotRequired[Nullable[ToolConfigurationTypedDict]] + type: Literal["code_interpreter"] + + +class CodeInterpreterTool(BaseModel): + tool_configuration: OptionalNullable[ToolConfiguration] = UNSET + + type: Annotated[ + Annotated[ + Literal["code_interpreter"], + AfterValidator(validate_const("code_interpreter")), + ], + pydantic.Field(alias="type"), + ] = "code_interpreter" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["tool_configuration"]) + nullable_fields = set(["tool_configuration"]) + 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 + + +try: + CodeInterpreterTool.model_rebuild() +except NameError: + pass diff --git a/packages/gcp/src/mistralai/gcp/client/models/completionchunk.py b/packages/gcp/src/mistralai/gcp/client/models/completionchunk.py index a0b1ae2f..3f8d8c6b 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/completionchunk.py +++ b/packages/gcp/src/mistralai/gcp/client/models/completionchunk.py @@ -42,7 +42,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: if val is not None or k not in optional_fields: diff --git a/packages/gcp/src/mistralai/gcp/client/models/completionresponsestreamchoice.py b/packages/gcp/src/mistralai/gcp/client/models/completionresponsestreamchoice.py index e58d4c88..0f189b55 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/completionresponsestreamchoice.py +++ b/packages/gcp/src/mistralai/gcp/client/models/completionresponsestreamchoice.py @@ -44,7 +44,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: m[k] = val diff --git a/packages/gcp/src/mistralai/gcp/client/models/customconnector.py b/packages/gcp/src/mistralai/gcp/client/models/customconnector.py new file mode 100644 index 00000000..38299726 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/customconnector.py @@ -0,0 +1,80 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .apikeyauth import APIKeyAuth, APIKeyAuthTypedDict +from .oauth2tokenauth import OAuth2TokenAuth, OAuth2TokenAuthTypedDict +from .toolconfiguration import ToolConfiguration, ToolConfigurationTypedDict +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.gcp.client.utils import validate_const +import pydantic +from pydantic import Field, model_serializer +from pydantic.functional_validators import AfterValidator +from typing import Literal, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +AuthorizationTypedDict = TypeAliasType( + "AuthorizationTypedDict", Union[OAuth2TokenAuthTypedDict, APIKeyAuthTypedDict] +) + + +Authorization = Annotated[ + Union[APIKeyAuth, OAuth2TokenAuth], Field(discriminator="type") +] + + +class CustomConnectorTypedDict(TypedDict): + connector_id: str + type: Literal["connector"] + authorization: NotRequired[Nullable[AuthorizationTypedDict]] + tool_configuration: NotRequired[Nullable[ToolConfigurationTypedDict]] + + +class CustomConnector(BaseModel): + connector_id: str + + type: Annotated[ + Annotated[Literal["connector"], AfterValidator(validate_const("connector"))], + pydantic.Field(alias="type"), + ] = "connector" + + authorization: OptionalNullable[Authorization] = UNSET + + tool_configuration: OptionalNullable[ToolConfiguration] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["authorization", "tool_configuration"]) + nullable_fields = set(["authorization", "tool_configuration"]) + 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 + + +try: + CustomConnector.model_rebuild() +except NameError: + pass diff --git a/packages/gcp/src/mistralai/gcp/client/models/deltamessage.py b/packages/gcp/src/mistralai/gcp/client/models/deltamessage.py index 63e6a7f3..1943aec7 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/deltamessage.py +++ b/packages/gcp/src/mistralai/gcp/client/models/deltamessage.py @@ -11,7 +11,7 @@ UNSET_SENTINEL, ) from pydantic import model_serializer -from typing import List, Union +from typing import Any, Dict, List, Union from typing_extensions import NotRequired, TypeAliasType, TypedDict @@ -29,6 +29,10 @@ class DeltaMessageTypedDict(TypedDict): role: NotRequired[Nullable[str]] content: NotRequired[Nullable[DeltaMessageContentTypedDict]] tool_calls: NotRequired[Nullable[List[ToolCallTypedDict]]] + tool_call_id: NotRequired[Nullable[str]] + index: NotRequired[Nullable[int]] + r"""If the completion returns multiple messages, this is to specify which message this delta is for.""" + metadata: NotRequired[Nullable[Dict[str, Any]]] class DeltaMessage(BaseModel): @@ -38,16 +42,27 @@ class DeltaMessage(BaseModel): tool_calls: OptionalNullable[List[ToolCall]] = UNSET + tool_call_id: OptionalNullable[str] = UNSET + + index: OptionalNullable[int] = UNSET + r"""If the completion returns multiple messages, this is to specify which message this delta is for.""" + + metadata: OptionalNullable[Dict[str, Any]] = UNSET + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["role", "content", "tool_calls"]) - nullable_fields = set(["role", "content", "tool_calls"]) + optional_fields = set( + ["role", "content", "tool_calls", "tool_call_id", "index", "metadata"] + ) + nullable_fields = set( + ["role", "content", "tool_calls", "tool_call_id", "index", "metadata"] + ) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/documentlibrarytool.py b/packages/gcp/src/mistralai/gcp/client/models/documentlibrarytool.py new file mode 100644 index 00000000..36fb81e5 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/documentlibrarytool.py @@ -0,0 +1,70 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .toolconfiguration import ToolConfiguration, ToolConfigurationTypedDict +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.gcp.client.utils import validate_const +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import List, Literal +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DocumentLibraryToolTypedDict(TypedDict): + library_ids: List[str] + r"""Ids of the library in which to search.""" + tool_configuration: NotRequired[Nullable[ToolConfigurationTypedDict]] + type: Literal["document_library"] + + +class DocumentLibraryTool(BaseModel): + library_ids: List[str] + r"""Ids of the library in which to search.""" + + tool_configuration: OptionalNullable[ToolConfiguration] = UNSET + + type: Annotated[ + Annotated[ + Literal["document_library"], + AfterValidator(validate_const("document_library")), + ], + pydantic.Field(alias="type"), + ] = "document_library" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["tool_configuration"]) + nullable_fields = set(["tool_configuration"]) + 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 + + +try: + DocumentLibraryTool.model_rebuild() +except NameError: + pass diff --git a/packages/gcp/src/mistralai/gcp/client/models/fimcompletionrequest.py b/packages/gcp/src/mistralai/gcp/client/models/fimcompletionrequest.py index e460f76c..5b6013f6 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/fimcompletionrequest.py +++ b/packages/gcp/src/mistralai/gcp/client/models/fimcompletionrequest.py @@ -32,13 +32,13 @@ class FIMCompletionRequestTypedDict(TypedDict): r"""The text/code to complete.""" temperature: NotRequired[Nullable[float]] r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.""" - top_p: NotRequired[float] + top_p: NotRequired[Nullable[float]] r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.""" max_tokens: NotRequired[Nullable[int]] r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.""" stream: NotRequired[bool] r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.""" - stop: NotRequired[FIMCompletionRequestStopTypedDict] + stop: NotRequired[Nullable[FIMCompletionRequestStopTypedDict]] r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array""" random_seed: NotRequired[Nullable[int]] r"""The seed to use for random sampling. If set, different calls will generate deterministic results.""" @@ -59,7 +59,7 @@ class FIMCompletionRequest(BaseModel): temperature: OptionalNullable[float] = UNSET r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.""" - top_p: Optional[float] = 1 + top_p: OptionalNullable[float] = UNSET r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.""" max_tokens: OptionalNullable[int] = UNSET @@ -68,7 +68,7 @@ class FIMCompletionRequest(BaseModel): stream: Optional[bool] = False r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.""" - stop: Optional[FIMCompletionRequestStop] = None + stop: OptionalNullable[FIMCompletionRequestStop] = UNSET r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array""" random_seed: OptionalNullable[int] = UNSET @@ -100,7 +100,9 @@ def serialize_model(self, handler): nullable_fields = set( [ "temperature", + "top_p", "max_tokens", + "stop", "random_seed", "metadata", "suffix", @@ -112,7 +114,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/fimcompletionstreamrequest.py b/packages/gcp/src/mistralai/gcp/client/models/fimcompletionstreamrequest.py index fffc3054..d2e86d40 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/fimcompletionstreamrequest.py +++ b/packages/gcp/src/mistralai/gcp/client/models/fimcompletionstreamrequest.py @@ -32,12 +32,12 @@ class FIMCompletionStreamRequestTypedDict(TypedDict): r"""The text/code to complete.""" temperature: NotRequired[Nullable[float]] r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.""" - top_p: NotRequired[float] + top_p: NotRequired[Nullable[float]] r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.""" max_tokens: NotRequired[Nullable[int]] r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.""" stream: NotRequired[bool] - stop: NotRequired[FIMCompletionStreamRequestStopTypedDict] + stop: NotRequired[Nullable[FIMCompletionStreamRequestStopTypedDict]] r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array""" random_seed: NotRequired[Nullable[int]] r"""The seed to use for random sampling. If set, different calls will generate deterministic results.""" @@ -58,7 +58,7 @@ class FIMCompletionStreamRequest(BaseModel): temperature: OptionalNullable[float] = UNSET r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.""" - top_p: Optional[float] = 1 + top_p: OptionalNullable[float] = UNSET r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.""" max_tokens: OptionalNullable[int] = UNSET @@ -66,7 +66,7 @@ class FIMCompletionStreamRequest(BaseModel): stream: Optional[bool] = True - stop: Optional[FIMCompletionStreamRequestStop] = None + stop: OptionalNullable[FIMCompletionStreamRequestStop] = UNSET r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array""" random_seed: OptionalNullable[int] = UNSET @@ -98,7 +98,9 @@ def serialize_model(self, handler): nullable_fields = set( [ "temperature", + "top_p", "max_tokens", + "stop", "random_seed", "metadata", "suffix", @@ -110,7 +112,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/function.py b/packages/gcp/src/mistralai/gcp/client/models/function.py index 439e8313..877b7273 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/function.py +++ b/packages/gcp/src/mistralai/gcp/client/models/function.py @@ -31,7 +31,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: if val is not None or k not in optional_fields: diff --git a/packages/gcp/src/mistralai/gcp/client/models/guardrailconfig.py b/packages/gcp/src/mistralai/gcp/client/models/guardrailconfig.py new file mode 100644 index 00000000..abc5deca --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/guardrailconfig.py @@ -0,0 +1,58 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .moderationllmv1config import ModerationLlmv1Config, ModerationLlmv1ConfigTypedDict +from .moderationllmv2config import ModerationLlmv2Config, ModerationLlmv2ConfigTypedDict +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class GuardrailConfigTypedDict(TypedDict): + block_on_error: NotRequired[bool] + r"""If true, return HTTP 403 and block request in the event of a server-side error""" + moderation_llm_v1: NotRequired[Nullable[ModerationLlmv1ConfigTypedDict]] + moderation_llm_v2: NotRequired[Nullable[ModerationLlmv2ConfigTypedDict]] + + +class GuardrailConfig(BaseModel): + block_on_error: Optional[bool] = False + r"""If true, return HTTP 403 and block request in the event of a server-side error""" + + moderation_llm_v1: OptionalNullable[ModerationLlmv1Config] = UNSET + + moderation_llm_v2: OptionalNullable[ModerationLlmv2Config] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["block_on_error", "moderation_llm_v1", "moderation_llm_v2"] + ) + nullable_fields = set(["moderation_llm_v1", "moderation_llm_v2"]) + 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/packages/gcp/src/mistralai/gcp/client/models/imagegenerationtool.py b/packages/gcp/src/mistralai/gcp/client/models/imagegenerationtool.py new file mode 100644 index 00000000..e6b28920 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/imagegenerationtool.py @@ -0,0 +1,65 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .toolconfiguration import ToolConfiguration, ToolConfigurationTypedDict +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.gcp.client.utils import validate_const +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ImageGenerationToolTypedDict(TypedDict): + tool_configuration: NotRequired[Nullable[ToolConfigurationTypedDict]] + type: Literal["image_generation"] + + +class ImageGenerationTool(BaseModel): + tool_configuration: OptionalNullable[ToolConfiguration] = UNSET + + type: Annotated[ + Annotated[ + Literal["image_generation"], + AfterValidator(validate_const("image_generation")), + ], + pydantic.Field(alias="type"), + ] = "image_generation" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["tool_configuration"]) + nullable_fields = set(["tool_configuration"]) + 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 + + +try: + ImageGenerationTool.model_rebuild() +except NameError: + pass diff --git a/packages/gcp/src/mistralai/gcp/client/models/imageurl.py b/packages/gcp/src/mistralai/gcp/client/models/imageurl.py index 903d0a1a..99e55598 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/imageurl.py +++ b/packages/gcp/src/mistralai/gcp/client/models/imageurl.py @@ -32,7 +32,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/imageurlchunk.py b/packages/gcp/src/mistralai/gcp/client/models/imageurlchunk.py index 4bec0eec..e939c34b 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/imageurlchunk.py +++ b/packages/gcp/src/mistralai/gcp/client/models/imageurlchunk.py @@ -19,14 +19,14 @@ class ImageURLChunkTypedDict(TypedDict): - r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0""" + r"""{\"type\":\"image_url\",\"image_url\":\"data:image/png;base64,iVBORw0\"}""" image_url: ImageURLUnionTypedDict type: Literal["image_url"] class ImageURLChunk(BaseModel): - r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0""" + r"""{\"type\":\"image_url\",\"image_url\":\"data:image/png;base64,iVBORw0\"}""" image_url: ImageURLUnion diff --git a/packages/gcp/src/mistralai/gcp/client/models/jsonschema.py b/packages/gcp/src/mistralai/gcp/client/models/jsonschema.py index 684ac09f..f500fa56 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/jsonschema.py +++ b/packages/gcp/src/mistralai/gcp/client/models/jsonschema.py @@ -39,7 +39,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/moderationllmaction.py b/packages/gcp/src/mistralai/gcp/client/models/moderationllmaction.py new file mode 100644 index 00000000..cff03d9a --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/moderationllmaction.py @@ -0,0 +1,10 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from typing import Literal + + +ModerationLLMAction = Literal[ + "none", + "block", +] diff --git a/packages/gcp/src/mistralai/gcp/client/models/moderationllmv1categorythresholds.py b/packages/gcp/src/mistralai/gcp/client/models/moderationllmv1categorythresholds.py new file mode 100644 index 00000000..3f5713fe --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/moderationllmv1categorythresholds.py @@ -0,0 +1,93 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing_extensions import NotRequired, TypedDict + + +class ModerationLlmv1CategoryThresholdsTypedDict(TypedDict): + sexual: NotRequired[Nullable[float]] + hate_and_discrimination: NotRequired[Nullable[float]] + violence_and_threats: NotRequired[Nullable[float]] + dangerous_and_criminal_content: NotRequired[Nullable[float]] + selfharm: NotRequired[Nullable[float]] + health: NotRequired[Nullable[float]] + financial: NotRequired[Nullable[float]] + law: NotRequired[Nullable[float]] + pii: NotRequired[Nullable[float]] + + +class ModerationLlmv1CategoryThresholds(BaseModel): + sexual: OptionalNullable[float] = UNSET + + hate_and_discrimination: OptionalNullable[float] = UNSET + + violence_and_threats: OptionalNullable[float] = UNSET + + dangerous_and_criminal_content: OptionalNullable[float] = UNSET + + selfharm: OptionalNullable[float] = UNSET + + health: OptionalNullable[float] = UNSET + + financial: OptionalNullable[float] = UNSET + + law: OptionalNullable[float] = UNSET + + pii: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "sexual", + "hate_and_discrimination", + "violence_and_threats", + "dangerous_and_criminal_content", + "selfharm", + "health", + "financial", + "law", + "pii", + ] + ) + nullable_fields = set( + [ + "sexual", + "hate_and_discrimination", + "violence_and_threats", + "dangerous_and_criminal_content", + "selfharm", + "health", + "financial", + "law", + "pii", + ] + ) + 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/packages/gcp/src/mistralai/gcp/client/models/moderationllmv1config.py b/packages/gcp/src/mistralai/gcp/client/models/moderationllmv1config.py new file mode 100644 index 00000000..579acd73 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/moderationllmv1config.py @@ -0,0 +1,75 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .moderationllmaction import ModerationLLMAction +from .moderationllmv1categorythresholds import ( + ModerationLlmv1CategoryThresholds, + ModerationLlmv1CategoryThresholdsTypedDict, +) +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class ModerationLlmv1ConfigTypedDict(TypedDict): + model_name: NotRequired[str] + r"""Override model name. Should be omitted in general.""" + custom_category_thresholds: NotRequired[ + Nullable[ModerationLlmv1CategoryThresholdsTypedDict] + ] + ignore_other_categories: NotRequired[bool] + r"""If true, only evaluate categories in custom_category_thresholds; others are ignored.""" + action: NotRequired[ModerationLLMAction] + + +class ModerationLlmv1Config(BaseModel): + model_name: Optional[str] = "mistral-moderation-2411" + r"""Override model name. Should be omitted in general.""" + + custom_category_thresholds: OptionalNullable[ModerationLlmv1CategoryThresholds] = ( + UNSET + ) + + ignore_other_categories: Optional[bool] = False + r"""If true, only evaluate categories in custom_category_thresholds; others are ignored.""" + + action: Optional[ModerationLLMAction] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "model_name", + "custom_category_thresholds", + "ignore_other_categories", + "action", + ] + ) + nullable_fields = set(["custom_category_thresholds"]) + 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/packages/gcp/src/mistralai/gcp/client/models/moderationllmv2categorythresholds.py b/packages/gcp/src/mistralai/gcp/client/models/moderationllmv2categorythresholds.py new file mode 100644 index 00000000..8b925260 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/moderationllmv2categorythresholds.py @@ -0,0 +1,103 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing_extensions import NotRequired, TypedDict + + +class ModerationLlmv2CategoryThresholdsTypedDict(TypedDict): + sexual: NotRequired[Nullable[float]] + hate_and_discrimination: NotRequired[Nullable[float]] + violence_and_threats: NotRequired[Nullable[float]] + dangerous: NotRequired[Nullable[float]] + criminal: NotRequired[Nullable[float]] + selfharm: NotRequired[Nullable[float]] + health: NotRequired[Nullable[float]] + financial: NotRequired[Nullable[float]] + law: NotRequired[Nullable[float]] + pii: NotRequired[Nullable[float]] + jailbreaking: NotRequired[Nullable[float]] + + +class ModerationLlmv2CategoryThresholds(BaseModel): + sexual: OptionalNullable[float] = UNSET + + hate_and_discrimination: OptionalNullable[float] = UNSET + + violence_and_threats: OptionalNullable[float] = UNSET + + dangerous: OptionalNullable[float] = UNSET + + criminal: OptionalNullable[float] = UNSET + + selfharm: OptionalNullable[float] = UNSET + + health: OptionalNullable[float] = UNSET + + financial: OptionalNullable[float] = UNSET + + law: OptionalNullable[float] = UNSET + + pii: OptionalNullable[float] = UNSET + + jailbreaking: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "sexual", + "hate_and_discrimination", + "violence_and_threats", + "dangerous", + "criminal", + "selfharm", + "health", + "financial", + "law", + "pii", + "jailbreaking", + ] + ) + nullable_fields = set( + [ + "sexual", + "hate_and_discrimination", + "violence_and_threats", + "dangerous", + "criminal", + "selfharm", + "health", + "financial", + "law", + "pii", + "jailbreaking", + ] + ) + 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/packages/gcp/src/mistralai/gcp/client/models/moderationllmv2config.py b/packages/gcp/src/mistralai/gcp/client/models/moderationllmv2config.py new file mode 100644 index 00000000..000d2e2c --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/moderationllmv2config.py @@ -0,0 +1,75 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .moderationllmaction import ModerationLLMAction +from .moderationllmv2categorythresholds import ( + ModerationLlmv2CategoryThresholds, + ModerationLlmv2CategoryThresholdsTypedDict, +) +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class ModerationLlmv2ConfigTypedDict(TypedDict): + model_name: NotRequired[str] + r"""Override model name. Should be omitted in general.""" + custom_category_thresholds: NotRequired[ + Nullable[ModerationLlmv2CategoryThresholdsTypedDict] + ] + ignore_other_categories: NotRequired[bool] + r"""If true, only evaluate categories in custom_category_thresholds; others are ignored.""" + action: NotRequired[ModerationLLMAction] + + +class ModerationLlmv2Config(BaseModel): + model_name: Optional[str] = "mistral-moderation-2603" + r"""Override model name. Should be omitted in general.""" + + custom_category_thresholds: OptionalNullable[ModerationLlmv2CategoryThresholds] = ( + UNSET + ) + + ignore_other_categories: Optional[bool] = False + r"""If true, only evaluate categories in custom_category_thresholds; others are ignored.""" + + action: Optional[ModerationLLMAction] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "model_name", + "custom_category_thresholds", + "ignore_other_categories", + "action", + ] + ) + nullable_fields = set(["custom_category_thresholds"]) + 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/packages/gcp/src/mistralai/gcp/client/models/oauth2tokenauth.py b/packages/gcp/src/mistralai/gcp/client/models/oauth2tokenauth.py new file mode 100644 index 00000000..d1b4c935 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/oauth2tokenauth.py @@ -0,0 +1,31 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.gcp.client.types import BaseModel +from mistralai.gcp.client.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, TypedDict + + +class OAuth2TokenAuthTypedDict(TypedDict): + value: str + type: Literal["oauth2-token"] + + +class OAuth2TokenAuth(BaseModel): + value: str + + type: Annotated[ + Annotated[ + Literal["oauth2-token"], AfterValidator(validate_const("oauth2-token")) + ], + pydantic.Field(alias="type"), + ] = "oauth2-token" + + +try: + OAuth2TokenAuth.model_rebuild() +except NameError: + pass diff --git a/packages/gcp/src/mistralai/gcp/client/models/prediction.py b/packages/gcp/src/mistralai/gcp/client/models/prediction.py index 2e325289..1e290f33 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/prediction.py +++ b/packages/gcp/src/mistralai/gcp/client/models/prediction.py @@ -37,7 +37,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: if val is not None or k not in optional_fields: diff --git a/packages/gcp/src/mistralai/gcp/client/models/reasoningeffort.py b/packages/gcp/src/mistralai/gcp/client/models/reasoningeffort.py new file mode 100644 index 00000000..43ffa02b --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/reasoningeffort.py @@ -0,0 +1,10 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from typing import Literal + + +ReasoningEffort = Literal[ + "none", + "high", +] diff --git a/packages/gcp/src/mistralai/gcp/client/models/referencechunk.py b/packages/gcp/src/mistralai/gcp/client/models/referencechunk.py index 261c4755..eca4c4de 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/referencechunk.py +++ b/packages/gcp/src/mistralai/gcp/client/models/referencechunk.py @@ -6,17 +6,23 @@ import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional -from typing_extensions import Annotated, TypedDict +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, TypeAliasType, TypedDict + + +ReferenceIDTypedDict = TypeAliasType("ReferenceIDTypedDict", Union[int, str]) + + +ReferenceID = TypeAliasType("ReferenceID", Union[int, str]) class ReferenceChunkTypedDict(TypedDict): - reference_ids: List[int] + reference_ids: List[ReferenceIDTypedDict] type: Literal["reference"] class ReferenceChunk(BaseModel): - reference_ids: List[int] + reference_ids: List[ReferenceID] type: Annotated[ Annotated[ @@ -33,7 +39,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: if val is not None or k not in optional_fields: diff --git a/packages/gcp/src/mistralai/gcp/client/models/responseformat.py b/packages/gcp/src/mistralai/gcp/client/models/responseformat.py index f3aa9930..afd1bd30 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/responseformat.py +++ b/packages/gcp/src/mistralai/gcp/client/models/responseformat.py @@ -38,7 +38,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/thinkchunk.py b/packages/gcp/src/mistralai/gcp/client/models/thinkchunk.py index d534fc1e..34397d30 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/thinkchunk.py +++ b/packages/gcp/src/mistralai/gcp/client/models/thinkchunk.py @@ -4,7 +4,13 @@ from .referencechunk import ReferenceChunk, ReferenceChunkTypedDict from .textchunk import TextChunk, TextChunkTypedDict from .toolreferencechunk import ToolReferenceChunk, ToolReferenceChunkTypedDict -from mistralai.gcp.client.types import BaseModel, UNSET_SENTINEL +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) from mistralai.gcp.client.utils import validate_const import pydantic from pydantic import model_serializer @@ -27,6 +33,8 @@ class ThinkChunkTypedDict(TypedDict): thinking: List[ThinkingTypedDict] type: Literal["thinking"] + signature: NotRequired[Nullable[str]] + r"""Signature to replay some reasoning blocks across turns.""" closed: NotRequired[bool] r"""Whether the thinking chunk is closed or not. Currently only used for prefixing.""" @@ -39,21 +47,33 @@ class ThinkChunk(BaseModel): pydantic.Field(alias="type"), ] = "thinking" + signature: OptionalNullable[str] = UNSET + r"""Signature to replay some reasoning blocks across turns.""" + closed: Optional[bool] = None r"""Whether the thinking chunk is closed or not. Currently only used for prefixing.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["closed"]) + optional_fields = set(["signature", "closed"]) + nullable_fields = set(["signature"]) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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/packages/gcp/src/mistralai/gcp/client/models/tool.py b/packages/gcp/src/mistralai/gcp/client/models/tool.py index 670aa81f..e95b3036 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/tool.py +++ b/packages/gcp/src/mistralai/gcp/client/models/tool.py @@ -2,35 +2,32 @@ from __future__ import annotations from .function import Function, FunctionTypedDict -from .tooltypes import ToolTypes -from mistralai.gcp.client.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +from mistralai.gcp.client.types import BaseModel, UnrecognizedStr +from mistralai.gcp.client.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal, Union +from typing_extensions import Annotated, TypedDict class ToolTypedDict(TypedDict): function: FunctionTypedDict - type: NotRequired[ToolTypes] + type: Union[Literal["function"], UnrecognizedStr] class Tool(BaseModel): function: Function - type: Optional[ToolTypes] = None + type: Annotated[ + Annotated[ + Union[Literal["function"], UnrecognizedStr], + AfterValidator(validate_const("function")), + ], + pydantic.Field(alias="type"), + ] = "function" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["type"]) - serialized = handler(self) - m = {} - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +try: + Tool.model_rebuild() +except NameError: + pass diff --git a/packages/gcp/src/mistralai/gcp/client/models/toolcall.py b/packages/gcp/src/mistralai/gcp/client/models/toolcall.py index 3ea8e283..4e4c2581 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/toolcall.py +++ b/packages/gcp/src/mistralai/gcp/client/models/toolcall.py @@ -2,7 +2,6 @@ from __future__ import annotations from .functioncall import FunctionCall, FunctionCallTypedDict -from .tooltypes import ToolTypes from mistralai.gcp.client.types import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import Optional @@ -12,7 +11,7 @@ class ToolCallTypedDict(TypedDict): function: FunctionCallTypedDict id: NotRequired[str] - type: NotRequired[ToolTypes] + type: NotRequired[str] index: NotRequired[int] @@ -21,7 +20,7 @@ class ToolCall(BaseModel): id: Optional[str] = "null" - type: Optional[ToolTypes] = None + type: Optional[str] = None index: Optional[int] = 0 @@ -33,7 +32,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: if val is not None or k not in optional_fields: diff --git a/packages/gcp/src/mistralai/gcp/client/models/toolchoice.py b/packages/gcp/src/mistralai/gcp/client/models/toolchoice.py index 6e795fd7..528cc801 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/toolchoice.py +++ b/packages/gcp/src/mistralai/gcp/client/models/toolchoice.py @@ -2,7 +2,6 @@ from __future__ import annotations from .functionname import FunctionName, FunctionNameTypedDict -from .tooltypes import ToolTypes from mistralai.gcp.client.types import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import Optional @@ -14,7 +13,7 @@ class ToolChoiceTypedDict(TypedDict): function: FunctionNameTypedDict r"""this restriction of `Function` is used to select a specific function to call""" - type: NotRequired[ToolTypes] + type: NotRequired[str] class ToolChoice(BaseModel): @@ -23,7 +22,7 @@ class ToolChoice(BaseModel): function: FunctionName r"""this restriction of `Function` is used to select a specific function to call""" - type: Optional[ToolTypes] = None + type: Optional[str] = None @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -33,7 +32,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: if val is not None or k not in optional_fields: diff --git a/packages/gcp/src/mistralai/gcp/client/models/toolconfiguration.py b/packages/gcp/src/mistralai/gcp/client/models/toolconfiguration.py new file mode 100644 index 00000000..724ed8c6 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/toolconfiguration.py @@ -0,0 +1,52 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import List +from typing_extensions import NotRequired, TypedDict + + +class ToolConfigurationTypedDict(TypedDict): + exclude: NotRequired[Nullable[List[str]]] + include: NotRequired[Nullable[List[str]]] + requires_confirmation: NotRequired[Nullable[List[str]]] + + +class ToolConfiguration(BaseModel): + exclude: OptionalNullable[List[str]] = UNSET + + include: OptionalNullable[List[str]] = UNSET + + requires_confirmation: OptionalNullable[List[str]] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["exclude", "include", "requires_confirmation"]) + nullable_fields = set(["exclude", "include", "requires_confirmation"]) + 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/packages/gcp/src/mistralai/gcp/client/models/toolmessage.py b/packages/gcp/src/mistralai/gcp/client/models/toolmessage.py index ce160391..a5a9645d 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/toolmessage.py +++ b/packages/gcp/src/mistralai/gcp/client/models/toolmessage.py @@ -53,7 +53,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/toolreferencechunk.py b/packages/gcp/src/mistralai/gcp/client/models/toolreferencechunk.py index 0a2a7fa3..eb2b80e4 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/toolreferencechunk.py +++ b/packages/gcp/src/mistralai/gcp/client/models/toolreferencechunk.py @@ -17,14 +17,18 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -ToolUnionTypedDict = TypeAliasType("ToolUnionTypedDict", Union[BuiltInConnectors, str]) +ToolReferenceChunkToolTypedDict = TypeAliasType( + "ToolReferenceChunkToolTypedDict", Union[BuiltInConnectors, str] +) -ToolUnion = TypeAliasType("ToolUnion", Union[BuiltInConnectors, str]) +ToolReferenceChunkTool = TypeAliasType( + "ToolReferenceChunkTool", Union[BuiltInConnectors, str] +) class ToolReferenceChunkTypedDict(TypedDict): - tool: ToolUnionTypedDict + tool: ToolReferenceChunkToolTypedDict title: str type: Literal["tool_reference"] url: NotRequired[Nullable[str]] @@ -33,7 +37,7 @@ class ToolReferenceChunkTypedDict(TypedDict): class ToolReferenceChunk(BaseModel): - tool: ToolUnion + tool: ToolReferenceChunkTool title: str @@ -60,7 +64,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/tooltypes.py b/packages/gcp/src/mistralai/gcp/client/models/tooltypes.py deleted file mode 100644 index fd1aa13d..00000000 --- a/packages/gcp/src/mistralai/gcp/client/models/tooltypes.py +++ /dev/null @@ -1,8 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from mistralai.gcp.client.types import UnrecognizedStr -from typing import Literal, Union - - -ToolTypes = Union[Literal["function",], UnrecognizedStr] diff --git a/packages/gcp/src/mistralai/gcp/client/models/usageinfo.py b/packages/gcp/src/mistralai/gcp/client/models/usageinfo.py index cb6feb6e..df40efab 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/usageinfo.py +++ b/packages/gcp/src/mistralai/gcp/client/models/usageinfo.py @@ -59,8 +59,8 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) + 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 diff --git a/packages/gcp/src/mistralai/gcp/client/models/usermessage.py b/packages/gcp/src/mistralai/gcp/client/models/usermessage.py index e237e900..8199f293 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/usermessage.py +++ b/packages/gcp/src/mistralai/gcp/client/models/usermessage.py @@ -39,7 +39,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: m[k] = val diff --git a/packages/gcp/src/mistralai/gcp/client/models/validationerror.py b/packages/gcp/src/mistralai/gcp/client/models/validationerror.py index 3ff872c1..653b63e9 100644 --- a/packages/gcp/src/mistralai/gcp/client/models/validationerror.py +++ b/packages/gcp/src/mistralai/gcp/client/models/validationerror.py @@ -48,7 +48,7 @@ def serialize_model(self, handler): for n, f in type(self).model_fields.items(): k = f.alias or n - val = serialized.get(k) + val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: if val is not None or k not in optional_fields: diff --git a/packages/gcp/src/mistralai/gcp/client/models/websearchpremiumtool.py b/packages/gcp/src/mistralai/gcp/client/models/websearchpremiumtool.py new file mode 100644 index 00000000..e416f964 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/websearchpremiumtool.py @@ -0,0 +1,65 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .toolconfiguration import ToolConfiguration, ToolConfigurationTypedDict +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.gcp.client.utils import validate_const +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, NotRequired, TypedDict + + +class WebSearchPremiumToolTypedDict(TypedDict): + tool_configuration: NotRequired[Nullable[ToolConfigurationTypedDict]] + type: Literal["web_search_premium"] + + +class WebSearchPremiumTool(BaseModel): + tool_configuration: OptionalNullable[ToolConfiguration] = UNSET + + type: Annotated[ + Annotated[ + Literal["web_search_premium"], + AfterValidator(validate_const("web_search_premium")), + ], + pydantic.Field(alias="type"), + ] = "web_search_premium" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["tool_configuration"]) + nullable_fields = set(["tool_configuration"]) + 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 + + +try: + WebSearchPremiumTool.model_rebuild() +except NameError: + pass diff --git a/packages/gcp/src/mistralai/gcp/client/models/websearchtool.py b/packages/gcp/src/mistralai/gcp/client/models/websearchtool.py new file mode 100644 index 00000000..69d6e043 --- /dev/null +++ b/packages/gcp/src/mistralai/gcp/client/models/websearchtool.py @@ -0,0 +1,62 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .toolconfiguration import ToolConfiguration, ToolConfigurationTypedDict +from mistralai.gcp.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.gcp.client.utils import validate_const +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, NotRequired, TypedDict + + +class WebSearchToolTypedDict(TypedDict): + tool_configuration: NotRequired[Nullable[ToolConfigurationTypedDict]] + type: Literal["web_search"] + + +class WebSearchTool(BaseModel): + tool_configuration: OptionalNullable[ToolConfiguration] = UNSET + + type: Annotated[ + Annotated[Literal["web_search"], AfterValidator(validate_const("web_search"))], + pydantic.Field(alias="type"), + ] = "web_search" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["tool_configuration"]) + nullable_fields = set(["tool_configuration"]) + 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 + + +try: + WebSearchTool.model_rebuild() +except NameError: + pass diff --git a/packages/gcp/src/mistralai/gcp/client/utils/eventstreaming.py b/packages/gcp/src/mistralai/gcp/client/utils/eventstreaming.py index f2052fc2..3bdcd6d3 100644 --- a/packages/gcp/src/mistralai/gcp/client/utils/eventstreaming.py +++ b/packages/gcp/src/mistralai/gcp/client/utils/eventstreaming.py @@ -32,9 +32,12 @@ def __init__( decoder: Callable[[str], T], sentinel: Optional[str] = None, client_ref: Optional[object] = None, + data_required: bool = True, ): self.response = response - self.generator = stream_events(response, decoder, sentinel) + self.generator = stream_events( + response, decoder, sentinel, data_required=data_required + ) self.client_ref = client_ref self._closed = False @@ -68,9 +71,12 @@ def __init__( decoder: Callable[[str], T], sentinel: Optional[str] = None, client_ref: Optional[object] = None, + data_required: bool = True, ): self.response = response - self.generator = stream_events_async(response, decoder, sentinel) + self.generator = stream_events_async( + response, decoder, sentinel, data_required=data_required + ) self.client_ref = client_ref self._closed = False @@ -116,6 +122,7 @@ async def stream_events_async( response: httpx.Response, decoder: Callable[[str], T], sentinel: Optional[str] = None, + data_required: bool = True, ) -> AsyncGenerator[T, None]: buffer = bytearray() position = 0 @@ -138,7 +145,11 @@ async def stream_events_async( block = buffer[position:i] position = i + len(seq) event, discard, event_id = _parse_event( - raw=block, decoder=decoder, sentinel=sentinel, event_id=event_id + raw=block, + decoder=decoder, + sentinel=sentinel, + event_id=event_id, + data_required=data_required, ) if event is not None: yield event @@ -151,7 +162,11 @@ async def stream_events_async( position = 0 event, discard, _ = _parse_event( - raw=buffer, decoder=decoder, sentinel=sentinel, event_id=event_id + raw=buffer, + decoder=decoder, + sentinel=sentinel, + event_id=event_id, + data_required=data_required, ) if event is not None: yield event @@ -161,6 +176,7 @@ def stream_events( response: httpx.Response, decoder: Callable[[str], T], sentinel: Optional[str] = None, + data_required: bool = True, ) -> Generator[T, None, None]: buffer = bytearray() position = 0 @@ -183,7 +199,11 @@ def stream_events( block = buffer[position:i] position = i + len(seq) event, discard, event_id = _parse_event( - raw=block, decoder=decoder, sentinel=sentinel, event_id=event_id + raw=block, + decoder=decoder, + sentinel=sentinel, + event_id=event_id, + data_required=data_required, ) if event is not None: yield event @@ -196,7 +216,11 @@ def stream_events( position = 0 event, discard, _ = _parse_event( - raw=buffer, decoder=decoder, sentinel=sentinel, event_id=event_id + raw=buffer, + decoder=decoder, + sentinel=sentinel, + event_id=event_id, + data_required=data_required, ) if event is not None: yield event @@ -208,6 +232,7 @@ def _parse_event( decoder: Callable[[str], T], sentinel: Optional[str] = None, event_id: Optional[str] = None, + data_required: bool = True, ) -> Tuple[Optional[T], bool, Optional[str]]: block = raw.decode() lines = re.split(r"\r?\n|\r", block) @@ -250,6 +275,10 @@ def _parse_event( if sentinel and data == f"{sentinel}\n": return None, True, event_id + # Skip data-less events when data is required + if not data and publish and data_required: + return None, False, event_id + if data: data = data[:-1] try: diff --git a/packages/gcp/src/mistralai/gcp/client/utils/metadata.py b/packages/gcp/src/mistralai/gcp/client/utils/metadata.py index 173b3e5c..5abddd58 100644 --- a/packages/gcp/src/mistralai/gcp/client/utils/metadata.py +++ b/packages/gcp/src/mistralai/gcp/client/utils/metadata.py @@ -15,6 +15,7 @@ class SecurityMetadata: scheme_type: Optional[str] = None sub_type: Optional[str] = None field_name: Optional[str] = None + composite: bool = False def get_field_name(self, default: str) -> str: return self.field_name or default diff --git a/packages/gcp/src/mistralai/gcp/client/utils/security.py b/packages/gcp/src/mistralai/gcp/client/utils/security.py index 17996bd5..42d8d78e 100644 --- a/packages/gcp/src/mistralai/gcp/client/utils/security.py +++ b/packages/gcp/src/mistralai/gcp/client/utils/security.py @@ -5,6 +5,7 @@ Any, Dict, List, + Optional, Tuple, ) from pydantic import BaseModel @@ -16,7 +17,9 @@ ) -def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]: +def get_security( + security: Any, allowed_fields: Optional[List[str]] = None +) -> Tuple[Dict[str, str], Dict[str, List[str]]]: headers: Dict[str, str] = {} query_params: Dict[str, List[str]] = {} @@ -27,7 +30,14 @@ def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]: raise TypeError("security must be a pydantic model") sec_fields: Dict[str, FieldInfo] = security.__class__.model_fields - for name in sec_fields: + sec_field_names = ( + list(sec_fields.keys()) if allowed_fields is None else allowed_fields + ) + + for name in sec_field_names: + if name not in sec_fields: + continue + sec_field = sec_fields[name] value = getattr(security, name) @@ -49,6 +59,9 @@ def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]: else: _parse_security_scheme(headers, query_params, metadata, name, value) + if not metadata.composite: + return headers, query_params + return headers, query_params @@ -59,15 +72,24 @@ def _parse_security_option( raise TypeError("security option must be a pydantic model") opt_fields: Dict[str, FieldInfo] = option.__class__.model_fields + for name in opt_fields: opt_field = opt_fields[name] metadata = find_field_metadata(opt_field, SecurityMetadata) if metadata is None or not metadata.scheme: continue - _parse_security_scheme( - headers, query_params, metadata, name, getattr(option, name) - ) + + value = getattr(option, name) + if ( + metadata.scheme_type == "http" + and metadata.sub_type == "basic" + and not isinstance(value, BaseModel) + ): + _parse_basic_auth_scheme(headers, option) + return + + _parse_security_scheme(headers, query_params, metadata, name, value) def _parse_security_scheme( diff --git a/packages/gcp/src/mistralai/gcp/client/utils/serializers.py b/packages/gcp/src/mistralai/gcp/client/utils/serializers.py index 14321eb4..d2149f8b 100644 --- a/packages/gcp/src/mistralai/gcp/client/utils/serializers.py +++ b/packages/gcp/src/mistralai/gcp/client/utils/serializers.py @@ -17,8 +17,7 @@ def serialize_decimal(as_str: bool): def serialize(d): - # Optional[T] is a Union[T, None] - if is_union(type(d)) and type(None) in get_args(type(d)) and d is None: + if d is None: return None if isinstance(d, Unset): return d @@ -46,8 +45,7 @@ def validate_decimal(d): def serialize_float(as_str: bool): def serialize(f): - # Optional[T] is a Union[T, None] - if is_union(type(f)) and type(None) in get_args(type(f)) and f is None: + if f is None: return None if isinstance(f, Unset): return f @@ -75,8 +73,7 @@ def validate_float(f): def serialize_int(as_str: bool): def serialize(i): - # Optional[T] is a Union[T, None] - if is_union(type(i)) and type(None) in get_args(type(i)) and i is None: + if i is None: return None if isinstance(i, Unset): return i @@ -104,8 +101,7 @@ def validate_int(b): def validate_const(v): def validate(c): - # Optional[T] is a Union[T, None] - if is_union(type(c)) and type(None) in get_args(type(c)) and c is None: + if c is None: return None if v != c: diff --git a/packages/gcp/uv.lock b/packages/gcp/uv.lock index 3fca8e89..89b92c92 100644 --- a/packages/gcp/uv.lock +++ b/packages/gcp/uv.lock @@ -7,6 +7,10 @@ resolution-markers = [ "python_full_version < '3.11'", ] +[options] +exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values. +exclude-newer-span = "P7D" + [[package]] name = "annotated-types" version = "0.7.0" @@ -277,7 +281,7 @@ wheels = [ [[package]] name = "mistralai-gcp" -version = "2.0.0" +version = "2.1.0" source = { editable = "." } dependencies = [ { name = "eval-type-backport" }, diff --git a/tests/test_gcp_v2_parity.py b/tests/test_gcp_v2_parity.py index 0d6471e4..71ca1348 100644 --- a/tests/test_gcp_v2_parity.py +++ b/tests/test_gcp_v2_parity.py @@ -51,17 +51,17 @@ def mark_tested(resource: str, method: str) -> None: ("model", _EMPTY), ("messages", _EMPTY), ("temperature", UNSET), - ("top_p", None), + ("top_p", UNSET), ("max_tokens", UNSET), ("stream", False), - ("stop", None), + ("stop", UNSET), ("random_seed", UNSET), ("metadata", UNSET), ("response_format", None), ("tools", UNSET), ("tool_choice", None), - ("presence_penalty", None), - ("frequency_penalty", None), + ("presence_penalty", UNSET), + ("frequency_penalty", UNSET), ("n", UNSET), ("prediction", None), ("parallel_tool_calls", None), @@ -81,10 +81,10 @@ def mark_tested(resource: str, method: str) -> None: ("model", _EMPTY), ("prompt", _EMPTY), ("temperature", UNSET), - ("top_p", 1), + ("top_p", UNSET), ("max_tokens", UNSET), ("stream", False), - ("stop", None), + ("stop", UNSET), ("random_seed", UNSET), ("metadata", UNSET), ("suffix", UNSET), @@ -298,13 +298,13 @@ def test_stream_stream_defaults_true(self): sig = inspect.signature(Fim.stream) assert sig.parameters["stream"].default is True - def test_complete_top_p_defaults_to_1(self): + def test_complete_top_p_defaults_to_unset(self): sig = inspect.signature(Fim.complete) - assert sig.parameters["top_p"].default == 1 + assert sig.parameters["top_p"].default == UNSET - def test_stream_top_p_defaults_to_1(self): + def test_stream_top_p_defaults_to_unset(self): sig = inspect.signature(Fim.stream) - assert sig.parameters["top_p"].default == 1 + assert sig.parameters["top_p"].default == UNSET class TestGCPCoverage: