diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index baa46296..7d463029 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,11 +2,11 @@ speakeasyVersion: 1.763.6 sources: mistral-azure-source: sourceNamespace: mistral-openapi-azure - sourceRevisionDigest: sha256:a6918148cb6fdd9108b7bef0ef41fe5c9e79b18c65c0b52fc4d2afecf6db2d4d - sourceBlobDigest: sha256:dded6b429a29c2889469b10d19aecd41be2db06cde1a8408510120c8abfd9553 + sourceRevisionDigest: sha256:faccd49c0a52252b8dfcc666a6a1ba3fa5c7eb36f93c58c9b49547c98a254918 + sourceBlobDigest: sha256:b6f756ef1d57d93defe29a9f6789c746bd0c3b09e3f9e5fa0344ddf9ca47e5d7 tags: - latest - - speakeasy-sdk-regen-1773084953 + - speakeasy-mistralai-azure-sdk-26292833044-1 mistral-google-cloud-source: sourceNamespace: mistral-openapi-google-cloud sourceRevisionDigest: sha256:34edde5edcaf43acc036c9635cf4c60ce4e86f49b3fa2bed8960b995454e8d7c @@ -24,10 +24,10 @@ targets: mistralai-azure-sdk: source: mistral-azure-source sourceNamespace: mistral-openapi-azure - sourceRevisionDigest: sha256:a6918148cb6fdd9108b7bef0ef41fe5c9e79b18c65c0b52fc4d2afecf6db2d4d - sourceBlobDigest: sha256:dded6b429a29c2889469b10d19aecd41be2db06cde1a8408510120c8abfd9553 + sourceRevisionDigest: sha256:faccd49c0a52252b8dfcc666a6a1ba3fa5c7eb36f93c58c9b49547c98a254918 + sourceBlobDigest: sha256:b6f756ef1d57d93defe29a9f6789c746bd0c3b09e3f9e5fa0344ddf9ca47e5d7 codeSamplesNamespace: mistral-openapi-azure-code-samples - codeSamplesRevisionDigest: sha256:b7620f11d5669423730c5790ef4a72bba3ab46dd453e6685edf420053abbcb30 + codeSamplesRevisionDigest: sha256:aecd1edc929a931b5f9ce9013142d15163e9f4b9f6e11d96e96123177edd0d62 mistralai-gcp-sdk: source: mistral-google-cloud-source sourceNamespace: mistral-openapi-google-cloud diff --git a/examples/azure/chat_no_streaming.py b/examples/azure/chat_no_streaming.py index 952b171d..cccfa2eb 100644 --- a/examples/azure/chat_no_streaming.py +++ b/examples/azure/chat_no_streaming.py @@ -19,4 +19,5 @@ UserMessage(content="What is the capital of France?"), ] res = client.chat.complete(model=AZURE_MODEL, messages=messages) -print(res.choices[0].message.content) +if res.choices and res.choices[0].message: + print(res.choices[0].message.content) diff --git a/packages/azure/.speakeasy/gen.lock b/packages/azure/.speakeasy/gen.lock index ec39708b..e96be0e1 100644 --- a/packages/azure/.speakeasy/gen.lock +++ b/packages/azure/.speakeasy/gen.lock @@ -1,48 +1,49 @@ lockVersion: 2.0.0 id: dc40fa48-2c4d-46ad-ac8b-270749770f34 management: - docChecksum: 564969ee9c3ae8a740e47605a64c0077 + docChecksum: e657bc210fa9d8169a75517584cfe478 docVersion: 1.0.0 - speakeasyVersion: 1.729.0 - generationVersion: 2.841.0 - releaseVersion: 2.0.0 - configChecksum: 62c02749475cfa5a77859c3b5fab5b8f + speakeasyVersion: 1.763.6 + generationVersion: 2.884.13 + releaseVersion: 2.1.0 + configChecksum: bc26627b24c855835f05b16e35a18296 repoURL: https://github.com/mistralai/client-python.git repoSubDirectory: packages/azure installationURL: https://github.com/mistralai/client-python.git#subdirectory=packages/azure published: true persistentEdits: - generation_id: b492a8a2-7f2d-419f-bbf4-8db30c210bb5 - pristine_commit_hash: 0d59853df8a614bb4710a34bfea9a6211af33fae - pristine_tree_hash: 9cc57b34f00c96452174bfa6fa5b7e02c099aeca + generation_id: f07aab1c-5923-4503-9d5d-a197e421c084 + pristine_commit_hash: b2c9916623e2899cd1ba4d37d480fd6f3661e4b7 + pristine_tree_hash: 01b0cdfce6e0e00a23f9debf094e22c0405a02d9 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:2e88e09c549c6101d8ee93978514e168f5d348e3 + pristine_git_object: 150f89b05ac988beb0bd8072ba6d9326fb0c9d3e 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:fb429ef425a1b01bd6e1a6cb5770034683ebef72 + pristine_git_object: 1ca6a646a7b9ef2b4dd9b0ba8de9e6c8aa63db93 docs/models/chatcompletionrequest.md: id: adffe90369d0 - last_write_checksum: sha1:00453565d70739471a4e1872c93b5b7e66fe6cb6 - pristine_git_object: f8715cd0a335c6dc0fda4b60400f11c4aa8a0a06 + last_write_checksum: sha1:c88753689fc6e0ef5dbbb0c3c6ac69d05e290b85 + pristine_git_object: ba44a0661680b2e757d08e898bf399f4d5c2dc11 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:7233a19b12f3204b8e2259a4a09d0d9726609e4e - pristine_git_object: cc82a8c707268084865f86d71be82de5ebf6f821 + last_write_checksum: sha1:52faa9fc8bebad9ebc6b8d9be01d2f7890a4a515 + pristine_git_object: c3d90e133c2b4c1714cbddaa653ae646daed82dc 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,12 @@ trackedFiles: pristine_git_object: 1532c25b8fc065d486f52d4610a7f757e5340875 docs/models/completionresponsestreamchoicefinishreason.md: id: 5f1fbfc90b8e - last_write_checksum: sha1:20824b4a223cbd3658b32440973a7d47dcd108b9 - pristine_git_object: 0fece473297227c75db4e7ded63417a2f117cac0 + last_write_checksum: sha1:4bb61177835571bc4a271f14e1e2ea1780556d85 + pristine_git_object: f1bd6ad8a352b557344644bc1f55446e4024d795 + docs/models/confidencescoresgranularity.md: + id: 76a175c65878 + last_write_checksum: sha1:049eeb8421d61023dd5652cea4df1c62d8152914 + pristine_git_object: 32161eeed231ad16e4dbb212cce624d58f3093ea docs/models/contentchunk.md: id: d2d3a32080cd last_write_checksum: sha1:5839a26cdc412b78caad7fb59df97bdcea57be6d @@ -140,10 +165,14 @@ 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 @@ -152,6 +181,10 @@ trackedFiles: id: cd1d2a444370 last_write_checksum: sha1:d00a2ac808a0ae83a7b97da87e647ecc8dca9c52 pristine_git_object: 509d43b733d68d462853d9eb52fc913c855dff40 + docs/models/documentlibrarytool.md: + id: 68083b0ef8f3 + last_write_checksum: sha1:76b9f47c399915a338abe929cb10c1b37282eadf + pristine_git_object: 95c3fa52ee3ff29e72bc0240a98c0afaa0cd5f62 docs/models/documenturlchunk.md: id: 48437d297408 last_write_checksum: sha1:5f9294355929d66834c52c67990ba36a7f81387d @@ -162,8 +195,8 @@ trackedFiles: pristine_git_object: 18217114060ac4e4b45fefabace4628684f27e5c docs/models/format_.md: id: a17c22228eda - last_write_checksum: sha1:dad6de59fec6378d50356007602e2a0254d8d2e4 - pristine_git_object: 97d286a4ed7cff0a4058bbfa06c4573428182876 + last_write_checksum: sha1:305fff64a63eaaef9d2d0ea1f5c439b657515095 + pristine_git_object: 3311b410893086b87a077fa09b822e56e7acddb1 docs/models/function.md: id: 416a80fba031 last_write_checksum: sha1:a9485076d430a7753558461ce87bf42d09e34511 @@ -176,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:7588bc9f9c09df1b040f4b97b678b56e09244743 + pristine_git_object: d13adbf683bd58d3948f0057bf86b8754a132721 + 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:da7a792f7b649f311062338dfbf3d25ff55fe6c5 - pristine_git_object: db0c53d22e29fa25222edb86b264e5135879a029 + last_write_checksum: sha1:05e0c3053720c6ad6c663237a3f3621e0e9fed9f + pristine_git_object: 6d238e255d368c1b12ddc231dc5f8dc11279d47e docs/models/imageurlunion.md: id: 9d3c691a9db0 last_write_checksum: sha1:4e32bcd7d44746d2ddbfafbef96152bb2bdb2a15 @@ -202,52 +243,96 @@ trackedFiles: pristine_git_object: d6094ac2c6e0326c039dad2f6b89158694ef6aa7 docs/models/mistralpromptmode.md: id: d17d5db4d3b6 - last_write_checksum: sha1:abcb7205c5086169c7d9449d15ac142448a7d258 - pristine_git_object: c3409d03b9646e21a3793372d06dcae6fef95463 + last_write_checksum: sha1:200dff492c240b34321df5755933ba0344fdc9ca + pristine_git_object: 3a8f7841e73e56411185d6095aa96054b1bea6b0 + docs/models/moderationllmaction.md: + id: 26373b4ad9cd + last_write_checksum: sha1:443a682b1f1c5d5068316431aac6cdd65132b77e + pristine_git_object: 526b7a1311e66a2561cf1ac6277cd9412edf0a10 + 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/ocrconfidencescore.md: + id: 44a3cb211acc + last_write_checksum: sha1:d88c21a3aa36f24e00c2b24c31bc54944d1fc73f + pristine_git_object: 73fdcb28b1044bb7122ba6609708979c17a46e5e docs/models/ocrimageobject.md: id: b72f3c5853b2 last_write_checksum: sha1:90c5158dec6a7b31c858677b6a8efa1e3cabd504 pristine_git_object: 3c0d5544a80499b011467f29ef83d49f53801af6 + docs/models/ocrpageconfidencescores.md: + id: 4bc78fe53e38 + last_write_checksum: sha1:26733f345c69b188d372290784688a972fe39dbf + pristine_git_object: bffb214868dd74e617c87ff19e3909419d9acc97 docs/models/ocrpagedimensions.md: id: b3429f9883f5 last_write_checksum: sha1:6435aa56e6153b0c90a546818ed780105ae1042a pristine_git_object: c93ca64d5e20319ec6ec1bcb82b28c6ce0940f29 docs/models/ocrpageobject.md: id: 88a9e101b11e - last_write_checksum: sha1:091077fedf1b699d5160a21fe352056c247ef988 - pristine_git_object: 02473d44f73485fd7b7f0031d51bfac835d4036e + last_write_checksum: sha1:84b903d90dadcac943000b90e8a8e8a81c8b92fa + pristine_git_object: 0fc55052cdf2360131c0adcec93a732e2b0f78c5 docs/models/ocrrequest.md: id: 6862a3fc2d0f - last_write_checksum: sha1:eefa8ad80773e00ac297f3cf806704ac6ac3557d - pristine_git_object: 2d26c19fd1cecb234d7fb761dd73cc0a59e622ad + last_write_checksum: sha1:d06488b0ac9343813db7fe9f58d3a8450d7fa663 + pristine_git_object: 2066b90339c5bfb795e94581edc47412fac75a2e docs/models/ocrresponse.md: id: 30042328fb78 last_write_checksum: sha1:8e4a4ae404ea752f3e9f1108c2a5f89ed6cfb143 pristine_git_object: 0a309317644eedc643009b6cec3a7dbb142b1a15 docs/models/ocrtableobject.md: id: c967796380e6 - last_write_checksum: sha1:3b78858cc130fc8792ec3d149c8f657fd3f7a4c3 - pristine_git_object: 4e27697c15983f86274648b2d7bacac557081630 + last_write_checksum: sha1:deb1715d618330b4f791b7237955e697d26c6bc2 + pristine_git_object: 2da8f6105dd83d7f4d067c74298316ab512c9c3f docs/models/ocrusageinfo.md: id: 419abbb8353a last_write_checksum: sha1:6e717a3f3de3c464e8b3237f06867cdfecec339e pristine_git_object: d9d79125cb02bc2b09d8dc543a5e2d4a6c55571c + docs/models/pages.md: + id: 9045c659bb29 + last_write_checksum: sha1:b4b9daaa3e2bd6efeb6f5efe07e8da58385b3ee3 + pristine_git_object: a3631692d4d8c230e71c7c9c6ccb12b96fd93279 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:e76b9260f9dd23ab2f0c6a700602f918c3792857 + pristine_git_object: f39e92ac9f7c6a19e24b5773252d179e1b3856a9 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:97126f8e76a1893953f7c4b370dadc32ea0a1e24 + pristine_git_object: 73c02b7785e6e897fa04c3546aa12285b7e28e2e docs/models/security.md: id: 452e4d4eb67a last_write_checksum: sha1:ce2871b49c1632d50e22d0b1ebe4999021d52313 @@ -266,36 +351,40 @@ trackedFiles: pristine_git_object: 40030c170746d9953d25b979ab7e6f522018e230 docs/models/tableformat.md: id: d8cd08c55c3c - last_write_checksum: sha1:e0736ea9576466d71821aa1e67fc632cc5a85414 - pristine_git_object: 54f029b814fdcfa2e93e2b8b0594ef9e4eab792a + last_write_checksum: sha1:b1a0e125b25ed0fe71ea56bbce405e49cae46c9a + pristine_git_object: 14b06acbae039dbb46bd2872dbc16e5bdee4cffc docs/models/textchunk.md: id: 6cd12e0ef110 last_write_checksum: sha1:aa448d4937c0c1cd562621f0a9080aa0dc6e4bd1 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:7cb97b478232ae43bae387483c7df310f5ebd9eb + pristine_git_object: 608091262e369e585ba2d9391671dedf1d1db539 + 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 @@ -306,16 +395,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 @@ -336,6 +421,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 @@ -344,10 +437,6 @@ trackedFiles: id: 7ce8b9f946e6 last_write_checksum: sha1:8f871a5aac4b10bff724c9d91b8d7496eb1fbdde pristine_git_object: 0391ac11bdc5526b697b69d047d568a611ce87d0 - scripts/prepare_readme.py: - id: e0c5957a6035 - last_write_checksum: sha1:26b29aad3c23a98912fd881698c976aac55749fe - pristine_git_object: 2b2577ea83873f64aa9f91d9d762bc6e1f250977 scripts/publish.sh: id: fe273b08f514 last_write_checksum: sha1:b290b25b36dca3d5eb1a2e66a2e1bcf2e7326cf3 @@ -370,16 +459,16 @@ trackedFiles: pristine_git_object: 3e4e39555d60adebe84e596c8323ee5b80676fc9 src/mistralai/azure/client/_version.py: id: a77160e60e5d - last_write_checksum: sha1:991341c1aaa4a0fc2ef89aa7a69429b54764d309 - pristine_git_object: 8923c29dad7a842f2137ae6e466c8a7ddf13823d + last_write_checksum: sha1:78ea54afa03d5257fab907e6b9d8b352b6f83580 + pristine_git_object: 4641c83258e80ce3b79400e8cd2f4336d0f92012 src/mistralai/azure/client/basesdk.py: id: 5a585a95ec21 - last_write_checksum: sha1:0c2e686aa42d6aeeb103193aa058d6ddff7bcf74 - pristine_git_object: 0d4d9a440e6c7726b6bc7fc6525aa3dc009847eb + last_write_checksum: sha1:1ad34df596605b1ce2ada8d120223e5c13f7bd9a + pristine_git_object: e08ce351fbd7530d940fcd61c29f33285de91d58 src/mistralai/azure/client/chat.py: id: c18454e628d7 - last_write_checksum: sha1:884e22b0e313662c67cec7101765d8d7ef0bc48a - pristine_git_object: 1051f9527851894988f7e1689923575cf72a0896 + last_write_checksum: sha1:6f76826ff4e853b3ddd692f5f1b3d5a49cd9b257 + pristine_git_object: e3915c745af0bb1dac79b4fadea9d190b9472c62 src/mistralai/azure/client/errors/__init__.py: id: f377703514d9 last_write_checksum: sha1:36c516c11f8083c3380a72c1d0f0718a3345f24b @@ -410,64 +499,80 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/mistralai/azure/client/models/__init__.py: id: "335011330e21" - last_write_checksum: sha1:6ae218231fc52b0ce36cf3ed2116c93e4782791f - pristine_git_object: 79c5df321d8d95cecd502e22a521165f70c5c635 + last_write_checksum: sha1:19ab292c86de25adc40cb0f8159cdfa382386e36 + pristine_git_object: d9c28adc636c9eb1e204eeee4775bb8ba53e5a25 + src/mistralai/azure/client/models/apikeyauth.py: + id: 90b0600cb391 + last_write_checksum: sha1:77e9e4546f94890349f82ed033b679bf495e7c48 + pristine_git_object: 7bce715c111562d0a32809f32dfdc4d337406c1e src/mistralai/azure/client/models/assistantmessage.py: id: 353ed9110f97 - last_write_checksum: sha1:973979ac03f86f26ee9a540aaaa8f70a7011daca - pristine_git_object: e9ae6e82c3c758561c8c9663f27b2fd7e38d2911 + last_write_checksum: sha1:9271319ff0ffc6190b2bb771dcd1a5378008c276 + pristine_git_object: f5e3316b0ff4818cb7b5d2d14d8fc6c4b4f951b9 src/mistralai/azure/client/models/builtinconnectors.py: id: d260ad466b17 last_write_checksum: sha1:4e94744e3854d4cdc9d1272e4f1d9371f9829a5f pristine_git_object: 6a3b2476d54096722eb3e7a271629d108028bd35 src/mistralai/azure/client/models/chatcompletionchoice.py: id: 6942c7db5891 - last_write_checksum: sha1:817bfda6120a98248322c308629e404081e01279 - pristine_git_object: 67b5ba694217f4f3b95589d7f84af6a9bea9802d + last_write_checksum: sha1:a99520160412adfa8b53d4d054c4d192d82920a1 + pristine_git_object: 7ab8832c80929a48412d03aae4e718a855229cfa src/mistralai/azure/client/models/chatcompletionrequest.py: id: 0c711c870184 - last_write_checksum: sha1:ffdd11a4945dd805c9a73328749c2f4d9b6f80e6 - pristine_git_object: edd0fdc74a1b81f458d6083e79dc393e488da36a + last_write_checksum: sha1:b290e59c11479f7c5d7e555a220fb99bb8c105e5 + pristine_git_object: 90dc0101c736b0dc10b3725fec32401c2300d559 src/mistralai/azure/client/models/chatcompletionresponse.py: id: bdfacf065e9e last_write_checksum: sha1:c72fb624e7475a551d37e0b291b64bcf772c402a pristine_git_object: d41f9c6fab670cf7c961f50b1302f9a88cf48162 src/mistralai/azure/client/models/chatcompletionstreamrequest.py: id: da00a7feb4ef - last_write_checksum: sha1:8bb36693fed73a50d59687ca8b30a2c443708610 - pristine_git_object: 2edfbed98462eab43f322b9c706721365e410bb9 + last_write_checksum: sha1:409ecde82694094b5acf730c6c87225649fb826e + pristine_git_object: 757d623150bc7b7e8ed9ebd514b3294f56d12f32 + src/mistralai/azure/client/models/codeinterpretertool.py: + id: b3a6fae1bf7c + last_write_checksum: sha1:25194d72cececa577ad4a010a910a346e25fb331 + pristine_git_object: 0f588be3278948fb4864c5193171f223d7372108 src/mistralai/azure/client/models/completionchunk.py: id: 28d620f25510 - last_write_checksum: sha1:84d1c55ef7bdb438e7f536a604a070799d054281 - pristine_git_object: 0e64bbc8aa0293c9d763db56287f296909260c38 + last_write_checksum: sha1:d980ae761d584f526417413c29d26a644adbbdd8 + pristine_git_object: f6168f17a21af0f45549bc345e29c7612afacddf src/mistralai/azure/client/models/completionevent.py: id: a6f00a747933 last_write_checksum: sha1:3d04bfbdaf11c52af5613ed0fd70c8dbc59f6d49 pristine_git_object: c4b272871d9b3ea8443f469d29b0825706c25c00 src/mistralai/azure/client/models/completionresponsestreamchoice.py: id: 3ba5d7ba8a13 - last_write_checksum: sha1:4de311509c71c8f582b2c767febea89f1acd341a - pristine_git_object: 20a271401ff98d69525947ab929078af83aab1f1 + last_write_checksum: sha1:215e9f0290c30472f322ca0baad251ddd363e90d + pristine_git_object: 36be83026bcd9431f87238971fca8e566a4c831c src/mistralai/azure/client/models/contentchunk.py: id: 1f65e4f8f731 last_write_checksum: sha1:cf11e1f061d3c8af040ebbdba0b25d4177e1cea4 pristine_git_object: 17efcc7d5825461576cf61257908688cffd23eb7 + src/mistralai/azure/client/models/customconnector.py: + id: 667abbf974f5 + last_write_checksum: sha1:3a9d4ea0fdb5c94d6849ae34b37786fc514d8084 + pristine_git_object: e7eac82ac40ccbe16e7f15b7130f34a5991f78e1 src/mistralai/azure/client/models/deltamessage.py: id: b7dab1d158de - last_write_checksum: sha1:190c2809d575244eda5efbb1e00a4ec5811aea29 - pristine_git_object: 567e772fc1b376efaec1a2dfd660bc74a916f8ee + last_write_checksum: sha1:1d9f3d87e728503470a62274bf4e14fbb334d0cf + pristine_git_object: 5bac18c228dd30a65d55c23ec4e9e4c845dd9de6 + src/mistralai/azure/client/models/documentlibrarytool.py: + id: 767763a86267 + last_write_checksum: sha1:5c56964279d1a4873ff5837b9353363917ba46ce + pristine_git_object: 6e2e31e795e8f0aaf05d1ad55f0f97c04437f15e src/mistralai/azure/client/models/documenturlchunk.py: id: e56fec6e977f - last_write_checksum: sha1:0313d94f343d46dac7cc3adc392feaf06fa2b2a4 - pristine_git_object: 2dea80056f6752bdaa5d00f391cb6f54371a9d2b + last_write_checksum: sha1:6ca5678c910d689b49b3aeb6d2ac3c88026d3315 + pristine_git_object: 03af581691982a7c92a920580ff977029c047a61 src/mistralai/azure/client/models/filechunk.py: id: 150d9f180110 - last_write_checksum: sha1:6d12d630a5bfd601836f9cb3d63b9eb2f15f880d - pristine_git_object: 6baa0cba81535e157c0f81ae2648362f7bd1adbd + last_write_checksum: sha1:abc825d41e5d50809612f6ccbdb13c6c275355dd + pristine_git_object: 772f67e6f68542d5d50925d1d0b257fc97449e27 src/mistralai/azure/client/models/function.py: id: 6d1e2011a14b - last_write_checksum: sha1:b064eca9256966603581d41b5b2c08cd2448224d - pristine_git_object: 055d3657fd98da63b80deb8cd2054e95a0e66a2b + last_write_checksum: sha1:a697a846786d49be782f6c4382034c161aa465fb + pristine_git_object: 3f135ed262430a705989607b9dee732b0270e71a src/mistralai/azure/client/models/functioncall.py: id: ced560a1bd57 last_write_checksum: sha1:490cb3a0305994de063e06fa4c77defa911271f3 @@ -476,66 +581,110 @@ trackedFiles: id: 6f09474ebc85 last_write_checksum: sha1:651ceed24416ce8192f70db03cc5cd0db685899f pristine_git_object: 839e0d557a902da6c819210962e38e1df9bda90f + src/mistralai/azure/client/models/guardrailconfig.py: + id: 58feab16c930 + last_write_checksum: sha1:73457a4444c46ca4ab9dce3b9e67c6940dfb8a18 + pristine_git_object: 4feffa67feecb2fa1e8b36128e95d2cb54fff4ca src/mistralai/azure/client/models/imagedetail.py: id: de211988043d last_write_checksum: sha1:812f2ec4fc0d8d13db643ed49192384d5a841aa4 pristine_git_object: 2d074cee614e1c49b69ee4073c3aaaa7a5a2c9e2 + src/mistralai/azure/client/models/imagegenerationtool.py: + id: 789c0facd38d + last_write_checksum: sha1:ffc9e94d9f1458001015182e195714a617cdc9fb + pristine_git_object: 5c51d688d9aebac94f628ebdbfbe4cd0cd142e3d src/mistralai/azure/client/models/imageurl.py: id: c8882341c798 - last_write_checksum: sha1:8c3c08cc5d33c66b12539270b7edbf157d936f86 - pristine_git_object: bcb4fe43d334752be501d694543250d7e632a9c7 + last_write_checksum: sha1:a65ea39bd95e932d2af43731c768c0a6fdbafbdd + pristine_git_object: c1704cd899da55f162245e748528f4b0162936ef src/mistralai/azure/client/models/imageurlchunk.py: id: b6f0abb574d7 - last_write_checksum: sha1:417618d9d2aba85386a100dfe818d13342830526 - pristine_git_object: 7213c49846a4107271d017dd695648d98c2efa94 + last_write_checksum: sha1:d4cac15f4dd55582aca63f97b2f054fb375ade6c + pristine_git_object: 8e8df9a624db97fd142c478ea298bf8e6cabb3cc src/mistralai/azure/client/models/jsonschema.py: id: bfd486f4bb18 - last_write_checksum: sha1:ccb2b53bd2351ec5119d9a7914a1a42c2746a096 - pristine_git_object: 99f2fb8903562465687edfd300d8efd373b92247 + last_write_checksum: sha1:d4c3bf57f61c8ec51552c24ea8353555733b4f37 + pristine_git_object: 2790728b9b2cabcd99f11695a36fd5c7e2c2da23 src/mistralai/azure/client/models/mistralpromptmode.py: id: d0028b1e4129 last_write_checksum: sha1:46fe1ab8ac2d5867877368a59a4aa5be2fabadeb pristine_git_object: 26e7adbdc4a981c92d51b72542c966b0ba0fb8f8 + src/mistralai/azure/client/models/moderationllmaction.py: + id: e2fba44eb74f + last_write_checksum: sha1:fbc27faa2fbaa51a66bee21935c4bce350291f5e + pristine_git_object: cff03d9aa6de26ce3daa9edbc065ec3f759b5ee6 + src/mistralai/azure/client/models/moderationllmv1categorythresholds.py: + id: f349ac02c9f0 + last_write_checksum: sha1:0e79c7b6296b2479929e5404626622c08752d2f1 + pristine_git_object: e3e9b22fb1ce89a4e9943fcb2a7a7aa665ed3ef4 + src/mistralai/azure/client/models/moderationllmv1config.py: + id: ac93fb39aadb + last_write_checksum: sha1:e24e34932dba1153a1ecf294d6cd78580b24e0cf + pristine_git_object: 8226887086a03b23627bd0b571efcff5ac92e27b + src/mistralai/azure/client/models/moderationllmv2categorythresholds.py: + id: ea8effbabe44 + last_write_checksum: sha1:12a4cd1a62d1c28b46c43fa062785f6217e40d3f + pristine_git_object: 57af08d82fd18e3a3a6c03d08e0c91c9c02433da + src/mistralai/azure/client/models/moderationllmv2config.py: + id: 35717297bfb3 + last_write_checksum: sha1:b66c2038d93cc8b5ba97a46a2cb724d65d6ef7ee + pristine_git_object: 57075e6051d669c7a531c13de6c6fa59c4fbd745 + src/mistralai/azure/client/models/oauth2tokenauth.py: + id: 11354c05bf86 + last_write_checksum: sha1:130bd53306d15d52f9dbc370bf1cfc129ba9ea30 + pristine_git_object: 3da345fce3ac1a56977ea6e216c7c03fbc751716 + src/mistralai/azure/client/models/ocrconfidencescore.py: + id: 523a4fdcb5b5 + last_write_checksum: sha1:fd008d51230ccdeaec923814c2d850f26ae0aab5 + pristine_git_object: 7ac59069009c5263d7c3ec016eb3dc5ccb12aea4 src/mistralai/azure/client/models/ocrimageobject.py: id: 9c9f987d94bb - last_write_checksum: sha1:423effee97a4120a26ba78c2abe7f6adeb5c733d - pristine_git_object: a23515b346a0f9517fec0b2381e1b0c04cb31816 + last_write_checksum: sha1:ddad5de6270b68f86ffd79322ce24dc8429b328a + pristine_git_object: 91d7ac0e16b3c9aafc055d1456de17abef14864f + src/mistralai/azure/client/models/ocrpageconfidencescores.py: + id: 697ff82a29a0 + last_write_checksum: sha1:7db4c357f8bfa78a6b448a5d80678b3c4e86c123 + pristine_git_object: 2d5d7a1ac3113eaa295ec98a739487beb03820a3 src/mistralai/azure/client/models/ocrpagedimensions.py: id: 7669a25f32b3 last_write_checksum: sha1:60642db6bb61f0e96204fb78d3aa0bd80dd0a7e5 pristine_git_object: 12858da92de99aa6da9d6e148df3ba7ee37496c7 src/mistralai/azure/client/models/ocrpageobject.py: id: eea193b05126 - last_write_checksum: sha1:b8370ac0611dc3eccf09dddf85d1c39d3a11224b - pristine_git_object: 434c8988f124f93180e6cefa15b3aee067937946 + last_write_checksum: sha1:b7a51aa640c4fc234618b9f362ab5972f39242ee + pristine_git_object: 08b5dbcb3734353dc44d235553ea98109be92795 src/mistralai/azure/client/models/ocrrequest.py: id: 365a5b4776a2 - last_write_checksum: sha1:e684da1b6db18cb9c5ce95b9cc58556e05a9ea9b - pristine_git_object: a2cd341593c9db3644076d39352abca6815efc56 + last_write_checksum: sha1:c59138d47c445ee26cdbeb290c56ad2f126a4b59 + pristine_git_object: 731c0cf82fd659a5a41917b7f2416cabbf322a85 src/mistralai/azure/client/models/ocrresponse.py: id: b8cde8c16a4c - last_write_checksum: sha1:55e81631f6fe57aaf58178460e1c5fc69fa19377 - pristine_git_object: 3dc09fd770a064e69e84519bd0f0c9127ebd8176 + last_write_checksum: sha1:d34db61dc06e7755e827e54c1b7e8c37b1ad5d12 + pristine_git_object: 6e27f574d2a4588f758c52be064744541265d5d7 src/mistralai/azure/client/models/ocrtableobject.py: id: c2cd51b8789e - last_write_checksum: sha1:86a8fd2241cf6a636e81e58484a90bdb7880085e - pristine_git_object: f1de5428a71f9d42cd9f9e764d0bbf88f3aad8cc + last_write_checksum: sha1:46a369822ea4311807e2103c22f42b19630fb2d9 + pristine_git_object: 07bc7c1309e5aef087b1b78f43be1041cd70460c src/mistralai/azure/client/models/ocrusageinfo.py: id: 5e9118cac468 - last_write_checksum: sha1:97887b58cfe6ebd9ebd5905c6c7485525d6dc788 - pristine_git_object: f63315d23a1659aee4333b45c4239861aa5220d7 + last_write_checksum: sha1:12f75c7d33a9f784eaafc97b24e94350fea2ae41 + pristine_git_object: b5c5f5c1189677bdc33d4d9a3f882f25dc5d4b4d src/mistralai/azure/client/models/prediction.py: id: bd6abfa93083 - last_write_checksum: sha1:07d06d5629af183f999e043744a67868ef779bcc - pristine_git_object: 1fa1d78248628ccdc102ce0631d344150addfd2d + last_write_checksum: sha1:8fde8f75071e011b7add558b3c61dfe2e04c2ea5 + pristine_git_object: 3d94feb5181b714b773ce4158af2bf786f382fa5 + src/mistralai/azure/client/models/reasoningeffort.py: + id: 16ce306129e5 + last_write_checksum: sha1:703d87ae8c89b9fa9284833c45daa77752c3a8e8 + pristine_git_object: 43ffa02b8407ab64d41f23c3a56c02fe275e38de src/mistralai/azure/client/models/referencechunk.py: id: c9612f854670 - last_write_checksum: sha1:e81e758e00db915e68f58ffa1e03b2c473f64477 - pristine_git_object: f7af9bf9a73e0d782e5e6c6a7866af6fbc3668d8 + last_write_checksum: sha1:20193f683118bf6491fbf54c103c9b7433d9c2de + pristine_git_object: debab3cece0fdbb7e8dbcdf31b773f4d2eb79fe4 src/mistralai/azure/client/models/responseformat.py: id: c124e7c316aa - last_write_checksum: sha1:d368a2d4320356b6daab1dd0c62c6c862e902ca0 - pristine_git_object: 20fd2b868506cff278d1d7dc719eddd56ea538b0 + last_write_checksum: sha1:8233b272403d9b96f194498d624703e936a7d4ad + pristine_git_object: 50f0b075404b540f8003e56dbe23f2f22b71f9d1 src/mistralai/azure/client/models/responseformats.py: id: fef416cefcd4 last_write_checksum: sha1:a212e85d286b5b49219f57d071a2232ff8b5263b @@ -558,52 +707,60 @@ trackedFiles: pristine_git_object: 9295148588a143278ff5f48f9142347e35cfdab2 src/mistralai/azure/client/models/thinkchunk.py: id: df6bbd55b3eb - last_write_checksum: sha1:b988cdf2755c3192aef30a9b2f945214fbc59785 - pristine_git_object: ec8e7f95be2ff0d742acb1fdea2867e23788cb06 + last_write_checksum: sha1:0be9b76a5278eb5ac537500cfc097d0a6605aa44 + pristine_git_object: 8e52ccc9dc36aad303a1aaf7f596f8d33071073b src/mistralai/azure/client/models/tool.py: id: 4075ef72c086 - last_write_checksum: sha1:4bef6d64b6426fdeff5031557c3c0e37f5c33b9a - pristine_git_object: 87329bdb73526120a3f63d48299114485a7fe038 + last_write_checksum: sha1:0d6610c91df755b3c9e037053e01acb3b2e7fe5f + pristine_git_object: ecfb5f34f0b09cedd026db218e99fdff5c994df8 src/mistralai/azure/client/models/toolcall.py: id: c65e6f79e539 - last_write_checksum: sha1:a3b36214b4533b79868630348762206a0e5ca26e - pristine_git_object: ada1ea65136fa58dce55f2857d895ea916bcd41f + last_write_checksum: sha1:c4892903cf784b2c9c419e0531dd50d73c7de117 + pristine_git_object: 87ccd030b41a93ad28a62accb84ec6bdbbb1d477 src/mistralai/azure/client/models/toolchoice.py: id: c25062b5de34 - last_write_checksum: sha1:6212c9366eb3b4f4062c86c00d4502dd03bf5ce1 - pristine_git_object: ddb9e1417c880c44a7f0505bfde839570fa3cd4a + last_write_checksum: sha1:8d33cc71f03e577f9ec3f98a23096d3eb75742cb + pristine_git_object: 15d1da1cebd1d8c36c33d60a4b57725e85c8f1e5 src/mistralai/azure/client/models/toolchoiceenum.py: id: cc06ba3a8d21 last_write_checksum: sha1:3dbba9a58c5569aafe115f3f7713a52b01ad8620 pristine_git_object: 01f6f677b379f9e3c99db9d1ad248cb0033a2804 + src/mistralai/azure/client/models/toolconfiguration.py: + id: b07091794add + last_write_checksum: sha1:7a31641d9497635de16a650d0a3e0c82bc4c36f3 + pristine_git_object: 6977679f36a90e5a86c6574fa8b3ef1fd2f24c19 src/mistralai/azure/client/models/toolmessage.py: id: 84ac736fa955 - last_write_checksum: sha1:e4ed14906985fe74fd76a9adb09125ebc1218a1f - pristine_git_object: 670210de0d05b52ee9dffbbb808a87e67c2d37a9 + last_write_checksum: sha1:aa9b117c29886ed3cf1a1269a9d4b180f40f6168 + pristine_git_object: e246d5a29af3d758a2e81413abe8d24b4a487872 src/mistralai/azure/client/models/toolreferencechunk.py: id: b96d2eda57fc - last_write_checksum: sha1:6640e3ce0e2a0478fb29e6ea28ff6c447d4aea44 - pristine_git_object: c9db878fd3234ca46b0f958994e9dda4d68b9171 - src/mistralai/azure/client/models/tooltypes.py: - id: fa881b046d34 - last_write_checksum: sha1:cd28ddc02fff9a5abbb59c82fe9e0dcbdb9b6d2a - pristine_git_object: 1cce7446f2772b998208ea1c78c7969e3881d5d0 + last_write_checksum: sha1:3f522c035643c96d12df6047a253c48735c29f38 + pristine_git_object: 0845fde3cbab8e46038e957367dbc1ea1581440f src/mistralai/azure/client/models/usageinfo.py: id: 3edc9c81b329 - last_write_checksum: sha1:0ac2350e4efa1ed3ffd7d33ac91c3ef564d1d773 - pristine_git_object: 0f04c87c97ff3148106408a46618c848b86c4b37 + last_write_checksum: sha1:98dce1963bb4a9cccc5634d79d210c2fb92d92de + pristine_git_object: 9200682a4344cfa6e67fb30d5dc7710fbb547940 src/mistralai/azure/client/models/usermessage.py: id: 3796508adc07 - last_write_checksum: sha1:8eb35fb07971d74cf2cb0858c037558f52df6aa9 - pristine_git_object: 549b01ca887651a95c5efc8aff3372d32dfdc277 + last_write_checksum: sha1:8e93e3edef3fc85c60a16d7e7b74a0fc357f4646 + pristine_git_object: 7dbca134f54afcb93e0cb2fd7faa09a3010c2172 src/mistralai/azure/client/models/validationerror.py: id: f2b84813e2ea - last_write_checksum: sha1:10b9637fc1c659518bc5bc9116058ad055869800 - pristine_git_object: f0169e18a5d0e3d1d87fd907697fcca22b11bc06 + last_write_checksum: sha1:ab5b5f28322856248c4288cce029c385100b80c4 + pristine_git_object: aaa72f21ce4ccbea4d7278539d898c5e9f799e44 + src/mistralai/azure/client/models/websearchpremiumtool.py: + id: 4b8bc6d9411d + last_write_checksum: sha1:7ae05870a61adb37cf8f2b7828f728b55fdd1440 + pristine_git_object: 252d8803e71d18b01e702ec2cbc6f57db0191e73 + src/mistralai/azure/client/models/websearchtool.py: + id: f0af7a3db559 + last_write_checksum: sha1:f5ed31a377eec433ebd35e6754a313590a5f83d3 + pristine_git_object: 363e033128fe7eb091280a58d53d0013b2020930 src/mistralai/azure/client/ocr.py: id: 5817c10c9297 - last_write_checksum: sha1:7666ca9f4596cee080952b2f4096bd4176051680 - pristine_git_object: b9270f6a52406d8a9bf02d90c24ae540da6dfb9d + last_write_checksum: sha1:935155cce07869bfed809449223528a892d2577a + pristine_git_object: c4f706a9b197f86183eece46dcc96c2786dfca5c src/mistralai/azure/client/py.typed: id: e88369f116d2 last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 @@ -642,8 +799,8 @@ trackedFiles: pristine_git_object: 3324e1bc2668c54c4d5f5a1a845675319757a828 src/mistralai/azure/client/utils/eventstreaming.py: id: bdc37b70360c - last_write_checksum: sha1:ffa870a25a7e4e2015bfd7a467ccd3aa1de97f0e - pristine_git_object: f2052fc22d9fd6c663ba3dce019fe234ca37108b + last_write_checksum: sha1:620d78a8b4e3b854e08d136e02e40a01a786bd70 + pristine_git_object: 3bdcd6d3d4fc772cb7f5fca8685dcdc8c85e13e8 src/mistralai/azure/client/utils/forms.py: id: 51696122c557 last_write_checksum: sha1:0ca31459b99f761fcc6d0557a0a38daac4ad50f4 @@ -658,8 +815,8 @@ trackedFiles: pristine_git_object: b661aff65d38b77d035149699aea09b2785d2fc6 src/mistralai/azure/client/utils/metadata.py: id: 44f85bd3b2e2 - last_write_checksum: sha1:c6a560bd0c63ab158582f34dadb69433ea73b3d4 - pristine_git_object: 173b3e5ce658675c2f504222a56b3daaaa68107d + last_write_checksum: sha1:e703e5cbb5255144aacf86898d1420529afaaff8 + pristine_git_object: 5abddd588837ac297050ca3b543627faadb350a9 src/mistralai/azure/client/utils/queryparams.py: id: ec1c03114156 last_write_checksum: sha1:b94c3f314fd3da0d1d215afc2731f48748e2aa59 @@ -674,12 +831,12 @@ trackedFiles: pristine_git_object: af07d4e941007af4213c5ec9047ef8a2fca04e5e src/mistralai/azure/client/utils/security.py: id: 1d35741ce5f1 - last_write_checksum: sha1:435dd8b180cefcd733e635b9fa45512da091d9c0 - pristine_git_object: 17996bd54b8624009802fbbdf30bcb4225b8dfed + last_write_checksum: sha1:c11eef495b6aaa249178c24c796940cc540b7a00 + pristine_git_object: 42d8d78e9981eed7507670014d99588e27ab325a src/mistralai/azure/client/utils/serializers.py: id: a1f26d73c3ad - last_write_checksum: sha1:ce1d8d7f500a9ccba0aeca5057cee9c271f4dfd7 - pristine_git_object: 14321eb479de81d0d9580ec8291e0ff91bf29e57 + last_write_checksum: sha1:61009f2e4ef6613a1a5af813fe020373dae5a492 + pristine_git_object: d2149f8b909cb96628db140ac3cddb1b1e981367 src/mistralai/azure/client/utils/unions.py: id: 9abcc9913e3f last_write_checksum: sha1:6e38049f323e0b5fb4bd0e88ab51ec447197ccb0 @@ -730,7 +887,6 @@ examples: application/json: {"pages": [{"index": 1, "markdown": "# LEVERAGING UNLABELED DATA TO PREDICT OUT-OF-DISTRIBUTION PERFORMANCE\nSaurabh Garg*
Carnegie Mellon University
sgarg2@andrew.cmu.edu
Sivaraman Balakrishnan
Carnegie Mellon University
sbalakri@andrew.cmu.edu
Zachary C. Lipton
Carnegie Mellon University
zlipton@andrew.cmu.edu\n## Behnam Neyshabur\nGoogle Research, Blueshift team
neyshabur@google.com\nHanie Sedghi
Google Research, Brain team
hsedghi@google.com\n#### Abstract\nReal-world machine learning deployments are characterized by mismatches between the source (training) and target (test) distributions that may cause performance drops. In this work, we investigate methods for predicting the target domain accuracy using only labeled source data and unlabeled target data. We propose Average Thresholded Confidence (ATC), a practical method that learns a threshold on the model's confidence, predicting accuracy as the fraction of unlabeled examples for which model confidence exceeds that threshold. ATC outperforms previous methods across several model architectures, types of distribution shifts (e.g., due to synthetic corruptions, dataset reproduction, or novel subpopulations), and datasets (WILDS, ImageNet, BREEDS, CIFAR, and MNIST). In our experiments, ATC estimates target performance $2-4 \\times$ more accurately than prior methods. We also explore the theoretical foundations of the problem, proving that, in general, identifying the accuracy is just as hard as identifying the optimal predictor and thus, the efficacy of any method rests upon (perhaps unstated) assumptions on the nature of the shift. Finally, analyzing our method on some toy distributions, we provide insights concerning when it works ${ }^{1}$.\n## 1 INTRODUCTION\nMachine learning models deployed in the real world typically encounter examples from previously unseen distributions. While the IID assumption enables us to evaluate models using held-out data from the source distribution (from which training data is sampled), this estimate is no longer valid in presence of a distribution shift. Moreover, under such shifts, model accuracy tends to degrade (Szegedy et al., 2014; Recht et al., 2019; Koh et al., 2021). Commonly, the only data available to the practitioner are a labeled training set (source) and unlabeled deployment-time data which makes the problem more difficult. In this setting, detecting shifts in the distribution of covariates is known to be possible (but difficult) in theory (Ramdas et al., 2015), and in practice (Rabanser et al., 2018). However, producing an optimal predictor using only labeled source and unlabeled target data is well-known to be impossible absent further assumptions (Ben-David et al., 2010; Lipton et al., 2018).\nTwo vital questions that remain are: (i) the precise conditions under which we can estimate a classifier's target-domain accuracy; and (ii) which methods are most practically useful. To begin, the straightforward way to assess the performance of a model under distribution shift would be to collect labeled (target domain) examples and then to evaluate the model on that data. However, collecting fresh labeled data from the target distribution is prohibitively expensive and time-consuming, especially if the target distribution is non-stationary. Hence, instead of using labeled data, we aim to use unlabeled data from the target distribution, that is comparatively abundant, to predict model performance. Note that in this work, our focus is not to improve performance on the target but, rather, to estimate the accuracy on the target for a given classifier.\n[^0]: Work done in part while Saurabh Garg was interning at Google ${ }^{1}$ Code is available at [https://github.com/saurabhgarg1996/ATC_code](https://github.com/saurabhgarg1996/ATC_code).\n", "images": [], "dimensions": {"dpi": 200, "height": 2200, "width": 1700}}, {"index": 2, "markdown": "![img-0.jpeg](img-0.jpeg)\nFigure 1: Illustration of our proposed method ATC. Left: using source domain validation data, we identify a threshold on a score (e.g. negative entropy) computed on model confidence such that fraction of examples above the threshold matches the validation set accuracy. ATC estimates accuracy on unlabeled target data as the fraction of examples with the score above the threshold. Interestingly, this threshold yields accurate estimates on a wide set of target distributions resulting from natural and synthetic shifts. Right: Efficacy of ATC over previously proposed approaches on our testbed with a post-hoc calibrated model. To obtain errors on the same scale, we rescale all errors with Average Confidence (AC) error. Lower estimation error is better. See Table 1 for exact numbers and comparison on various types of distribution shift. See Sec. 5 for details on our testbed.\nRecently, numerous methods have been proposed for this purpose (Deng & Zheng, 2021; Chen et al., 2021b; Jiang et al., 2021; Deng et al., 2021; Guillory et al., 2021). These methods either require calibration on the target domain to yield consistent estimates (Jiang et al., 2021; Guillory et al., 2021) or additional labeled data from several target domains to learn a linear regression function on a distributional distance that then predicts model performance (Deng et al., 2021; Deng & Zheng, 2021; Guillory et al., 2021). However, methods that require calibration on the target domain typically yield poor estimates since deep models trained and calibrated on source data are not, in general, calibrated on a (previously unseen) target domain (Ovadia et al., 2019). Besides, methods that leverage labeled data from target domains rely on the fact that unseen target domains exhibit strong linear correlation with seen target domains on the underlying distance measure and, hence, can be rendered ineffective when such target domains with labeled data are unavailable (in Sec. 5.1 we demonstrate such a failure on a real-world distribution shift problem). Therefore, throughout the paper, we assume access to labeled source data and only unlabeled data from target domain(s).\nIn this work, we first show that absent assumptions on the source classifier or the nature of the shift, no method of estimating accuracy will work generally (even in non-contrived settings). To estimate accuracy on target domain perfectly, we highlight that even given perfect knowledge of the labeled source distribution (i.e., $p_{s}(x, y)$ ) and unlabeled target distribution (i.e., $p_{t}(x)$ ), we need restrictions on the nature of the shift such that we can uniquely identify the target conditional $p_{t}(y \\mid x)$. Thus, in general, identifying the accuracy of the classifier is as hard as identifying the optimal predictor.\nSecond, motivated by the superiority of methods that use maximum softmax probability (or logit) of a model for Out-Of-Distribution (OOD) detection (Hendrycks & Gimpel, 2016; Hendrycks et al., 2019), we propose a simple method that leverages softmax probability to predict model performance. Our method, Average Thresholded Confidence (ATC), learns a threshold on a score (e.g., maximum confidence or negative entropy) of model confidence on validation source data and predicts target domain accuracy as the fraction of unlabeled target points that receive a score above that threshold. ATC selects a threshold on validation source data such that the fraction of source examples that receive the score above the threshold match the accuracy of those examples. Our primary contribution in ATC is the proposal of obtaining the threshold and observing its efficacy on (practical) accuracy estimation. Importantly, our work takes a step forward in positively answering the question raised in Deng & Zheng (2021); Deng et al. (2021) about a practical strategy to select a threshold that enables accuracy prediction with thresholded model confidence.\n", "images": [{"id": "img-0.jpeg", "top_left_x": 292, "top_left_y": 217, "bottom_right_x": 1405, "bottom_right_y": 649, "image_base64": ""}], "dimensions": {"dpi": 200, "height": 2200, "width": 1700}}, {"index": 3, "markdown": "", "images": [], "dimensions": {"dpi": 539192, "height": 944919, "width": 247256}}, {"index": 27, "markdown": "![img-8.jpeg](img-8.jpeg)\nFigure 9: Scatter plot of predicted accuracy versus (true) OOD accuracy for vision datasets except MNIST with a ResNet50 model. Results reported by aggregating MAE numbers over 4 different seeds.\n", "images": [{"id": "img-8.jpeg", "top_left_x": 290, "top_left_y": 226, "bottom_right_x": 1405, "bottom_right_y": 1834, "image_base64": ""}], "dimensions": {"dpi": 200, "height": 2200, "width": 1700}}, {"index": 28, "markdown": "| Dataset | Shift | IM | | AC | | DOC | | GDE | ATC-MC (Ours) | | ATC-NE (Ours) | | | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | | | | Pre T | Post T | Pre T | Post T | Pre T | Post T | Post T | Pre T | Post T | Pre T | Post T | | CIFAR10 | Natural | 6.60 | 5.74 | 9.88 | 6.89 | 7.25 | 6.07 | 4.77 | 3.21 | 3.02 | 2.99 | 2.85 | | | | (0.35) | (0.30) | (0.16) | (0.13) | (0.15) | (0.16) | (0.13) | (0.49) | (0.40) | (0.37) | (0.29) | | | Synthetic | 12.33 | 10.20 | 16.50 | 11.91 | 13.87 | 11.08 | 6.55 | 4.65 | 4.25 | 4.21 | 3.87 | | | | (0.51) | (0.48) | (0.26) | (0.17) | (0.18) | (0.17) | (0.35) | (0.55) | (0.55) | (0.55) | (0.75) | | CIFAR100 | Synthetic | 13.69 | 11.51 | 23.61 | 13.10 | 14.60 | 10.14 | 9.85 | 5.50 | 4.75 | 4.72 | 4.94 | | | | (0.55) | (0.41) | (1.16) | (0.80) | (0.77) | (0.64) | (0.57) | (0.70) | (0.73) | (0.74) | (0.74) | | ImageNet200 | Natural | 12.37 | 8.19 | 22.07 | 8.61 | 15.17 | 7.81 | 5.13 | 4.37 | 2.04 | 3.79 | 1.45 | | | | (0.25) | (0.33) | (0.08) | (0.25) | (0.11) | (0.29) | (0.08) | (0.39) | (0.24) | (0.30) | (0.27) | | | Synthetic | 19.86 | 12.94 | 32.44 | 13.35 | 25.02 | 12.38 | 5.41 | 5.93 | 3.09 | 5.00 | 2.68 | | | | (1.38) | (1.81) | (1.00) | (1.30) | (1.10) | (1.38) | (0.89) | (1.38) | (0.87) | (1.28) | (0.45) | | ImageNet | Natural | 7.77 | 6.50 | 18.13 | 6.02 | 8.13 | 5.76 | 6.23 | 3.88 | 2.17 | 2.06 | 0.80 | | | | (0.27) | (0.33) | (0.23) | (0.34) | (0.27) | (0.37) | (0.41) | (0.53) | (0.62) | (0.54) | (0.44) | | | Synthetic | 13.39 | 10.12 | 24.62 | 8.51 | 13.55 | 7.90 | 6.32 | 3.34 | 2.53 | 2.61 | 4.89 | | | | (0.53) | (0.63) | (0.64) | (0.71) | (0.61) | (0.72) | (0.33) | (0.53) | (0.36) | (0.33) | (0.83) | | FMoW-WILDS | Natural | 5.53 | 4.31 | 33.53 | 12.84 | 5.94 | 4.45 | 5.74 | 3.06 | 2.70 | 3.02 | 2.72 | | | | (0.33) | (0.63) | (0.13) | (12.06) | (0.36) | (0.77) | (0.55) | (0.36) | (0.54) | (0.35) | (0.44) | | RxRx1-WILDS | Natural | 5.80 | 5.72 | 7.90 | 4.84 | 5.98 | 5.98 | 6.03 | 4.66 | 4.56 | 4.41 | 4.47 | | | | (0.17) | (0.15) | (0.24) | (0.09) | (0.15) | (0.13) | (0.08) | (0.38) | (0.38) | (0.31) | (0.26) | | Amazon-WILDS | Natural | 2.40 | 2.29 | 8.01 | 2.38 | 2.40 | 2.28 | 17.87 | 1.65 | 1.62 | 1.60 | 1.59 | | | | (0.08) | (0.09) | (0.53) | (0.17) | (0.09) | (0.09) | (0.18) | (0.06) | (0.05) | (0.14) | (0.15) | | CivilCom.-WILDS | Natural | 12.64 | 10.80 | 16.76 | 11.03 | 13.31 | 10.99 | 16.65 | | 7.14 | | | | | | (0.52) | (0.48) | (0.53) | (0.49) | (0.52) | (0.49) | (0.25) | | (0.41) | | | | MNIST | Natural | 18.48 | 15.99 | 21.17 | 14.81 | 20.19 | 14.56 | 24.42 | 5.02 | 2.40 | 3.14 | 3.50 | | | | (0.45) | (1.53) | (0.24) | (3.89) | (0.23) | (3.47) | (0.41) | (0.44) | (1.83) | (0.49) | (0.17) | | ENTITY-13 | Same | 16.23 | 11.14 | 24.97 | 10.88 | 19.08 | 10.47 | 10.71 | 5.39 | 3.88 | 4.58 | 4.19 | | | | (0.77) | (0.65) | (0.70) | (0.77) | (0.65) | (0.72) | (0.74) | (0.92) | (0.61) | (0.85) | (0.16) | | | Novel | 28.53 | 22.02 | 38.33 | 21.64 | 32.43 | 21.22 | 20.61 | 13.58 | 10.28 | 12.25 | 6.63 | | | | (0.82) | (0.68) | (0.75) | (0.86) | (0.69) | (0.80) | (0.60) | (1.15) | (1.34) | (1.21) | (0.93) | | ENTITY-30 | Same | 18.59 | 14.46 | 28.82 | 14.30 | 21.63 | 13.46 | 12.92 | 9.12 | 7.75 | 8.15 | 7.64 | | | | (0.51) | (0.52) | (0.43) | (0.71) | (0.37) | (0.59) | (0.14) | (0.62) | (0.72) | (0.68) | (0.88) | | | Novel | 32.34 | 26.85 | 44.02 | 26.27 | 36.82 | 25.42 | 23.16 | 17.75 | 14.30 | 15.60 | 10.57 | | | | (0.60) | (0.58) | (0.56) | (0.79) | (0.47) | (0.68) | (0.12) | (0.76) | (0.85) | (0.86) | (0.86) | | NONLIVING-26 | Same | 18.66 | 17.17 | 26.39 | 16.14 | 19.86 | 15.58 | 16.63 | 10.87 | 10.24 | 10.07 | 10.26 | | | | (0.76) | (0.74) | (0.82) | (0.81) | (0.67) | (0.76) | (0.45) | (0.98) | (0.83) | (0.92) | (1.18) | | | Novel | 33.43 | 31.53 | 41.66 | 29.87 | 35.13 | 29.31 | 29.56 | 21.70 | 20.12 | 19.08 | 18.26 | | | | (0.67) | (0.65) | (0.67) | (0.71) | (0.54) | (0.64) | (0.21) | (0.86) | (0.75) | (0.82) | (1.12) | | LIVING-17 | Same | 12.63 | 11.05 | 18.32 | 10.46 | 14.43 | 10.14 | 9.87 | 4.57 | 3.95 | 3.81 | 4.21 | | | | (1.25) | (1.20) | (1.01) | (1.12) | (1.11) | (1.16) | (0.61) | (0.71) | (0.48) | (0.22) | (0.53) | | | Novel | 29.03 | 26.96 | 35.67 | 26.11 | 31.73 | 25.73 | 23.53 | 16.15 | 14.49 | 12.97 | 11.39 | | | | (1.44) | (1.38) | (1.09) | (1.27) | (1.19) | (1.35) | (0.52) | (1.36) | (1.46) | (1.52) | (1.72) |\nTable 3: Mean Absolute estimation Error (MAE) results for different datasets in our setup grouped by the nature of shift. 'Same' refers to same subpopulation shifts and 'Novel' refers novel subpopulation shifts. We include details about the target sets considered in each shift in Table 2. Post T denotes use of TS calibration on source. For language datasets, we use DistilBERT-base-uncased, for vision dataset we report results with DenseNet model with the exception of MNIST where we use FCN. Across all datasets, we observe that ATC achieves superior performance (lower MAE is better). For GDE post T and pre T estimates match since TS doesn't alter the argmax prediction. Results reported by aggregating MAE numbers over 4 different seeds. Values in parenthesis (i.e., $(\\cdot)$ ) denote standard deviation values.\n", "images": [], "dimensions": {"dpi": 200, "height": 2200, "width": 1700}}, {"index": 29, "markdown": "| Dataset | Shift | IM | | AC | | DOC | | GDE | ATC-MC (Ours) | | ATC-NE (Ours) | | | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | | | | Pre T | Post T | Pre T | Post T | Pre T | Post T | Post T | Pre T | Post T | Pre T | Post T | | CIFAR10 | Natural | 7.14 | 6.20 | 10.25 | 7.06 | 7.68 | 6.35 | 5.74 | 4.02 | 3.85 | 3.76 | 3.38 | | | | (0.14) | (0.11) | (0.31) | (0.33) | (0.28) | (0.27) | (0.25) | (0.38) | (0.30) | (0.33) | (0.32) | | | Synthetic | 12.62 | 10.75 | 16.50 | 11.91 | 13.93 | 11.20 | 7.97 | 5.66 | 5.03 | 4.87 | 3.63 | | | | (0.76) | (0.71) | (0.28) | (0.24) | (0.29) | (0.28) | (0.13) | (0.64) | (0.71) | (0.71) | (0.62) | | CIFAR100 | Synthetic | 12.77 | 12.34 | 16.89 | 12.73 | 11.18 | 9.63 | 12.00 | 5.61 | 5.55 | 5.65 | 5.76 | | | | (0.43) | (0.68) | (0.20) | (2.59) | (0.35) | (1.25) | (0.48) | (0.51) | (0.55) | (0.35) | (0.27) | | ImageNet200 | Natural | 12.63 | 7.99 | 23.08 | 7.22 | 15.40 | 6.33 | 5.00 | 4.60 | 1.80 | 4.06 | 1.38 | | | | (0.59) | (0.47) | (0.31) | (0.22) | (0.42) | (0.24) | (0.36) | (0.63) | (0.17) | (0.69) | (0.29) | | | Synthetic | 20.17 | 11.74 | 33.69 | 9.51 | 25.49 | 8.61 | 4.19 | 5.37 | 2.78 | 4.53 | 3.58 | | | | (0.74) | (0.80) | (0.73) | (0.51) | (0.66) | (0.50) | (0.14) | (0.88) | (0.23) | (0.79) | (0.33) | | ImageNet | Natural | 8.09 | 6.42 | 21.66 | 5.91 | 8.53 | 5.21 | 5.90 | 3.93 | 1.89 | 2.45 | 0.73 | | | | (0.25) | (0.28) | (0.38) | (0.22) | (0.26) | (0.25) | (0.44) | (0.26) | (0.21) | (0.16) | (0.10) | | | Synthetic | 13.93 | 9.90 | 28.05 | 7.56 | 13.82 | 6.19 | 6.70 | 3.33 | 2.55 | 2.12 | 5.06 | | | | (0.14) | (0.23) | (0.39) | (0.13) | (0.31) | (0.07) | (0.52) | (0.25) | (0.25) | (0.31) | (0.27) | | FMoW-WILDS | Natural | 5.15 | 3.55 | 34.64 | 5.03 | 5.58 | 3.46 | 5.08 | 2.59 | 2.33 | 2.52 | 2.22 | | | | (0.19) | (0.41) | (0.22) | (0.29) | (0.17) | (0.37) | (0.46) | (0.32) | (0.28) | (0.25) | (0.30) | | RxRx1-WILDS | Natural | 6.17 | 6.11 | 21.05 | 5.21 | 6.54 | 6.27 | 6.82 | 5.30 | 5.20 | 5.19 | 5.63 | | | | (0.20) | (0.24) | (0.31) | (0.18) | (0.21) | (0.20) | (0.31) | (0.30) | (0.44) | (0.43) | (0.55) | | Entity-13 | Same | 18.32 | 14.38 | 27.79 | 13.56 | 20.50 | 13.22 | 16.09 | 9.35 | 7.50 | 7.80 | 6.94 | | | | (0.29) | (0.53) | (1.18) | (0.58) | (0.47) | (0.58) | (0.84) | (0.79) | (0.65) | (0.62) | (0.71) | | | Novel | 28.82 | 24.03 | 38.97 | 22.96 | 31.66 | 22.61 | 25.26 | 17.11 | 13.96 | 14.75 | 9.94 | | | | (0.30) | (0.55) | (1.32) | (0.59) | (0.54) | (0.58) | (1.08) | (0.93) | (0.64) | (0.78) | | | Entity-30 | Same | 16.91 | 14.61 | 26.84 | 14.37 | 18.60 | 13.11 | 13.74 | 8.54 | 7.94 | 7.77 | 8.04 | | | | (1.33) | (1.11) | (2.15) | (1.34) | (1.69) | (1.30) | (1.07) | (1.47) | (1.38) | (1.44) | (1.51) | | | Novel | 28.66 | 25.83 | 39.21 | 25.03 | 30.95 | 23.73 | 23.15 | 15.57 | 13.24 | 12.44 | 11.05 | | | | (1.16) | (0.88) | (2.03) | (1.11) | (1.64) | (1.11) | (0.51) | (1.44) | (1.15) | (1.26) | (1.13) | | NonLIVING-26 | Same | 17.43 | 15.95 | 27.70 | 15.40 | 18.06 | 14.58 | 16.99 | 10.79 | 10.13 | 10.05 | 10.29 | | | | (0.90) | (0.86) | (0.90) | (0.69) | (1.00) | (0.78) | (1.25) | (0.62) | (0.32) | (0.46) | (0.79) | | | Novel | 29.51 | 27.75 | 40.02 | 26.77 | 30.36 | 25.93 | 27.70 | 19.64 | 17.75 | 16.90 | 15.69 | | | | (0.86) | (0.82) | (0.76) | (0.82) | (0.95) | (0.80) | (1.42) | (0.68) | (0.53) | (0.60) | (0.83) | | LIVING-17 | Same | 14.28 | 12.21 | 23.46 | 11.16 | 15.22 | 10.78 | 10.49 | 4.92 | 4.23 | 4.19 | 4.73 | | | | (0.96) | (0.93) | (1.16) | (0.90) | (0.96) | (0.99) | (0.97) | (0.57) | (0.42) | (0.35) | (0.24) | | | Novel | 28.91 | 26.35 | 38.62 | 24.91 | 30.32 | 24.52 | 22.49 | 15.42 | 13.02 | 12.29 | 10.34 | | | | (0.66) | (0.73) | (1.01) | (0.61) | (0.59) | (0.74) | (0.85) | (0.59) | (0.53) | (0.73) | (0.62) |\nTable 4: Mean Absolute estimation Error (MAE) results for different datasets in our setup grouped by the nature of shift for ResNet model. 'Same' refers to same subpopulation shifts and 'Novel' refers novel subpopulation shifts. We include details about the target sets considered in each shift in Table 2. Post T denotes use of TS calibration on source. Across all datasets, we observe that ATC achieves superior performance (lower MAE is better). For GDE post T and pre T estimates match since TS doesn't alter the argmax prediction. Results reported by aggregating MAE numbers over 4 different seeds. Values in parenthesis (i.e., $(\\cdot)$ ) denote standard deviation values.\n", "images": [], "dimensions": {"dpi": 200, "height": 2200, "width": 1700}}], "model": "mistral-ocr-2503-completion", "usage_info": {"pages_processed": 29, "doc_size_bytes": null}} examplesVersion: 1.0.2 generatedTests: {} -releaseNotes: "## Python SDK Changes:\n* `mistral_azure.chat.stream()`: \n * `request.messages[].union(system).content.union(Array)[].union(thinking).thinking[].union(ToolReferenceChunk)` **Added**\n * `error.detail[]` **Changed**\n* `mistral_azure.chat.complete()`: \n * `request.messages[].union(system).content.union(Array)[].union(thinking).thinking[].union(ToolReferenceChunk)` **Added**\n * `error.detail[]` **Changed**\n* `mistral_azure.ocr.process()`: `error.detail[]` **Changed**\n" generatedFiles: - .gitattributes - .vscode/settings.json diff --git a/packages/azure/.speakeasy/gen.yaml b/packages/azure/.speakeasy/gen.yaml index 58016b88..f59f7edc 100644 --- a/packages/azure/.speakeasy/gen.yaml +++ b/packages/azure/.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/azure/RELEASES.md b/packages/azure/RELEASES.md index 6844bc64..c20bf38c 100644 --- a/packages/azure/RELEASES.md +++ b/packages/azure/RELEASES.md @@ -38,4 +38,14 @@ Based on: ### Generated - [python v2.0.0] packages/azure ### Releases -- [PyPI v2.0.0] https://pypi.org/project/mistralai-azure/2.0.0 - packages/azure \ No newline at end of file +- [PyPI v2.0.0] https://pypi.org/project/mistralai-azure/2.0.0 - packages/azure + +## 2026-05-22 14:13:06 +### 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/azure +### Releases +- [PyPI v2.1.0] https://pypi.org/project/mistralai-azure/2.1.0 - packages/azure \ No newline at end of file diff --git a/packages/azure/docs/models/apikeyauth.md b/packages/azure/docs/models/apikeyauth.md new file mode 100644 index 00000000..1fbff10e --- /dev/null +++ b/packages/azure/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/azure/docs/models/authorization.md b/packages/azure/docs/models/authorization.md new file mode 100644 index 00000000..11ea5c6a --- /dev/null +++ b/packages/azure/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/azure/docs/models/builtinconnectors.md b/packages/azure/docs/models/builtinconnectors.md index f96f5044..150f89b0 100644 --- a/packages/azure/docs/models/builtinconnectors.md +++ b/packages/azure/docs/models/builtinconnectors.md @@ -1,12 +1,17 @@ # BuiltInConnectors +## Example Usage + +```python +from mistralai.azure.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/azure/docs/models/chatcompletionchoice.md b/packages/azure/docs/models/chatcompletionchoice.md index deaa0ea0..79d24a33 100644 --- a/packages/azure/docs/models/chatcompletionchoice.md +++ b/packages/azure/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/azure/docs/models/chatcompletionchoicefinishreason.md b/packages/azure/docs/models/chatcompletionchoicefinishreason.md index b2f15ecb..1ca6a646 100644 --- a/packages/azure/docs/models/chatcompletionchoicefinishreason.md +++ b/packages/azure/docs/models/chatcompletionchoicefinishreason.md @@ -1,12 +1,21 @@ # ChatCompletionChoiceFinishReason +## Example Usage + +```python +from mistralai.azure.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/azure/docs/models/chatcompletionrequest.md b/packages/azure/docs/models/chatcompletionrequest.md index f8715cd0..ba44a066 100644 --- a/packages/azure/docs/models/chatcompletionrequest.md +++ b/packages/azure/docs/models/chatcompletionrequest.md @@ -7,20 +7,22 @@ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | *Optional[str]* | :heavy_minus_sign: | The ID of the model to use for this request. | azureai | | `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. | | +| `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 | | | `safe_prompt` | *Optional[bool]* | :heavy_minus_sign: | Whether to inject a safety prompt before all conversations. | | \ No newline at end of file diff --git a/packages/azure/docs/models/chatcompletionrequesttool.md b/packages/azure/docs/models/chatcompletionrequesttool.md new file mode 100644 index 00000000..572d12ca --- /dev/null +++ b/packages/azure/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/azure/docs/models/chatcompletionstreamrequest.md b/packages/azure/docs/models/chatcompletionstreamrequest.md index cc82a8c7..c3d90e13 100644 --- a/packages/azure/docs/models/chatcompletionstreamrequest.md +++ b/packages/azure/docs/models/chatcompletionstreamrequest.md @@ -7,20 +7,22 @@ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | *Optional[str]* | :heavy_minus_sign: | The ID of the model to use for this request. | azureai | | `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. | | +| `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 | | | `safe_prompt` | *Optional[bool]* | :heavy_minus_sign: | Whether to inject a safety prompt before all conversations. | | \ No newline at end of file diff --git a/packages/azure/docs/models/chatcompletionstreamrequesttool.md b/packages/azure/docs/models/chatcompletionstreamrequesttool.md new file mode 100644 index 00000000..48998fcb --- /dev/null +++ b/packages/azure/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/azure/docs/models/codeinterpretertool.md b/packages/azure/docs/models/codeinterpretertool.md new file mode 100644 index 00000000..6302fc62 --- /dev/null +++ b/packages/azure/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/azure/docs/models/completionresponsestreamchoicefinishreason.md b/packages/azure/docs/models/completionresponsestreamchoicefinishreason.md index 0fece473..f1bd6ad8 100644 --- a/packages/azure/docs/models/completionresponsestreamchoicefinishreason.md +++ b/packages/azure/docs/models/completionresponsestreamchoicefinishreason.md @@ -1,11 +1,20 @@ # CompletionResponseStreamChoiceFinishReason +## Example Usage + +```python +from mistralai.azure.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/azure/docs/models/confidencescoresgranularity.md b/packages/azure/docs/models/confidencescoresgranularity.md new file mode 100644 index 00000000..32161eee --- /dev/null +++ b/packages/azure/docs/models/confidencescoresgranularity.md @@ -0,0 +1,14 @@ +# ConfidenceScoresGranularity + +## Example Usage + +```python +from mistralai.azure.client.models import ConfidenceScoresGranularity +value: ConfidenceScoresGranularity = "word" +``` + + +## Values + +- `"word"` +- `"page"` diff --git a/packages/azure/docs/models/customconnector.md b/packages/azure/docs/models/customconnector.md new file mode 100644 index 00000000..0a0b6921 --- /dev/null +++ b/packages/azure/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/azure/docs/models/deltamessage.md b/packages/azure/docs/models/deltamessage.md index e0ee575f..c2395e1b 100644 --- a/packages/azure/docs/models/deltamessage.md +++ b/packages/azure/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/azure/docs/models/documentlibrarytool.md b/packages/azure/docs/models/documentlibrarytool.md new file mode 100644 index 00000000..95c3fa52 --- /dev/null +++ b/packages/azure/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/azure/docs/models/format_.md b/packages/azure/docs/models/format_.md index 97d286a4..3311b410 100644 --- a/packages/azure/docs/models/format_.md +++ b/packages/azure/docs/models/format_.md @@ -2,10 +2,19 @@ Format of the table +## Example Usage + +```python +from mistralai.azure.client.models import Format + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Format = "markdown" +``` + ## Values -| Name | Value | -| ---------- | ---------- | -| `MARKDOWN` | markdown | -| `HTML` | html | \ No newline at end of file +This is an open enum. Unrecognized values will not fail type checks. + +- `"markdown"` +- `"html"` diff --git a/packages/azure/docs/models/guardrailconfig.md b/packages/azure/docs/models/guardrailconfig.md new file mode 100644 index 00000000..1276462c --- /dev/null +++ b/packages/azure/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/azure/docs/models/imagedetail.md b/packages/azure/docs/models/imagedetail.md index 1e5ba3fd..d13adbf6 100644 --- a/packages/azure/docs/models/imagedetail.md +++ b/packages/azure/docs/models/imagedetail.md @@ -1,10 +1,19 @@ # ImageDetail +## Example Usage + +```python +from mistralai.azure.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/azure/docs/models/imagegenerationtool.md b/packages/azure/docs/models/imagegenerationtool.md new file mode 100644 index 00000000..b476b6f2 --- /dev/null +++ b/packages/azure/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/azure/docs/models/imageurlchunk.md b/packages/azure/docs/models/imageurlchunk.md index db0c53d2..6d238e25 100644 --- a/packages/azure/docs/models/imageurlchunk.md +++ b/packages/azure/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/azure/docs/models/mistralpromptmode.md b/packages/azure/docs/models/mistralpromptmode.md index c3409d03..3a8f7841 100644 --- a/packages/azure/docs/models/mistralpromptmode.md +++ b/packages/azure/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.azure.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/azure/docs/models/moderationllmaction.md b/packages/azure/docs/models/moderationllmaction.md new file mode 100644 index 00000000..526b7a13 --- /dev/null +++ b/packages/azure/docs/models/moderationllmaction.md @@ -0,0 +1,14 @@ +# ModerationLLMAction + +## Example Usage + +```python +from mistralai.azure.client.models import ModerationLLMAction +value: ModerationLLMAction = "none" +``` + + +## Values + +- `"none"` +- `"block"` diff --git a/packages/azure/docs/models/moderationllmv1categorythresholds.md b/packages/azure/docs/models/moderationllmv1categorythresholds.md new file mode 100644 index 00000000..90ae213f --- /dev/null +++ b/packages/azure/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/azure/docs/models/moderationllmv1config.md b/packages/azure/docs/models/moderationllmv1config.md new file mode 100644 index 00000000..bdb5812b --- /dev/null +++ b/packages/azure/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/azure/docs/models/moderationllmv2categorythresholds.md b/packages/azure/docs/models/moderationllmv2categorythresholds.md new file mode 100644 index 00000000..e95b81b0 --- /dev/null +++ b/packages/azure/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/azure/docs/models/moderationllmv2config.md b/packages/azure/docs/models/moderationllmv2config.md new file mode 100644 index 00000000..e928506c --- /dev/null +++ b/packages/azure/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/azure/docs/models/oauth2tokenauth.md b/packages/azure/docs/models/oauth2tokenauth.md new file mode 100644 index 00000000..89f80436 --- /dev/null +++ b/packages/azure/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/azure/docs/models/ocrconfidencescore.md b/packages/azure/docs/models/ocrconfidencescore.md new file mode 100644 index 00000000..73fdcb28 --- /dev/null +++ b/packages/azure/docs/models/ocrconfidencescore.md @@ -0,0 +1,12 @@ +# OCRConfidenceScore + +Confidence score for a token or word in OCR output. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| `text` | *str* | :heavy_check_mark: | The word or text segment | +| `confidence` | *float* | :heavy_check_mark: | Confidence score (0-1) | +| `start_index` | *int* | :heavy_check_mark: | Start index of the text in the page markdown string | \ No newline at end of file diff --git a/packages/azure/docs/models/ocrpageconfidencescores.md b/packages/azure/docs/models/ocrpageconfidencescores.md new file mode 100644 index 00000000..bffb2148 --- /dev/null +++ b/packages/azure/docs/models/ocrpageconfidencescores.md @@ -0,0 +1,18 @@ +# OCRPageConfidenceScores + +Confidence scores for an OCR page at various granularities. + +Note on page-level stats: +- For 'page' granularity: average/minimum are computed from per-token exp(logprob). +- For 'word' granularity: average/minimum are computed from per-word confidence, + where each word's confidence is exp(mean(token_logprobs)) — a geometric mean + over the word's subword tokens. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `word_confidence_scores` | List[[models.OCRConfidenceScore](../models/ocrconfidencescore.md)] | :heavy_minus_sign: | Word-level confidence scores (populated only for 'word' granularity) | +| `average_page_confidence_score` | *float* | :heavy_check_mark: | Average confidence score for the page | +| `minimum_page_confidence_score` | *float* | :heavy_check_mark: | Minimum confidence score for the page | \ No newline at end of file diff --git a/packages/azure/docs/models/ocrpageobject.md b/packages/azure/docs/models/ocrpageobject.md index 02473d44..0fc55052 100644 --- a/packages/azure/docs/models/ocrpageobject.md +++ b/packages/azure/docs/models/ocrpageobject.md @@ -3,13 +3,14 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `index` | *int* | :heavy_check_mark: | The page index in a pdf document starting from 0 | -| `markdown` | *str* | :heavy_check_mark: | The markdown string response of the page | -| `images` | List[[models.OCRImageObject](../models/ocrimageobject.md)] | :heavy_check_mark: | List of all extracted images in the page | -| `tables` | List[[models.OCRTableObject](../models/ocrtableobject.md)] | :heavy_minus_sign: | List of all extracted tables in the page | -| `hyperlinks` | List[*str*] | :heavy_minus_sign: | List of all hyperlinks in the page | -| `header` | *OptionalNullable[str]* | :heavy_minus_sign: | Header of the page | -| `footer` | *OptionalNullable[str]* | :heavy_minus_sign: | Footer of the page | -| `dimensions` | [Nullable[models.OCRPageDimensions]](../models/ocrpagedimensions.md) | :heavy_check_mark: | The dimensions of the PDF Page's screenshot image | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `index` | *int* | :heavy_check_mark: | The page index in a pdf document starting from 0 | +| `markdown` | *str* | :heavy_check_mark: | The markdown string response of the page | +| `images` | List[[models.OCRImageObject](../models/ocrimageobject.md)] | :heavy_check_mark: | List of all extracted images in the page | +| `tables` | List[[models.OCRTableObject](../models/ocrtableobject.md)] | :heavy_minus_sign: | List of all extracted tables in the page | +| `hyperlinks` | List[*str*] | :heavy_minus_sign: | List of all hyperlinks in the page | +| `header` | *OptionalNullable[str]* | :heavy_minus_sign: | Header of the page | +| `footer` | *OptionalNullable[str]* | :heavy_minus_sign: | Footer of the page | +| `dimensions` | [Nullable[models.OCRPageDimensions]](../models/ocrpagedimensions.md) | :heavy_check_mark: | The dimensions of the PDF Page's screenshot image | +| `confidence_scores` | [OptionalNullable[models.OCRPageConfidenceScores]](../models/ocrpageconfidencescores.md) | :heavy_minus_sign: | Confidence scores for the OCR page (populated when confidence_scores_granularity is set) | \ No newline at end of file diff --git a/packages/azure/docs/models/ocrrequest.md b/packages/azure/docs/models/ocrrequest.md index 2d26c19f..2066b903 100644 --- a/packages/azure/docs/models/ocrrequest.md +++ b/packages/azure/docs/models/ocrrequest.md @@ -6,9 +6,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | *Nullable[str]* | :heavy_check_mark: | N/A | | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | | | `document` | [models.Document](../models/document.md) | :heavy_check_mark: | Document to run OCR on | | -| `pages` | List[*int*] | :heavy_minus_sign: | Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0 | | +| `pages` | [OptionalNullable[models.Pages]](../models/pages.md) | :heavy_minus_sign: | Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0. | | | `include_image_base64` | *OptionalNullable[bool]* | :heavy_minus_sign: | Include image URLs in response | | | `image_limit` | *OptionalNullable[int]* | :heavy_minus_sign: | Max images to extract | | | `image_min_size` | *OptionalNullable[int]* | :heavy_minus_sign: | Minimum height and width of image to extract | | @@ -17,4 +16,5 @@ | `document_annotation_prompt` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional prompt to guide the model in extracting structured output from the entire document. A document_annotation_format must be provided. | | | `table_format` | [OptionalNullable[models.TableFormat]](../models/tableformat.md) | :heavy_minus_sign: | N/A | | | `extract_header` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `extract_footer` | *Optional[bool]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `extract_footer` | *Optional[bool]* | :heavy_minus_sign: | N/A | | +| `confidence_scores_granularity` | [OptionalNullable[models.ConfidenceScoresGranularity]](../models/confidencescoresgranularity.md) | :heavy_minus_sign: | Granularity for confidence scores: 'word' (per-word scores) or 'page' (aggregate only). Defaults to None (no confidence scores) to keep response payload small. | | \ No newline at end of file diff --git a/packages/azure/docs/models/ocrtableobject.md b/packages/azure/docs/models/ocrtableobject.md index 4e27697c..2da8f610 100644 --- a/packages/azure/docs/models/ocrtableobject.md +++ b/packages/azure/docs/models/ocrtableobject.md @@ -3,8 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `id` | *str* | :heavy_check_mark: | Table ID for extracted table in a page | -| `content` | *str* | :heavy_check_mark: | Content of the table in the given format | -| `format_` | [models.Format](../models/format_.md) | :heavy_check_mark: | Format of the table | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Table ID for extracted table in a page | +| `content` | *str* | :heavy_check_mark: | Content of the table in the given format | +| `format_` | [models.Format](../models/format_.md) | :heavy_check_mark: | Format of the table | +| `word_confidence_scores` | List[[models.OCRConfidenceScore](../models/ocrconfidencescore.md)] | :heavy_minus_sign: | Per-word confidence scores for the table content. Returned when confidence_scores_granularity is set to 'word'. | \ No newline at end of file diff --git a/packages/azure/docs/models/pages.md b/packages/azure/docs/models/pages.md new file mode 100644 index 00000000..a3631692 --- /dev/null +++ b/packages/azure/docs/models/pages.md @@ -0,0 +1,19 @@ +# Pages + +Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[int]` + +```python +value: List[int] = /* values here */ +``` + diff --git a/packages/azure/docs/models/reasoningeffort.md b/packages/azure/docs/models/reasoningeffort.md new file mode 100644 index 00000000..f39e92ac --- /dev/null +++ b/packages/azure/docs/models/reasoningeffort.md @@ -0,0 +1,14 @@ +# ReasoningEffort + +## Example Usage + +```python +from mistralai.azure.client.models import ReasoningEffort +value: ReasoningEffort = "none" +``` + + +## Values + +- `"none"` +- `"high"` diff --git a/packages/azure/docs/models/referencechunk.md b/packages/azure/docs/models/referencechunk.md index d847e248..0186d3c3 100644 --- a/packages/azure/docs/models/referencechunk.md +++ b/packages/azure/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/azure/docs/models/referenceid.md b/packages/azure/docs/models/referenceid.md new file mode 100644 index 00000000..1d29397f --- /dev/null +++ b/packages/azure/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/azure/docs/models/responseformats.md b/packages/azure/docs/models/responseformats.md index 2f5f1e55..73c02b77 100644 --- a/packages/azure/docs/models/responseformats.md +++ b/packages/azure/docs/models/responseformats.md @@ -1,10 +1,15 @@ # ResponseFormats +## Example Usage + +```python +from mistralai.azure.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/azure/docs/models/tableformat.md b/packages/azure/docs/models/tableformat.md index 54f029b8..14b06acb 100644 --- a/packages/azure/docs/models/tableformat.md +++ b/packages/azure/docs/models/tableformat.md @@ -1,9 +1,14 @@ # TableFormat +## Example Usage + +```python +from mistralai.azure.client.models import TableFormat +value: TableFormat = "markdown" +``` + ## Values -| Name | Value | -| ---------- | ---------- | -| `MARKDOWN` | markdown | -| `HTML` | html | \ No newline at end of file +- `"markdown"` +- `"html"` diff --git a/packages/azure/docs/models/thinkchunk.md b/packages/azure/docs/models/thinkchunk.md index b07f598e..d825497e 100644 --- a/packages/azure/docs/models/thinkchunk.md +++ b/packages/azure/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/azure/docs/models/tool.md b/packages/azure/docs/models/tool.md index fb661f72..85888d01 100644 --- a/packages/azure/docs/models/tool.md +++ b/packages/azure/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/azure/docs/models/toolcall.md b/packages/azure/docs/models/toolcall.md index 3819236b..9d236e8b 100644 --- a/packages/azure/docs/models/toolcall.md +++ b/packages/azure/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/azure/docs/models/toolchoice.md b/packages/azure/docs/models/toolchoice.md index 373046bb..a457f96f 100644 --- a/packages/azure/docs/models/toolchoice.md +++ b/packages/azure/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/azure/docs/models/toolchoiceenum.md b/packages/azure/docs/models/toolchoiceenum.md index 0be3d6c5..60809126 100644 --- a/packages/azure/docs/models/toolchoiceenum.md +++ b/packages/azure/docs/models/toolchoiceenum.md @@ -1,11 +1,16 @@ # ToolChoiceEnum +## Example Usage + +```python +from mistralai.azure.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/azure/docs/models/toolconfiguration.md b/packages/azure/docs/models/toolconfiguration.md new file mode 100644 index 00000000..89286a17 --- /dev/null +++ b/packages/azure/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/azure/docs/models/toolreferencechunk.md b/packages/azure/docs/models/toolreferencechunk.md index 9fc10399..49ea4ca7 100644 --- a/packages/azure/docs/models/toolreferencechunk.md +++ b/packages/azure/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/azure/docs/models/toolunion.md b/packages/azure/docs/models/toolreferencechunktool.md similarity index 87% rename from packages/azure/docs/models/toolunion.md rename to packages/azure/docs/models/toolreferencechunktool.md index 2dcb3dee..999f7c34 100644 --- a/packages/azure/docs/models/toolunion.md +++ b/packages/azure/docs/models/toolreferencechunktool.md @@ -1,4 +1,4 @@ -# ToolUnion +# ToolReferenceChunkTool ## Supported Types diff --git a/packages/azure/docs/models/tooltypes.md b/packages/azure/docs/models/tooltypes.md deleted file mode 100644 index 84e49253..00000000 --- a/packages/azure/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/azure/docs/models/websearchpremiumtool.md b/packages/azure/docs/models/websearchpremiumtool.md new file mode 100644 index 00000000..78b736cd --- /dev/null +++ b/packages/azure/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/azure/docs/models/websearchtool.md b/packages/azure/docs/models/websearchtool.md new file mode 100644 index 00000000..4ca7333c --- /dev/null +++ b/packages/azure/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/azure/pyproject.toml b/packages/azure/pyproject.toml index 9b93e71a..1e2424fe 100644 --- a/packages/azure/pyproject.toml +++ b/packages/azure/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mistralai-azure" -version = "2.0.0" +version = "2.1.0" description = "Python Client SDK for the Mistral AI API in Azure." authors = [{ name = "Mistral" }] requires-python = ">=3.10" diff --git a/packages/azure/src/mistralai/azure/client/_version.py b/packages/azure/src/mistralai/azure/client/_version.py index 8923c29d..4641c832 100644 --- a/packages/azure/src/mistralai/azure/client/_version.py +++ b/packages/azure/src/mistralai/azure/client/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "mistralai-azure" -__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-azure" +__gen_version__: str = "2.884.13" +__user_agent__: str = "speakeasy-sdk/python 2.1.0 2.884.13 1.0.0 mistralai-azure" try: if __package__ is not None: diff --git a/packages/azure/src/mistralai/azure/client/basesdk.py b/packages/azure/src/mistralai/azure/client/basesdk.py index 0d4d9a44..e08ce351 100644 --- a/packages/azure/src/mistralai/azure/client/basesdk.py +++ b/packages/azure/src/mistralai/azure/client/basesdk.py @@ -7,6 +7,7 @@ AfterErrorContext, AfterSuccessContext, BeforeRequestContext, + HookContext, ) from mistralai.azure.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/azure/src/mistralai/azure/client/chat.py b/packages/azure/src/mistralai/azure/client/chat.py index 1051f952..e3915c74 100644 --- a/packages/azure/src/mistralai/azure/client/chat.py +++ b/packages/azure/src/mistralai/azure/client/chat.py @@ -21,22 +21,25 @@ def stream( ], model: Optional[str] = "azureai", 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, safe_prompt: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -79,7 +86,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 safe_prompt: Whether to inject a safety prompt before all conversations. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -91,6 +100,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: @@ -111,7 +123,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] ), @@ -122,13 +136,17 @@ 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]] + ), safe_prompt=safe_prompt, ) req = self._build_request( method="POST", - path="/chat/completions#stream", + path="/models/chat/completions#stream", base_url=base_url, url_variables=url_variables, request=request, @@ -163,7 +181,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, ) @@ -201,22 +219,25 @@ async def stream_async( ], model: Optional[str] = "azureai", 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[ @@ -224,14 +245,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, safe_prompt: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -259,7 +284,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 safe_prompt: Whether to inject a safety prompt before all conversations. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -271,6 +298,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: @@ -291,7 +321,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] ), @@ -302,13 +334,17 @@ 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]] + ), safe_prompt=safe_prompt, ) req = self._build_request_async( method="POST", - path="/chat/completions#stream", + path="/models/chat/completions#stream", base_url=base_url, url_variables=url_variables, request=request, @@ -343,7 +379,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, ) @@ -381,22 +417,25 @@ def complete( ], model: Optional[str] = "azureai", 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[ @@ -404,14 +443,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, safe_prompt: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -437,7 +480,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 safe_prompt: Whether to inject a safety prompt before all conversations. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -449,6 +494,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: @@ -469,7 +517,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] ), @@ -480,13 +530,17 @@ 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]] + ), safe_prompt=safe_prompt, ) req = self._build_request( method="POST", - path="/chat/completions", + path="/models/chat/completions", base_url=base_url, url_variables=url_variables, request=request, @@ -521,7 +575,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, ) @@ -551,22 +605,25 @@ async def complete_async( ], model: Optional[str] = "azureai", 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[ @@ -574,14 +631,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, safe_prompt: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -607,7 +668,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 safe_prompt: Whether to inject a safety prompt before all conversations. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -619,6 +682,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: @@ -639,7 +705,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] ), @@ -650,13 +718,17 @@ 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]] + ), safe_prompt=safe_prompt, ) req = self._build_request_async( method="POST", - path="/chat/completions", + path="/models/chat/completions", base_url=base_url, url_variables=url_variables, request=request, @@ -691,7 +763,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/azure/src/mistralai/azure/client/models/__init__.py b/packages/azure/src/mistralai/azure/client/models/__init__.py index 79c5df32..d9c28adc 100644 --- a/packages/azure/src/mistralai/azure/client/models/__init__.py +++ b/packages/azure/src/mistralai/azure/client/models/__init__.py @@ -5,6 +5,7 @@ from mistralai.azure.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 .documenturlchunk import DocumentURLChunk, DocumentURLChunkTypedDict from .filechunk import FileChunk, FileChunkTypedDict from .function import Function, FunctionTypedDict @@ -65,7 +78,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, @@ -75,21 +90,53 @@ ) 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 .ocrconfidencescore import OCRConfidenceScore, OCRConfidenceScoreTypedDict from .ocrimageobject import OCRImageObject, OCRImageObjectTypedDict + from .ocrpageconfidencescores import ( + OCRPageConfidenceScores, + OCRPageConfidenceScoresTypedDict, + ) from .ocrpagedimensions import OCRPageDimensions, OCRPageDimensionsTypedDict from .ocrpageobject import OCRPageObject, OCRPageObjectTypedDict from .ocrrequest import ( + ConfidenceScoresGranularity, Document, DocumentTypedDict, OCRRequest, OCRRequestTypedDict, + Pages, + PagesTypedDict, TableFormat, ) from .ocrresponse import OCRResponse, OCRResponseTypedDict from .ocrtableobject import Format, OCRTableObject, OCRTableObjectTypedDict from .ocrusageinfo import OCRUsageInfo, OCRUsageInfoTypedDict 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 @@ -109,6 +156,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, @@ -117,11 +165,10 @@ ) from .toolreferencechunk import ( ToolReferenceChunk, + ToolReferenceChunkTool, + ToolReferenceChunkToolTypedDict, ToolReferenceChunkTypedDict, - ToolUnion, - ToolUnionTypedDict, ) - from .tooltypes import ToolTypes from .usageinfo import UsageInfo, UsageInfoTypedDict from .usermessage import ( UserMessage, @@ -137,14 +184,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", @@ -154,8 +210,10 @@ "ChatCompletionRequestMessageTypedDict", "ChatCompletionRequestStop", "ChatCompletionRequestStopTypedDict", + "ChatCompletionRequestTool", "ChatCompletionRequestToolChoice", "ChatCompletionRequestToolChoiceTypedDict", + "ChatCompletionRequestToolTypedDict", "ChatCompletionRequestTypedDict", "ChatCompletionResponse", "ChatCompletionResponseTypedDict", @@ -164,9 +222,13 @@ "ChatCompletionStreamRequestMessageTypedDict", "ChatCompletionStreamRequestStop", "ChatCompletionStreamRequestStopTypedDict", + "ChatCompletionStreamRequestTool", "ChatCompletionStreamRequestToolChoice", "ChatCompletionStreamRequestToolChoiceTypedDict", + "ChatCompletionStreamRequestToolTypedDict", "ChatCompletionStreamRequestTypedDict", + "CodeInterpreterTool", + "CodeInterpreterToolTypedDict", "CompletionChunk", "CompletionChunkTypedDict", "CompletionEvent", @@ -174,15 +236,20 @@ "CompletionResponseStreamChoice", "CompletionResponseStreamChoiceFinishReason", "CompletionResponseStreamChoiceTypedDict", + "ConfidenceScoresGranularity", "ContentChunk", "ContentChunkTypedDict", "Context", "ContextTypedDict", + "CustomConnector", + "CustomConnectorTypedDict", "DeltaMessage", "DeltaMessageContent", "DeltaMessageContentTypedDict", "DeltaMessageTypedDict", "Document", + "DocumentLibraryTool", + "DocumentLibraryToolTypedDict", "DocumentTypedDict", "DocumentURLChunk", "DocumentURLChunkTypedDict", @@ -195,7 +262,11 @@ "FunctionName", "FunctionNameTypedDict", "FunctionTypedDict", + "GuardrailConfig", + "GuardrailConfigTypedDict", "ImageDetail", + "ImageGenerationTool", + "ImageGenerationToolTypedDict", "ImageURL", "ImageURLChunk", "ImageURLChunkTypedDict", @@ -207,8 +278,23 @@ "Loc", "LocTypedDict", "MistralPromptMode", + "ModerationLLMAction", + "ModerationLlmv1CategoryThresholds", + "ModerationLlmv1CategoryThresholdsTypedDict", + "ModerationLlmv1Config", + "ModerationLlmv1ConfigTypedDict", + "ModerationLlmv2CategoryThresholds", + "ModerationLlmv2CategoryThresholdsTypedDict", + "ModerationLlmv2Config", + "ModerationLlmv2ConfigTypedDict", + "OAuth2TokenAuth", + "OAuth2TokenAuthTypedDict", + "OCRConfidenceScore", + "OCRConfidenceScoreTypedDict", "OCRImageObject", "OCRImageObjectTypedDict", + "OCRPageConfidenceScores", + "OCRPageConfidenceScoresTypedDict", "OCRPageDimensions", "OCRPageDimensionsTypedDict", "OCRPageObject", @@ -221,10 +307,15 @@ "OCRTableObjectTypedDict", "OCRUsageInfo", "OCRUsageInfoTypedDict", + "Pages", + "PagesTypedDict", "Prediction", "PredictionTypedDict", + "ReasoningEffort", "ReferenceChunk", "ReferenceChunkTypedDict", + "ReferenceID", + "ReferenceIDTypedDict", "ResponseFormat", "ResponseFormatTypedDict", "ResponseFormats", @@ -249,16 +340,17 @@ "ToolChoice", "ToolChoiceEnum", "ToolChoiceTypedDict", + "ToolConfiguration", + "ToolConfigurationTypedDict", "ToolMessage", "ToolMessageContent", "ToolMessageContentTypedDict", "ToolMessageTypedDict", "ToolReferenceChunk", + "ToolReferenceChunkTool", + "ToolReferenceChunkToolTypedDict", "ToolReferenceChunkTypedDict", "ToolTypedDict", - "ToolTypes", - "ToolUnion", - "ToolUnionTypedDict", "UnknownContentChunk", "UsageInfo", "UsageInfoTypedDict", @@ -268,9 +360,15 @@ "UserMessageTypedDict", "ValidationError", "ValidationErrorTypedDict", + "WebSearchPremiumTool", + "WebSearchPremiumToolTypedDict", + "WebSearchTool", + "WebSearchToolTypedDict", ] _dynamic_imports: dict[str, str] = { + "APIKeyAuth": ".apikeyauth", + "APIKeyAuthTypedDict": ".apikeyauth", "AssistantMessage": ".assistantmessage", "AssistantMessageContent": ".assistantmessage", "AssistantMessageContentTypedDict": ".assistantmessage", @@ -284,8 +382,10 @@ "ChatCompletionRequestMessageTypedDict": ".chatcompletionrequest", "ChatCompletionRequestStop": ".chatcompletionrequest", "ChatCompletionRequestStopTypedDict": ".chatcompletionrequest", + "ChatCompletionRequestTool": ".chatcompletionrequest", "ChatCompletionRequestToolChoice": ".chatcompletionrequest", "ChatCompletionRequestToolChoiceTypedDict": ".chatcompletionrequest", + "ChatCompletionRequestToolTypedDict": ".chatcompletionrequest", "ChatCompletionRequestTypedDict": ".chatcompletionrequest", "ChatCompletionResponse": ".chatcompletionresponse", "ChatCompletionResponseTypedDict": ".chatcompletionresponse", @@ -294,9 +394,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", @@ -307,10 +411,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", "DocumentURLChunk": ".documenturlchunk", "DocumentURLChunkTypedDict": ".documenturlchunk", "FileChunk": ".filechunk", @@ -323,7 +433,11 @@ "FunctionCallTypedDict": ".functioncall", "FunctionName": ".functionname", "FunctionNameTypedDict": ".functionname", + "GuardrailConfig": ".guardrailconfig", + "GuardrailConfigTypedDict": ".guardrailconfig", "ImageDetail": ".imagedetail", + "ImageGenerationTool": ".imagegenerationtool", + "ImageGenerationToolTypedDict": ".imagegenerationtool", "ImageURL": ".imageurl", "ImageURLTypedDict": ".imageurl", "ImageURLChunk": ".imageurlchunk", @@ -333,16 +447,34 @@ "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", + "OCRConfidenceScore": ".ocrconfidencescore", + "OCRConfidenceScoreTypedDict": ".ocrconfidencescore", "OCRImageObject": ".ocrimageobject", "OCRImageObjectTypedDict": ".ocrimageobject", + "OCRPageConfidenceScores": ".ocrpageconfidencescores", + "OCRPageConfidenceScoresTypedDict": ".ocrpageconfidencescores", "OCRPageDimensions": ".ocrpagedimensions", "OCRPageDimensionsTypedDict": ".ocrpagedimensions", "OCRPageObject": ".ocrpageobject", "OCRPageObjectTypedDict": ".ocrpageobject", + "ConfidenceScoresGranularity": ".ocrrequest", "Document": ".ocrrequest", "DocumentTypedDict": ".ocrrequest", "OCRRequest": ".ocrrequest", "OCRRequestTypedDict": ".ocrrequest", + "Pages": ".ocrrequest", + "PagesTypedDict": ".ocrrequest", "TableFormat": ".ocrrequest", "OCRResponse": ".ocrresponse", "OCRResponseTypedDict": ".ocrresponse", @@ -353,8 +485,11 @@ "OCRUsageInfoTypedDict": ".ocrusageinfo", "Prediction": ".prediction", "PredictionTypedDict": ".prediction", + "ReasoningEffort": ".reasoningeffort", "ReferenceChunk": ".referencechunk", "ReferenceChunkTypedDict": ".referencechunk", + "ReferenceID": ".referencechunk", + "ReferenceIDTypedDict": ".referencechunk", "ResponseFormat": ".responseformat", "ResponseFormatTypedDict": ".responseformat", "ResponseFormats": ".responseformats", @@ -379,15 +514,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", @@ -400,6 +536,10 @@ "LocTypedDict": ".validationerror", "ValidationError": ".validationerror", "ValidationErrorTypedDict": ".validationerror", + "WebSearchPremiumTool": ".websearchpremiumtool", + "WebSearchPremiumToolTypedDict": ".websearchpremiumtool", + "WebSearchTool": ".websearchtool", + "WebSearchToolTypedDict": ".websearchtool", } diff --git a/packages/azure/src/mistralai/azure/client/models/apikeyauth.py b/packages/azure/src/mistralai/azure/client/models/apikeyauth.py new file mode 100644 index 00000000..7bce715c --- /dev/null +++ b/packages/azure/src/mistralai/azure/client/models/apikeyauth.py @@ -0,0 +1,29 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.azure.client.types import BaseModel +from mistralai.azure.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/azure/src/mistralai/azure/client/models/assistantmessage.py b/packages/azure/src/mistralai/azure/client/models/assistantmessage.py index e9ae6e82..f5e3316b 100644 --- a/packages/azure/src/mistralai/azure/client/models/assistantmessage.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/chatcompletionchoice.py b/packages/azure/src/mistralai/azure/client/models/chatcompletionchoice.py index 67b5ba69..7ab8832c 100644 --- a/packages/azure/src/mistralai/azure/client/models/chatcompletionchoice.py +++ b/packages/azure/src/mistralai/azure/client/models/chatcompletionchoice.py @@ -2,9 +2,11 @@ from __future__ import annotations from .assistantmessage import AssistantMessage, AssistantMessageTypedDict -from mistralai.azure.client.types import BaseModel, UnrecognizedStr -from typing import Literal, Union -from typing_extensions import TypedDict +from .deltamessage import DeltaMessage, DeltaMessageTypedDict +from mistralai.azure.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/azure/src/mistralai/azure/client/models/chatcompletionrequest.py b/packages/azure/src/mistralai/azure/client/models/chatcompletionrequest.py index edd0fdc7..90dc0101 100644 --- a/packages/azure/src/mistralai/azure/client/models/chatcompletionrequest.py +++ b/packages/azure/src/mistralai/azure/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.azure.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 ID of the model to use for this request.""" 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]]] safe_prompt: NotRequired[bool] r"""Whether to inject a safety prompt before all conversations.""" @@ -121,7 +156,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 @@ -130,7 +165,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 @@ -141,16 +176,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 @@ -162,9 +197,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 + safe_prompt: Optional[bool] = None r"""Whether to inject a safety prompt before all conversations.""" @@ -188,19 +227,27 @@ def serialize_model(self, handler): "n", "prediction", "parallel_tool_calls", + "reasoning_effort", "prompt_mode", + "guardrails", "safe_prompt", ] ) 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) @@ -208,7 +255,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/azure/src/mistralai/azure/client/models/chatcompletionstreamrequest.py b/packages/azure/src/mistralai/azure/client/models/chatcompletionstreamrequest.py index 2edfbed9..757d6231 100644 --- a/packages/azure/src/mistralai/azure/client/models/chatcompletionstreamrequest.py +++ b/packages/azure/src/mistralai/azure/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.azure.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 ID of the model to use for this request.""" 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]]] safe_prompt: NotRequired[bool] r"""Whether to inject a safety prompt before all conversations.""" @@ -120,7 +155,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 @@ -128,7 +163,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 @@ -139,16 +174,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 @@ -160,9 +195,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 + safe_prompt: Optional[bool] = None r"""Whether to inject a safety prompt before all conversations.""" @@ -186,19 +225,27 @@ def serialize_model(self, handler): "n", "prediction", "parallel_tool_calls", + "reasoning_effort", "prompt_mode", + "guardrails", "safe_prompt", ] ) 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) @@ -206,7 +253,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/azure/src/mistralai/azure/client/models/codeinterpretertool.py b/packages/azure/src/mistralai/azure/client/models/codeinterpretertool.py new file mode 100644 index 00000000..0f588be3 --- /dev/null +++ b/packages/azure/src/mistralai/azure/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.azure.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.azure.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/azure/src/mistralai/azure/client/models/completionchunk.py b/packages/azure/src/mistralai/azure/client/models/completionchunk.py index 0e64bbc8..f6168f17 100644 --- a/packages/azure/src/mistralai/azure/client/models/completionchunk.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/completionresponsestreamchoice.py b/packages/azure/src/mistralai/azure/client/models/completionresponsestreamchoice.py index 20a27140..36be8302 100644 --- a/packages/azure/src/mistralai/azure/client/models/completionresponsestreamchoice.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/customconnector.py b/packages/azure/src/mistralai/azure/client/models/customconnector.py new file mode 100644 index 00000000..e7eac82a --- /dev/null +++ b/packages/azure/src/mistralai/azure/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.azure.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.azure.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/azure/src/mistralai/azure/client/models/deltamessage.py b/packages/azure/src/mistralai/azure/client/models/deltamessage.py index 567e772f..5bac18c2 100644 --- a/packages/azure/src/mistralai/azure/client/models/deltamessage.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/documentlibrarytool.py b/packages/azure/src/mistralai/azure/client/models/documentlibrarytool.py new file mode 100644 index 00000000..6e2e31e7 --- /dev/null +++ b/packages/azure/src/mistralai/azure/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.azure.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.azure.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/azure/src/mistralai/azure/client/models/documenturlchunk.py b/packages/azure/src/mistralai/azure/client/models/documenturlchunk.py index 2dea8005..03af5816 100644 --- a/packages/azure/src/mistralai/azure/client/models/documenturlchunk.py +++ b/packages/azure/src/mistralai/azure/client/models/documenturlchunk.py @@ -46,7 +46,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/azure/src/mistralai/azure/client/models/filechunk.py b/packages/azure/src/mistralai/azure/client/models/filechunk.py index 6baa0cba..772f67e6 100644 --- a/packages/azure/src/mistralai/azure/client/models/filechunk.py +++ b/packages/azure/src/mistralai/azure/client/models/filechunk.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/azure/src/mistralai/azure/client/models/function.py b/packages/azure/src/mistralai/azure/client/models/function.py index 055d3657..3f135ed2 100644 --- a/packages/azure/src/mistralai/azure/client/models/function.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/guardrailconfig.py b/packages/azure/src/mistralai/azure/client/models/guardrailconfig.py new file mode 100644 index 00000000..4feffa67 --- /dev/null +++ b/packages/azure/src/mistralai/azure/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.azure.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/azure/src/mistralai/azure/client/models/imagegenerationtool.py b/packages/azure/src/mistralai/azure/client/models/imagegenerationtool.py new file mode 100644 index 00000000..5c51d688 --- /dev/null +++ b/packages/azure/src/mistralai/azure/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.azure.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.azure.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/azure/src/mistralai/azure/client/models/imageurl.py b/packages/azure/src/mistralai/azure/client/models/imageurl.py index bcb4fe43..c1704cd8 100644 --- a/packages/azure/src/mistralai/azure/client/models/imageurl.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/imageurlchunk.py b/packages/azure/src/mistralai/azure/client/models/imageurlchunk.py index 7213c498..8e8df9a6 100644 --- a/packages/azure/src/mistralai/azure/client/models/imageurlchunk.py +++ b/packages/azure/src/mistralai/azure/client/models/imageurlchunk.py @@ -20,14 +20,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 @@ -46,7 +46,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/azure/src/mistralai/azure/client/models/jsonschema.py b/packages/azure/src/mistralai/azure/client/models/jsonschema.py index 99f2fb89..2790728b 100644 --- a/packages/azure/src/mistralai/azure/client/models/jsonschema.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/moderationllmaction.py b/packages/azure/src/mistralai/azure/client/models/moderationllmaction.py new file mode 100644 index 00000000..cff03d9a --- /dev/null +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/moderationllmv1categorythresholds.py b/packages/azure/src/mistralai/azure/client/models/moderationllmv1categorythresholds.py new file mode 100644 index 00000000..e3e9b22f --- /dev/null +++ b/packages/azure/src/mistralai/azure/client/models/moderationllmv1categorythresholds.py @@ -0,0 +1,93 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.azure.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/azure/src/mistralai/azure/client/models/moderationllmv1config.py b/packages/azure/src/mistralai/azure/client/models/moderationllmv1config.py new file mode 100644 index 00000000..82268870 --- /dev/null +++ b/packages/azure/src/mistralai/azure/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.azure.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/azure/src/mistralai/azure/client/models/moderationllmv2categorythresholds.py b/packages/azure/src/mistralai/azure/client/models/moderationllmv2categorythresholds.py new file mode 100644 index 00000000..57af08d8 --- /dev/null +++ b/packages/azure/src/mistralai/azure/client/models/moderationllmv2categorythresholds.py @@ -0,0 +1,103 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.azure.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/azure/src/mistralai/azure/client/models/moderationllmv2config.py b/packages/azure/src/mistralai/azure/client/models/moderationllmv2config.py new file mode 100644 index 00000000..57075e60 --- /dev/null +++ b/packages/azure/src/mistralai/azure/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.azure.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/azure/src/mistralai/azure/client/models/oauth2tokenauth.py b/packages/azure/src/mistralai/azure/client/models/oauth2tokenauth.py new file mode 100644 index 00000000..3da345fc --- /dev/null +++ b/packages/azure/src/mistralai/azure/client/models/oauth2tokenauth.py @@ -0,0 +1,31 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.azure.client.types import BaseModel +from mistralai.azure.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/azure/src/mistralai/azure/client/models/ocrconfidencescore.py b/packages/azure/src/mistralai/azure/client/models/ocrconfidencescore.py new file mode 100644 index 00000000..7ac59069 --- /dev/null +++ b/packages/azure/src/mistralai/azure/client/models/ocrconfidencescore.py @@ -0,0 +1,29 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.azure.client.types import BaseModel +from typing_extensions import TypedDict + + +class OCRConfidenceScoreTypedDict(TypedDict): + r"""Confidence score for a token or word in OCR output.""" + + text: str + r"""The word or text segment""" + confidence: float + r"""Confidence score (0-1)""" + start_index: int + r"""Start index of the text in the page markdown string""" + + +class OCRConfidenceScore(BaseModel): + r"""Confidence score for a token or word in OCR output.""" + + text: str + r"""The word or text segment""" + + confidence: float + r"""Confidence score (0-1)""" + + start_index: int + r"""Start index of the text in the page markdown string""" diff --git a/packages/azure/src/mistralai/azure/client/models/ocrimageobject.py b/packages/azure/src/mistralai/azure/client/models/ocrimageobject.py index a23515b3..91d7ac0e 100644 --- a/packages/azure/src/mistralai/azure/client/models/ocrimageobject.py +++ b/packages/azure/src/mistralai/azure/client/models/ocrimageobject.py @@ -69,7 +69,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/azure/src/mistralai/azure/client/models/ocrpageconfidencescores.py b/packages/azure/src/mistralai/azure/client/models/ocrpageconfidencescores.py new file mode 100644 index 00000000..2d5d7a1a --- /dev/null +++ b/packages/azure/src/mistralai/azure/client/models/ocrpageconfidencescores.py @@ -0,0 +1,62 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .ocrconfidencescore import OCRConfidenceScore, OCRConfidenceScoreTypedDict +from mistralai.azure.client.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class OCRPageConfidenceScoresTypedDict(TypedDict): + r"""Confidence scores for an OCR page at various granularities. + + Note on page-level stats: + - For 'page' granularity: average/minimum are computed from per-token exp(logprob). + - For 'word' granularity: average/minimum are computed from per-word confidence, + where each word's confidence is exp(mean(token_logprobs)) — a geometric mean + over the word's subword tokens. + """ + + average_page_confidence_score: float + r"""Average confidence score for the page""" + minimum_page_confidence_score: float + r"""Minimum confidence score for the page""" + word_confidence_scores: NotRequired[List[OCRConfidenceScoreTypedDict]] + r"""Word-level confidence scores (populated only for 'word' granularity)""" + + +class OCRPageConfidenceScores(BaseModel): + r"""Confidence scores for an OCR page at various granularities. + + Note on page-level stats: + - For 'page' granularity: average/minimum are computed from per-token exp(logprob). + - For 'word' granularity: average/minimum are computed from per-word confidence, + where each word's confidence is exp(mean(token_logprobs)) — a geometric mean + over the word's subword tokens. + """ + + average_page_confidence_score: float + r"""Average confidence score for the page""" + + minimum_page_confidence_score: float + r"""Minimum confidence score for the page""" + + word_confidence_scores: Optional[List[OCRConfidenceScore]] = None + r"""Word-level confidence scores (populated only for 'word' granularity)""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["word_confidence_scores"]) + 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/azure/src/mistralai/azure/client/models/ocrpageobject.py b/packages/azure/src/mistralai/azure/client/models/ocrpageobject.py index 434c8988..08b5dbcb 100644 --- a/packages/azure/src/mistralai/azure/client/models/ocrpageobject.py +++ b/packages/azure/src/mistralai/azure/client/models/ocrpageobject.py @@ -2,6 +2,10 @@ from __future__ import annotations from .ocrimageobject import OCRImageObject, OCRImageObjectTypedDict +from .ocrpageconfidencescores import ( + OCRPageConfidenceScores, + OCRPageConfidenceScoresTypedDict, +) from .ocrpagedimensions import OCRPageDimensions, OCRPageDimensionsTypedDict from .ocrtableobject import OCRTableObject, OCRTableObjectTypedDict from mistralai.azure.client.types import ( @@ -33,6 +37,8 @@ class OCRPageObjectTypedDict(TypedDict): r"""Header of the page""" footer: NotRequired[Nullable[str]] r"""Footer of the page""" + confidence_scores: NotRequired[Nullable[OCRPageConfidenceScoresTypedDict]] + r"""Confidence scores for the OCR page (populated when confidence_scores_granularity is set)""" class OCRPageObject(BaseModel): @@ -60,16 +66,21 @@ class OCRPageObject(BaseModel): footer: OptionalNullable[str] = UNSET r"""Footer of the page""" + confidence_scores: OptionalNullable[OCRPageConfidenceScores] = UNSET + r"""Confidence scores for the OCR page (populated when confidence_scores_granularity is set)""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["tables", "hyperlinks", "header", "footer"]) - nullable_fields = set(["header", "footer", "dimensions"]) + optional_fields = set( + ["tables", "hyperlinks", "header", "footer", "confidence_scores"] + ) + nullable_fields = set(["header", "footer", "dimensions", "confidence_scores"]) 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/azure/src/mistralai/azure/client/models/ocrrequest.py b/packages/azure/src/mistralai/azure/client/models/ocrrequest.py index a2cd3415..731c0cf8 100644 --- a/packages/azure/src/mistralai/azure/client/models/ocrrequest.py +++ b/packages/azure/src/mistralai/azure/client/models/ocrrequest.py @@ -28,19 +28,32 @@ r"""Document to run OCR on""" +PagesTypedDict = TypeAliasType("PagesTypedDict", Union[str, List[int]]) +r"""Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0.""" + + +Pages = TypeAliasType("Pages", Union[str, List[int]]) +r"""Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0.""" + + TableFormat = Literal[ "markdown", "html", ] +ConfidenceScoresGranularity = Literal[ + "word", + "page", +] + + class OCRRequestTypedDict(TypedDict): model: Nullable[str] document: DocumentTypedDict r"""Document to run OCR on""" - id: NotRequired[str] - pages: NotRequired[Nullable[List[int]]] - r"""Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0""" + pages: NotRequired[Nullable[PagesTypedDict]] + r"""Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0.""" include_image_base64: NotRequired[Nullable[bool]] r"""Include image URLs in response""" image_limit: NotRequired[Nullable[int]] @@ -56,6 +69,8 @@ class OCRRequestTypedDict(TypedDict): table_format: NotRequired[Nullable[TableFormat]] extract_header: NotRequired[bool] extract_footer: NotRequired[bool] + confidence_scores_granularity: NotRequired[Nullable[ConfidenceScoresGranularity]] + r"""Granularity for confidence scores: 'word' (per-word scores) or 'page' (aggregate only). Defaults to None (no confidence scores) to keep response payload small.""" class OCRRequest(BaseModel): @@ -64,10 +79,8 @@ class OCRRequest(BaseModel): document: Document r"""Document to run OCR on""" - id: Optional[str] = None - - pages: OptionalNullable[List[int]] = UNSET - r"""Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0""" + pages: OptionalNullable[Pages] = UNSET + r"""Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0.""" include_image_base64: OptionalNullable[bool] = UNSET r"""Include image URLs in response""" @@ -93,11 +106,13 @@ class OCRRequest(BaseModel): extract_footer: Optional[bool] = None + confidence_scores_granularity: OptionalNullable[ConfidenceScoresGranularity] = UNSET + r"""Granularity for confidence scores: 'word' (per-word scores) or 'page' (aggregate only). Defaults to None (no confidence scores) to keep response payload small.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ - "id", "pages", "include_image_base64", "image_limit", @@ -108,6 +123,7 @@ def serialize_model(self, handler): "table_format", "extract_header", "extract_footer", + "confidence_scores_granularity", ] ) nullable_fields = set( @@ -121,6 +137,7 @@ def serialize_model(self, handler): "document_annotation_format", "document_annotation_prompt", "table_format", + "confidence_scores_granularity", ] ) serialized = handler(self) @@ -128,7 +145,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/azure/src/mistralai/azure/client/models/ocrresponse.py b/packages/azure/src/mistralai/azure/client/models/ocrresponse.py index 3dc09fd7..6e27f574 100644 --- a/packages/azure/src/mistralai/azure/client/models/ocrresponse.py +++ b/packages/azure/src/mistralai/azure/client/models/ocrresponse.py @@ -46,7 +46,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/azure/src/mistralai/azure/client/models/ocrtableobject.py b/packages/azure/src/mistralai/azure/client/models/ocrtableobject.py index f1de5428..07bc7c13 100644 --- a/packages/azure/src/mistralai/azure/client/models/ocrtableobject.py +++ b/packages/azure/src/mistralai/azure/client/models/ocrtableobject.py @@ -1,10 +1,19 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from mistralai.azure.client.types import BaseModel, UnrecognizedStr +from .ocrconfidencescore import OCRConfidenceScore, OCRConfidenceScoreTypedDict +from mistralai.azure.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) import pydantic -from typing import Literal, Union -from typing_extensions import Annotated, TypedDict +from pydantic import model_serializer +from typing import List, Literal, Union +from typing_extensions import Annotated, NotRequired, TypedDict Format = Union[ @@ -24,6 +33,8 @@ class OCRTableObjectTypedDict(TypedDict): r"""Content of the table in the given format""" format_: Format r"""Format of the table""" + word_confidence_scores: NotRequired[Nullable[List[OCRConfidenceScoreTypedDict]]] + r"""Per-word confidence scores for the table content. Returned when confidence_scores_granularity is set to 'word'.""" class OCRTableObject(BaseModel): @@ -36,6 +47,34 @@ class OCRTableObject(BaseModel): format_: Annotated[Format, pydantic.Field(alias="format")] r"""Format of the table""" + word_confidence_scores: OptionalNullable[List[OCRConfidenceScore]] = UNSET + r"""Per-word confidence scores for the table content. Returned when confidence_scores_granularity is set to 'word'.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["word_confidence_scores"]) + nullable_fields = set(["word_confidence_scores"]) + 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: OCRTableObject.model_rebuild() diff --git a/packages/azure/src/mistralai/azure/client/models/ocrusageinfo.py b/packages/azure/src/mistralai/azure/client/models/ocrusageinfo.py index f63315d2..b5c5f5c1 100644 --- a/packages/azure/src/mistralai/azure/client/models/ocrusageinfo.py +++ b/packages/azure/src/mistralai/azure/client/models/ocrusageinfo.py @@ -35,7 +35,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/azure/src/mistralai/azure/client/models/prediction.py b/packages/azure/src/mistralai/azure/client/models/prediction.py index 1fa1d782..3d94feb5 100644 --- a/packages/azure/src/mistralai/azure/client/models/prediction.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/reasoningeffort.py b/packages/azure/src/mistralai/azure/client/models/reasoningeffort.py new file mode 100644 index 00000000..43ffa02b --- /dev/null +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/referencechunk.py b/packages/azure/src/mistralai/azure/client/models/referencechunk.py index f7af9bf9..debab3ce 100644 --- a/packages/azure/src/mistralai/azure/client/models/referencechunk.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/responseformat.py b/packages/azure/src/mistralai/azure/client/models/responseformat.py index 20fd2b86..50f0b075 100644 --- a/packages/azure/src/mistralai/azure/client/models/responseformat.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/thinkchunk.py b/packages/azure/src/mistralai/azure/client/models/thinkchunk.py index ec8e7f95..8e52ccc9 100644 --- a/packages/azure/src/mistralai/azure/client/models/thinkchunk.py +++ b/packages/azure/src/mistralai/azure/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.azure.client.types import BaseModel, UNSET_SENTINEL +from mistralai.azure.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) from mistralai.azure.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/azure/src/mistralai/azure/client/models/tool.py b/packages/azure/src/mistralai/azure/client/models/tool.py index 87329bdb..ecfb5f34 100644 --- a/packages/azure/src/mistralai/azure/client/models/tool.py +++ b/packages/azure/src/mistralai/azure/client/models/tool.py @@ -2,35 +2,32 @@ from __future__ import annotations from .function import Function, FunctionTypedDict -from .tooltypes import ToolTypes -from mistralai.azure.client.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +from mistralai.azure.client.types import BaseModel, UnrecognizedStr +from mistralai.azure.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/azure/src/mistralai/azure/client/models/toolcall.py b/packages/azure/src/mistralai/azure/client/models/toolcall.py index ada1ea65..87ccd030 100644 --- a/packages/azure/src/mistralai/azure/client/models/toolcall.py +++ b/packages/azure/src/mistralai/azure/client/models/toolcall.py @@ -2,7 +2,6 @@ from __future__ import annotations from .functioncall import FunctionCall, FunctionCallTypedDict -from .tooltypes import ToolTypes from mistralai.azure.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/azure/src/mistralai/azure/client/models/toolchoice.py b/packages/azure/src/mistralai/azure/client/models/toolchoice.py index ddb9e141..15d1da1c 100644 --- a/packages/azure/src/mistralai/azure/client/models/toolchoice.py +++ b/packages/azure/src/mistralai/azure/client/models/toolchoice.py @@ -2,7 +2,6 @@ from __future__ import annotations from .functionname import FunctionName, FunctionNameTypedDict -from .tooltypes import ToolTypes from mistralai.azure.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/azure/src/mistralai/azure/client/models/toolconfiguration.py b/packages/azure/src/mistralai/azure/client/models/toolconfiguration.py new file mode 100644 index 00000000..6977679f --- /dev/null +++ b/packages/azure/src/mistralai/azure/client/models/toolconfiguration.py @@ -0,0 +1,52 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from mistralai.azure.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/azure/src/mistralai/azure/client/models/toolmessage.py b/packages/azure/src/mistralai/azure/client/models/toolmessage.py index 670210de..e246d5a2 100644 --- a/packages/azure/src/mistralai/azure/client/models/toolmessage.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/toolreferencechunk.py b/packages/azure/src/mistralai/azure/client/models/toolreferencechunk.py index c9db878f..0845fde3 100644 --- a/packages/azure/src/mistralai/azure/client/models/toolreferencechunk.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/tooltypes.py b/packages/azure/src/mistralai/azure/client/models/tooltypes.py deleted file mode 100644 index 1cce7446..00000000 --- a/packages/azure/src/mistralai/azure/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.azure.client.types import UnrecognizedStr -from typing import Literal, Union - - -ToolTypes = Union[Literal["function",], UnrecognizedStr] diff --git a/packages/azure/src/mistralai/azure/client/models/usageinfo.py b/packages/azure/src/mistralai/azure/client/models/usageinfo.py index 0f04c87c..9200682a 100644 --- a/packages/azure/src/mistralai/azure/client/models/usageinfo.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/usermessage.py b/packages/azure/src/mistralai/azure/client/models/usermessage.py index 549b01ca..7dbca134 100644 --- a/packages/azure/src/mistralai/azure/client/models/usermessage.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/validationerror.py b/packages/azure/src/mistralai/azure/client/models/validationerror.py index f0169e18..aaa72f21 100644 --- a/packages/azure/src/mistralai/azure/client/models/validationerror.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/models/websearchpremiumtool.py b/packages/azure/src/mistralai/azure/client/models/websearchpremiumtool.py new file mode 100644 index 00000000..252d8803 --- /dev/null +++ b/packages/azure/src/mistralai/azure/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.azure.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.azure.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/azure/src/mistralai/azure/client/models/websearchtool.py b/packages/azure/src/mistralai/azure/client/models/websearchtool.py new file mode 100644 index 00000000..363e0331 --- /dev/null +++ b/packages/azure/src/mistralai/azure/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.azure.client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from mistralai.azure.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/azure/src/mistralai/azure/client/ocr.py b/packages/azure/src/mistralai/azure/client/ocr.py index b9270f6a..c4f706a9 100644 --- a/packages/azure/src/mistralai/azure/client/ocr.py +++ b/packages/azure/src/mistralai/azure/client/ocr.py @@ -5,7 +5,7 @@ from mistralai.azure.client._hooks import HookContext from mistralai.azure.client.types import Nullable, OptionalNullable, UNSET from mistralai.azure.client.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional, Union +from typing import Any, Mapping, Optional, Union class Ocr(BaseSDK): @@ -14,8 +14,7 @@ def process( *, model: Nullable[str], document: Union[models.Document, models.DocumentTypedDict], - id: Optional[str] = None, - pages: OptionalNullable[List[int]] = UNSET, + pages: OptionalNullable[Union[models.Pages, models.PagesTypedDict]] = UNSET, include_image_base64: OptionalNullable[bool] = UNSET, image_limit: OptionalNullable[int] = UNSET, image_min_size: OptionalNullable[int] = UNSET, @@ -29,6 +28,9 @@ def process( table_format: OptionalNullable[models.TableFormat] = UNSET, extract_header: Optional[bool] = None, extract_footer: Optional[bool] = None, + confidence_scores_granularity: OptionalNullable[ + models.ConfidenceScoresGranularity + ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -38,8 +40,7 @@ def process( :param model: :param document: Document to run OCR on - :param id: - :param pages: Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0 + :param pages: Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0. :param include_image_base64: Include image URLs in response :param image_limit: Max images to extract :param image_min_size: Minimum height and width of image to extract @@ -49,6 +50,7 @@ def process( :param table_format: :param extract_header: :param extract_footer: + :param confidence_scores_granularity: Granularity for confidence scores: 'word' (per-word scores) or 'page' (aggregate only). Defaults to None (no confidence scores) to keep response payload small. :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 @@ -59,6 +61,9 @@ def process( 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: @@ -66,7 +71,6 @@ def process( request = models.OCRRequest( model=model, - id=id, document=utils.get_pydantic_model(document, models.Document), pages=pages, include_image_base64=include_image_base64, @@ -82,11 +86,12 @@ def process( table_format=table_format, extract_header=extract_header, extract_footer=extract_footer, + confidence_scores_granularity=confidence_scores_granularity, ) req = self._build_request( method="POST", - path="/ocr", + path="/providers/mistral/azure/ocr", base_url=base_url, url_variables=url_variables, request=request, @@ -121,7 +126,7 @@ def process( 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, ) @@ -147,8 +152,7 @@ async def process_async( *, model: Nullable[str], document: Union[models.Document, models.DocumentTypedDict], - id: Optional[str] = None, - pages: OptionalNullable[List[int]] = UNSET, + pages: OptionalNullable[Union[models.Pages, models.PagesTypedDict]] = UNSET, include_image_base64: OptionalNullable[bool] = UNSET, image_limit: OptionalNullable[int] = UNSET, image_min_size: OptionalNullable[int] = UNSET, @@ -162,6 +166,9 @@ async def process_async( table_format: OptionalNullable[models.TableFormat] = UNSET, extract_header: Optional[bool] = None, extract_footer: Optional[bool] = None, + confidence_scores_granularity: OptionalNullable[ + models.ConfidenceScoresGranularity + ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -171,8 +178,7 @@ async def process_async( :param model: :param document: Document to run OCR on - :param id: - :param pages: Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0 + :param pages: Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0. :param include_image_base64: Include image URLs in response :param image_limit: Max images to extract :param image_min_size: Minimum height and width of image to extract @@ -182,6 +188,7 @@ async def process_async( :param table_format: :param extract_header: :param extract_footer: + :param confidence_scores_granularity: Granularity for confidence scores: 'word' (per-word scores) or 'page' (aggregate only). Defaults to None (no confidence scores) to keep response payload small. :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 @@ -192,6 +199,9 @@ async def process_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: @@ -199,7 +209,6 @@ async def process_async( request = models.OCRRequest( model=model, - id=id, document=utils.get_pydantic_model(document, models.Document), pages=pages, include_image_base64=include_image_base64, @@ -215,11 +224,12 @@ async def process_async( table_format=table_format, extract_header=extract_header, extract_footer=extract_footer, + confidence_scores_granularity=confidence_scores_granularity, ) req = self._build_request_async( method="POST", - path="/ocr", + path="/providers/mistral/azure/ocr", base_url=base_url, url_variables=url_variables, request=request, @@ -254,7 +264,7 @@ async def process_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/azure/src/mistralai/azure/client/utils/eventstreaming.py b/packages/azure/src/mistralai/azure/client/utils/eventstreaming.py index f2052fc2..3bdcd6d3 100644 --- a/packages/azure/src/mistralai/azure/client/utils/eventstreaming.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/utils/metadata.py b/packages/azure/src/mistralai/azure/client/utils/metadata.py index 173b3e5c..5abddd58 100644 --- a/packages/azure/src/mistralai/azure/client/utils/metadata.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/utils/security.py b/packages/azure/src/mistralai/azure/client/utils/security.py index 17996bd5..42d8d78e 100644 --- a/packages/azure/src/mistralai/azure/client/utils/security.py +++ b/packages/azure/src/mistralai/azure/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/azure/src/mistralai/azure/client/utils/serializers.py b/packages/azure/src/mistralai/azure/client/utils/serializers.py index 14321eb4..d2149f8b 100644 --- a/packages/azure/src/mistralai/azure/client/utils/serializers.py +++ b/packages/azure/src/mistralai/azure/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/azure/uv.lock b/packages/azure/uv.lock index ac8a5de9..4fd77081 100644 --- a/packages/azure/uv.lock +++ b/packages/azure/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" @@ -154,7 +158,7 @@ wheels = [ [[package]] name = "mistralai-azure" -version = "2.0.0" +version = "2.1.0" source = { editable = "." } dependencies = [ { name = "httpcore" }, diff --git a/tests/test_azure_v2_parity.py b/tests/test_azure_v2_parity.py index 8cd89bf4..1c2c6ab1 100644 --- a/tests/test_azure_v2_parity.py +++ b/tests/test_azure_v2_parity.py @@ -50,17 +50,17 @@ def mark_tested(resource: str, method: str) -> None: ("messages", _EMPTY), ("model", "azureai"), ("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), @@ -80,7 +80,6 @@ def mark_tested(resource: str, method: str) -> None: OCR_PROCESS_PARAMS = [ ("model", _EMPTY), ("document", _EMPTY), - ("id", None), ("pages", UNSET), ("include_image_base64", UNSET), ("image_limit", UNSET),