diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index cd97e129..f9df4b45 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: 2d045ec7-2ebb-4f4d-ad25-40953b132161 management: - docChecksum: 42ee0bdf8fcf0fa3ee261db644fe8154 + docChecksum: ca92565d67c579eda596d4768aa274ee docVersion: 1.0.0 - speakeasyVersion: 1.754.0 - generationVersion: 2.862.0 - releaseVersion: 2.2.0 - configChecksum: ed5cc4cf5a87eaacbf1b77366abd2467 + speakeasyVersion: 1.761.1 + generationVersion: 2.879.6 + releaseVersion: 2.2.1 + configChecksum: d39c00303cffb2a9684327475a8b6933 repoURL: https://github.com/mistralai/client-python.git installationURL: https://github.com/mistralai/client-python.git published: true persistentEdits: - generation_id: 6b0c3b1d-b7b3-4318-b2a1-5d44dd7fa3ac - pristine_commit_hash: 2e766581e0b9c6c42cbd61b500b0b6469a27a175 - pristine_tree_hash: ded10775e62be5fb057ebf7819d56da121f02829 + generation_id: 008132a9-295a-4f6a-8acf-beb31a500ce4 + pristine_commit_hash: effbf5c41644318c0c3b6d302c9c91ef3169feed + pristine_tree_hash: a57bd4a2392ef310f49a631b9e1ec468774ee76e features: python: acceptHeaders: 3.0.0 @@ -21,7 +21,7 @@ features: additionalProperties: 1.0.1 configurableModuleName: 0.2.0 constsAndDefaults: 1.0.7 - core: 6.0.18 + core: 6.0.21 customCodeRegions: 0.1.1 defaultEnabledRetries: 0.2.0 deprecations: 3.0.2 @@ -32,7 +32,7 @@ features: examples: 3.0.3 flatRequests: 1.0.1 flattening: 3.1.1 - globalSecurity: 3.0.5 + globalSecurity: 3.0.7 globalSecurityCallbacks: 1.0.0 globalSecurityFlattening: 1.0.0 globalServerURLs: 3.2.1 @@ -42,7 +42,7 @@ features: nameOverrides: 3.0.3 nullables: 1.0.2 openEnums: 1.0.4 - pagination: 3.0.7 + pagination: 3.0.9 responseFormat: 1.1.0 retries: 3.0.4 sdkHooks: 1.2.1 @@ -1147,8 +1147,8 @@ trackedFiles: pristine_git_object: 8b28cb0e5c60ac9676656624eb3c2c6fdc8a3e88 docs/models/filesapiroutesgetsignedurlrequest.md: id: 08f3772db370 - last_write_checksum: sha1:26aa0140444ccef7307ef6f236932032e4784e8f - pristine_git_object: dbe3c801003c7bb8616f0c5be2dac2ab1e7e9fb1 + last_write_checksum: sha1:7d1577169ca1d22b3088ab1157cb49192515e6f3 + pristine_git_object: 794f25f78338baae371ebd7c653ceba2d280fdfe docs/models/filesapirouteslistfilesrequest.md: id: 04bdf7c654bd last_write_checksum: sha1:0a99755150c2ded8e5d59a96527021d29326b980 @@ -1223,8 +1223,8 @@ trackedFiles: pristine_git_object: 36d3db18679569d21e6bacfe13bcd22715372297 docs/models/ftmodelcard.md: id: 15ed6f94deea - last_write_checksum: sha1:8e1383e26d86fd247fa1762dbb0508ceed932a49 - pristine_git_object: 0381dd81d0460af3aacdf81a495c304ed9b78451 + last_write_checksum: sha1:5873780bc2a828f1164818eb9c64c3f69c6618cc + pristine_git_object: f65ff6e888a460ac5f3ad3a4556ccdd8366960c0 docs/models/function.md: id: 416a80fba031 last_write_checksum: sha1:a9485076d430a7753558461ce87bf42d09e34511 @@ -2911,8 +2911,8 @@ trackedFiles: pristine_git_object: ac50a894e5290f07d8531e25663baae090cf533e docs/models/workflowexecutionrequest.md: id: 44a6d9ef046a - last_write_checksum: sha1:78e3aeb9a9b13ab01906e9c2d423ac4925332dc4 - pristine_git_object: 553119b16dbc695eff102eae11e80c4426612e01 + last_write_checksum: sha1:fafbe0ccef730faa8a1689ff7525fb439e77dc48 + pristine_git_object: 54f61ea35422b37fa529e0602a338e0248c05f39 docs/models/workflowexecutionresponse.md: id: 73595cfc443f last_write_checksum: sha1:3861cb1972cca17c595d1eb23518bfa54c382e89 @@ -3115,8 +3115,8 @@ trackedFiles: pristine_git_object: 3c8424419bae5c7e6e47b4cb23e35064531a8345 docs/sdks/files/README.md: id: e576d7a117f0 - last_write_checksum: sha1:7022f6e63afea7c7988b251351d18361fd1b5e4a - pristine_git_object: 7db76611c5788e2a0440f7c95d07928851e37d6a + last_write_checksum: sha1:45265e774720742cde1c76c8be294983bf4fc77a + pristine_git_object: 246707073e9dee115d30b20a01bf728dcb43efd7 docs/sdks/fim/README.md: id: 499b227bf6ca last_write_checksum: sha1:5b2ce811df8d867d14fe0126f2c9619cca779f56 @@ -3175,8 +3175,8 @@ trackedFiles: pristine_git_object: 5e2380d1d15afd204e20d0a16adc84f30e91e041 docs/sdks/workflows/README.md: id: 80c76ce944c0 - last_write_checksum: sha1:572ef0ec9cadcd850e3966dad909a3d2e901280a - pristine_git_object: e65383ca453849b3bab58f921f80f5b8e7df7839 + last_write_checksum: sha1:af6d1ec6698a8d58a743d67e897910038bed299a + pristine_git_object: 324c46b14e6d1bebbfe9dda2458201cb799d67d1 docs/sdks/workflowsevents/README.md: id: 514b42269280 last_write_checksum: sha1:34971ab6eef89b115d78375a85142f3d2612f431 @@ -3207,8 +3207,8 @@ trackedFiles: pristine_git_object: 036d44b8cfc51599873bd5c401a6aed30450536c src/mistralai/client/_version.py: id: cc807b30de19 - last_write_checksum: sha1:e0d4cdfdf25c401429c0e9beb40be8846cb2a235 - pristine_git_object: 0473419e2e46dbf2e975a7fdcc5355d056752cdf + last_write_checksum: sha1:4c105799528d2da48c537f49f19ea75fb83807b8 + pristine_git_object: a8c34e6d26b0d4e78ff36b469b5e105525b1b135 src/mistralai/client/accesses.py: id: 76fc53bfcf59 last_write_checksum: sha1:4b1cf5d760f690d35582f9037df44c97c11e7e14 @@ -3223,8 +3223,8 @@ trackedFiles: pristine_git_object: 597954e4facba105cee62d92ea6b8c68555f63dd src/mistralai/client/basesdk.py: id: 7518c67b81ea - last_write_checksum: sha1:2cea76931db51175b2c787d0c707f08e9944c22f - pristine_git_object: a976121bd224d64497e5006cb58dd728f6a67144 + last_write_checksum: sha1:321a95c38231ed5126753702e6368a85a1af1667 + pristine_git_object: 4a27eb2ff362dd6189abfde2c8f739b70deab192 src/mistralai/client/batch.py: id: cffe114c7ac7 last_write_checksum: sha1:b452983f67b33f26e1faa60fdbbb171cb1877224 @@ -3323,8 +3323,8 @@ trackedFiles: pristine_git_object: a5b8003ca5fc766a7db89d6c95b9d0e42952af86 src/mistralai/client/files.py: id: f12df4b2ce43 - last_write_checksum: sha1:e60cfc2841ef8888a6a52479adf76ec32ecae6ac - pristine_git_object: a843cb7b2b1b55ba20093c4d43faddb972d8f645 + last_write_checksum: sha1:5599644b2c6b489365aa648fb2fb75630d2cd3e7 + pristine_git_object: 453c97c7ca5a0a02648b7848062a71a9176b7289 src/mistralai/client/fim.py: id: 217bea5d701d last_write_checksum: sha1:dc427c9e954dfb9a7fe2df8b5c544877a28cdc73 @@ -4159,8 +4159,8 @@ trackedFiles: pristine_git_object: 83de8e73a3d50917e4a41bb92a828a10e646a632 src/mistralai/client/models/files_api_routes_get_signed_urlop.py: id: 0a1a18c6431e - last_write_checksum: sha1:4cf67e8cafa1f448caf9b251dd9db3e9c87d062e - pristine_git_object: 326dd1d305261acc1407e6f70100b3b59dfcee5c + last_write_checksum: sha1:46c5a0babdc6df693c03355f22131ff8d847389c + pristine_git_object: c381244b5d819e48ca7d1ad5064726fd6627cfd1 src/mistralai/client/models/files_api_routes_list_filesop.py: id: b2e92f2a29b4 last_write_checksum: sha1:18f318488f01a9a919c8650ee1f5eb825c39c91d @@ -4219,8 +4219,8 @@ trackedFiles: pristine_git_object: ccb0f21b5a69f91119bec9db6e9f3d876e4c35af src/mistralai/client/models/ftmodelcard.py: id: c4f15eed2ca2 - last_write_checksum: sha1:4382bdc5744ed2199c0aefcf32d8d9e0d02c42f4 - pristine_git_object: 922667b0f7726824d0de4b18eac2ff86b271bccb + last_write_checksum: sha1:1c3ab1bda3fa9e2df33b47a49d5e9b9e2d82a701 + pristine_git_object: bb7c52c881ceadccdeb3590104e774f3d2ad94d7 src/mistralai/client/models/function.py: id: 32275a9d8fee last_write_checksum: sha1:c01c1ed54b3086859cde0dd3c3c466c78d8323ae @@ -5607,8 +5607,8 @@ trackedFiles: pristine_git_object: ffebdb82a1a80d1d086b919da9b33e2f090388c4 src/mistralai/client/models/workflowexecutionrequest.py: id: 806340497ed4 - last_write_checksum: sha1:43851e98d4c14ebdda88c5ab4412ae3a7a1d0002 - pristine_git_object: bf6a5fa0cddf979efb8ad32df77affac7f7156e8 + last_write_checksum: sha1:5270ee18d5eef0a52762ade3d207a8bbaa154f72 + pristine_git_object: 615276d30bf6131df5415a9d1d0476a0a3e16521 src/mistralai/client/models/workflowexecutionresponse.py: id: 758786637be5 last_write_checksum: sha1:2544bf94e8d64a9bd33f37ff4737f320fcd84733 @@ -5759,8 +5759,8 @@ trackedFiles: pristine_git_object: ceb8de4fe3edfbd818f6002381c365ea8437ac2c src/mistralai/client/runs.py: id: 4297d58aeb21 - last_write_checksum: sha1:a93e99bb1a5e8ba9afbe9a5dd6869c1a5f45c7b8 - pristine_git_object: 3e875ba8927d9b2e1829bbaa2ebeeb006696509e + last_write_checksum: sha1:14f158d7f30b4e072c0499d61d337aad5758c8ee + pristine_git_object: 4a468f47f70929158e937f62e3462311bb43b181 src/mistralai/client/schedules.py: id: d3b4fe452390 last_write_checksum: sha1:74a1455c5ba17253d2e878f638b7314edca66e21 @@ -5827,8 +5827,8 @@ trackedFiles: pristine_git_object: 3edad8307ea0ef38e857596a3ec11023a4af287f src/mistralai/client/utils/metadata.py: id: d49d535ae52c - last_write_checksum: sha1:54d300a665d3d5eafcc778a795d79347479b8337 - pristine_git_object: d46ffa59952926b7b1a842b0db2475527eda87df + last_write_checksum: sha1:aa5a42fb2fc9dd6469532a633648e8f1a8dad9bf + pristine_git_object: 3850a6ffb6c990a784b1692cefc81de3d67f611a src/mistralai/client/utils/queryparams.py: id: bb77d4664844 last_write_checksum: sha1:d02ce5b2dcc26edb7c937d75b98b70c22a5af189 @@ -5843,12 +5843,12 @@ trackedFiles: pristine_git_object: bea1304150e77ca06185efb7db7798aaacd5e623 src/mistralai/client/utils/security.py: id: 1acb7c006265 - last_write_checksum: sha1:3981f6571daf28b3b553beb09a4ebeeeb6ceff14 - pristine_git_object: d8b9d8fe746babd0a87846812b1f4117d1a46de2 + last_write_checksum: sha1:9f176b3d22a80f5be7f22e1879ec33a3773cf765 + pristine_git_object: 77a4449d0b54ac5c43fa150ef38ed0406c5dff66 src/mistralai/client/utils/serializers.py: id: 53c57c7f29a8 - last_write_checksum: sha1:8a3a15cf273034261111f2559cacbb579e17cb1b - pristine_git_object: fbc2772dc4284775be92de6a086c1eade9376417 + last_write_checksum: sha1:cd2d92c815492970aa7bba28346ea0e434a4169b + pristine_git_object: 691957f486c9adf667b8fbedcf04abc043f7a724 src/mistralai/client/utils/unions.py: id: d23713342634 last_write_checksum: sha1:f814d757474f039199f501aa53cdfba97a8c6645 @@ -5875,8 +5875,8 @@ trackedFiles: pristine_git_object: e2d41c70ecaeec1439ff9398b79de2af7eca54f1 src/mistralai/client/workflows.py: id: e2a0381191f6 - last_write_checksum: sha1:df0555b350409d103ca9715c69fab2e061d7ea41 - pristine_git_object: aae12f774608d18baf1bf5ccedd1a39363c0c29d + last_write_checksum: sha1:d6aa91e25c073221f704cd52df0b500ea33fb09b + pristine_git_object: be6222e906b447d9f3e37a5a35c677825e2710e4 src/mistralai/client/workflows_events.py: id: 6d4f674ce8ef last_write_checksum: sha1:ee029cad739604429d7cff743f2a469cd3cd4076 @@ -8295,6 +8295,12 @@ examples: application/json: {"scheduler_url": "https://closed-passport.info/", "namespace": "", "tls": false} examplesVersion: 1.0.2 generatedTests: {} +releaseNotes: | + ## Python SDK Changes: + * `mistral.models.list()`: `response.data[].union(fine-tuned).job` **Changed** (Breaking ⚠️) + * `mistral.models.retrieve()`: `response.union(fine-tuned).job` **Changed** (Breaking ⚠️) + * `mistral.workflows.execute_workflow()`: `request.input` **Changed** (Breaking ⚠️) + * `mistral.workflows.execute_workflow_registration()`: `request.input` **Changed** (Breaking ⚠️) generatedFiles: - .gitattributes - .vscode/settings.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0c50d415..a408c9c4 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false python: - version: 2.2.0 + version: 2.2.1 additionalDependencies: dev: pytest: ^8.2.2 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index fff0c8c6..b65b28dd 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.754.0 +speakeasyVersion: 1.761.1 sources: mistral-azure-source: sourceNamespace: mistral-openapi-azure @@ -16,8 +16,8 @@ sources: - speakeasy-sdk-regen-1773084660 mistral-openapi: sourceNamespace: mistral-openapi - sourceRevisionDigest: sha256:8a9e51d8532d887897d3335b416422973f6d1adb687a88dc288bfb51e1fdacdf - sourceBlobDigest: sha256:ad19d950e5564f613ce71b9b0b98eadf76609f0ff96db0e083b20c8190c718e3 + sourceRevisionDigest: sha256:33b0a88a4ed60c13f13450859d491eb6ee8ff97224d70b89ec8b372cf06243f8 + sourceBlobDigest: sha256:67f2d1c77cbace813cfd1134b6b1f07d09b0dca9bed9a1802b70a497bab79dab tags: - latest targets: @@ -38,13 +38,13 @@ targets: mistralai-sdk: source: mistral-openapi sourceNamespace: mistral-openapi - sourceRevisionDigest: sha256:8a9e51d8532d887897d3335b416422973f6d1adb687a88dc288bfb51e1fdacdf - sourceBlobDigest: sha256:ad19d950e5564f613ce71b9b0b98eadf76609f0ff96db0e083b20c8190c718e3 + sourceRevisionDigest: sha256:33b0a88a4ed60c13f13450859d491eb6ee8ff97224d70b89ec8b372cf06243f8 + sourceBlobDigest: sha256:67f2d1c77cbace813cfd1134b6b1f07d09b0dca9bed9a1802b70a497bab79dab codeSamplesNamespace: mistral-openapi-code-samples - codeSamplesRevisionDigest: sha256:87ec31b36ce736c3f60cce2c11b8192bb5617b5ce9d881aadc0cf4a86563173c + codeSamplesRevisionDigest: sha256:6316b32d69e336644d96e1ba930d565d4e649b1608dd46401b4bceed6d1911ad workflow: workflowVersion: 1.0.0 - speakeasyVersion: 1.754.0 + speakeasyVersion: 1.761.1 sources: mistral-azure-source: inputs: diff --git a/RELEASES.md b/RELEASES.md index 852ddced..942b4a72 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -528,4 +528,14 @@ Based on: ### Generated - [python v2.2.0] . ### Releases -- [PyPI v2.2.0] https://pypi.org/project/mistralai/2.2.0 - . \ No newline at end of file +- [PyPI v2.2.0] https://pypi.org/project/mistralai/2.2.0 - . + +## 2026-04-02 14:14:02 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.761.1 (2.879.6) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v2.2.1] . +### Releases +- [PyPI v2.2.1] https://pypi.org/project/mistralai/2.2.1 - . \ No newline at end of file diff --git a/docs/models/filesapiroutesgetsignedurlrequest.md b/docs/models/filesapiroutesgetsignedurlrequest.md index dbe3c801..794f25f7 100644 --- a/docs/models/filesapiroutesgetsignedurlrequest.md +++ b/docs/models/filesapiroutesgetsignedurlrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | -| `file_id` | *str* | :heavy_check_mark: | N/A | -| `expiry` | *Optional[int]* | :heavy_minus_sign: | Number of hours before the url becomes invalid. Defaults to 24h | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `file_id` | *str* | :heavy_check_mark: | N/A | +| `expiry` | *Optional[int]* | :heavy_minus_sign: | Number of hours before the URL becomes invalid. Defaults to 24h. Must be between 1h and 168h. | \ No newline at end of file diff --git a/docs/models/ftmodelcard.md b/docs/models/ftmodelcard.md index 0381dd81..f65ff6e8 100644 --- a/docs/models/ftmodelcard.md +++ b/docs/models/ftmodelcard.md @@ -20,6 +20,6 @@ Extra fields for fine-tuned models. | `deprecation_replacement_model` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `default_model_temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `type` | *Literal["fine-tuned"]* | :heavy_check_mark: | N/A | -| `job` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `job` | *str* | :heavy_check_mark: | N/A | | `root` | *str* | :heavy_check_mark: | N/A | | `archived` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/workflowexecutionrequest.md b/docs/models/workflowexecutionrequest.md index 553119b1..54f61ea3 100644 --- a/docs/models/workflowexecutionrequest.md +++ b/docs/models/workflowexecutionrequest.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `execution_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Allows you to specify a custom execution ID. If not provided, a random ID will be generated. | -| `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the workflow. This should be a dictionary that matches the workflow's input schema. | +| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema. | | `encoded_input` | [OptionalNullable[models.NetworkEncodedInput]](../models/networkencodedinput.md) | :heavy_minus_sign: | Encoded input to the workflow, used when payload encoding is enabled. | | `wait_for_result` | *Optional[bool]* | :heavy_minus_sign: | If true, wait for the workflow to complete and return the result directly. | | `timeout_seconds` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum time to wait for completion when wait_for_result is true. | diff --git a/docs/sdks/files/README.md b/docs/sdks/files/README.md index bceebdf8..d0e88f2e 100644 --- a/docs/sdks/files/README.md +++ b/docs/sdks/files/README.md @@ -255,11 +255,11 @@ with Mistral( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `file_id` | *str* | :heavy_check_mark: | N/A | -| `expiry` | *Optional[int]* | :heavy_minus_sign: | Number of hours before the url becomes invalid. Defaults to 24h | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `file_id` | *str* | :heavy_check_mark: | N/A | +| `expiry` | *Optional[int]* | :heavy_minus_sign: | Number of hours before the URL becomes invalid. Defaults to 24h. Must be between 1h and 168h. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/workflows/README.md b/docs/sdks/workflows/README.md index e65383ca..324c46b1 100644 --- a/docs/sdks/workflows/README.md +++ b/docs/sdks/workflows/README.md @@ -141,7 +141,7 @@ with Mistral( | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `workflow_identifier` | *str* | :heavy_check_mark: | N/A | | `execution_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Allows you to specify a custom execution ID. If not provided, a random ID will be generated. | -| `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the workflow. This should be a dictionary that matches the workflow's input schema. | +| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema. | | `encoded_input` | [OptionalNullable[models.NetworkEncodedInput]](../../models/networkencodedinput.md) | :heavy_minus_sign: | Encoded input to the workflow, used when payload encoding is enabled. | | `wait_for_result` | *Optional[bool]* | :heavy_minus_sign: | If true, wait for the workflow to complete and return the result directly. | | `timeout_seconds` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum time to wait for completion when wait_for_result is true. | @@ -192,7 +192,7 @@ with Mistral( | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `workflow_registration_id` | *str* | :heavy_check_mark: | N/A | | `execution_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Allows you to specify a custom execution ID. If not provided, a random ID will be generated. | -| `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the workflow. This should be a dictionary that matches the workflow's input schema. | +| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema. | | `encoded_input` | [OptionalNullable[models.NetworkEncodedInput]](../../models/networkencodedinput.md) | :heavy_minus_sign: | Encoded input to the workflow, used when payload encoding is enabled. | | `wait_for_result` | *Optional[bool]* | :heavy_minus_sign: | If true, wait for the workflow to complete and return the result directly. | | `timeout_seconds` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum time to wait for completion when wait_for_result is true. | diff --git a/pyproject.toml b/pyproject.toml index 54d2b372..83af6e8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mistralai" -version = "2.2.0" +version = "2.2.1" description = "Python Client SDK for the Mistral AI API." authors = [{ name = "Mistral" }] requires-python = ">=3.10" diff --git a/src/mistralai/client/_version.py b/src/mistralai/client/_version.py index 0473419e..a8c34e6d 100644 --- a/src/mistralai/client/_version.py +++ b/src/mistralai/client/_version.py @@ -4,10 +4,10 @@ import importlib.metadata __title__: str = "mistralai" -__version__: str = "2.2.0" +__version__: str = "2.2.1" __openapi_doc_version__: str = "1.0.0" -__gen_version__: str = "2.862.0" -__user_agent__: str = "speakeasy-sdk/python 2.2.0 2.862.0 1.0.0 mistralai" +__gen_version__: str = "2.879.6" +__user_agent__: str = "speakeasy-sdk/python 2.2.1 2.879.6 1.0.0 mistralai" try: if __package__ is not None: diff --git a/src/mistralai/client/basesdk.py b/src/mistralai/client/basesdk.py index a976121b..4a27eb2f 100644 --- a/src/mistralai/client/basesdk.py +++ b/src/mistralai/client/basesdk.py @@ -67,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( @@ -88,6 +89,7 @@ def _build_request_async( url_override, http_headers, allow_empty_value, + allowed_fields, ) def _build_request( @@ -111,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( @@ -132,6 +135,7 @@ def _build_request( url_override, http_headers, allow_empty_value, + allowed_fields, ) def _build_request_with_client( @@ -156,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 = {} @@ -189,7 +194,9 @@ def _build_request_with_client( security = security() security = utils.get_security_from_env(security, models.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} @@ -226,7 +233,7 @@ 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( @@ -246,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, @@ -321,6 +330,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, diff --git a/src/mistralai/client/files.py b/src/mistralai/client/files.py index a843cb7b..453c97c7 100644 --- a/src/mistralai/client/files.py +++ b/src/mistralai/client/files.py @@ -965,7 +965,7 @@ def get_signed_url( r"""Get Signed Url :param file_id: - :param expiry: Number of hours before the url becomes invalid. Defaults to 24h + :param expiry: Number of hours before the URL becomes invalid. Defaults to 24h. Must be between 1h and 168h. :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 @@ -1050,7 +1050,7 @@ async def get_signed_url_async( r"""Get Signed Url :param file_id: - :param expiry: Number of hours before the url becomes invalid. Defaults to 24h + :param expiry: Number of hours before the URL becomes invalid. Defaults to 24h. Must be between 1h and 168h. :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 diff --git a/src/mistralai/client/models/files_api_routes_get_signed_urlop.py b/src/mistralai/client/models/files_api_routes_get_signed_urlop.py index 326dd1d3..c381244b 100644 --- a/src/mistralai/client/models/files_api_routes_get_signed_urlop.py +++ b/src/mistralai/client/models/files_api_routes_get_signed_urlop.py @@ -12,7 +12,7 @@ class FilesAPIRoutesGetSignedURLRequestTypedDict(TypedDict): file_id: str expiry: NotRequired[int] - r"""Number of hours before the url becomes invalid. Defaults to 24h""" + r"""Number of hours before the URL becomes invalid. Defaults to 24h. Must be between 1h and 168h.""" class FilesAPIRoutesGetSignedURLRequest(BaseModel): @@ -24,7 +24,7 @@ class FilesAPIRoutesGetSignedURLRequest(BaseModel): Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = 24 - r"""Number of hours before the url becomes invalid. Defaults to 24h""" + r"""Number of hours before the URL becomes invalid. Defaults to 24h. Must be between 1h and 168h.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/mistralai/client/models/ftmodelcard.py b/src/mistralai/client/models/ftmodelcard.py index 922667b0..bb7c52c8 100644 --- a/src/mistralai/client/models/ftmodelcard.py +++ b/src/mistralai/client/models/ftmodelcard.py @@ -27,6 +27,7 @@ class FTModelCardTypedDict(TypedDict): r"""This is populated by Harmattan, but some fields have a name that we don't want to expose in the API. """ + job: str root: str object: NotRequired[str] created: NotRequired[int] @@ -39,7 +40,6 @@ class FTModelCardTypedDict(TypedDict): deprecation_replacement_model: NotRequired[Nullable[str]] default_model_temperature: NotRequired[Nullable[float]] type: Literal["fine-tuned"] - job: NotRequired[Nullable[str]] archived: NotRequired[bool] @@ -53,6 +53,8 @@ class FTModelCard(BaseModel): that we don't want to expose in the API. """ + job: str + root: str object: Optional[str] = "model" @@ -80,8 +82,6 @@ class FTModelCard(BaseModel): pydantic.Field(alias="type"), ] = "fine-tuned" - job: OptionalNullable[str] = UNSET - archived: Optional[bool] = False @model_serializer(mode="wrap") @@ -98,7 +98,6 @@ def serialize_model(self, handler): "deprecation", "deprecation_replacement_model", "default_model_temperature", - "job", "archived", ] ) @@ -109,7 +108,6 @@ def serialize_model(self, handler): "deprecation", "deprecation_replacement_model", "default_model_temperature", - "job", ] ) serialized = handler(self) diff --git a/src/mistralai/client/models/workflowexecutionrequest.py b/src/mistralai/client/models/workflowexecutionrequest.py index bf6a5fa0..615276d3 100644 --- a/src/mistralai/client/models/workflowexecutionrequest.py +++ b/src/mistralai/client/models/workflowexecutionrequest.py @@ -19,8 +19,8 @@ class WorkflowExecutionRequestTypedDict(TypedDict): execution_id: NotRequired[Nullable[str]] r"""Allows you to specify a custom execution ID. If not provided, a random ID will be generated.""" - input: NotRequired[Nullable[Dict[str, Any]]] - r"""The input to the workflow. This should be a dictionary that matches the workflow's input schema.""" + input: NotRequired[Nullable[Any]] + r"""The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema.""" encoded_input: NotRequired[Nullable[NetworkEncodedInputTypedDict]] r"""Encoded input to the workflow, used when payload encoding is enabled.""" wait_for_result: NotRequired[bool] @@ -38,8 +38,8 @@ class WorkflowExecutionRequest(BaseModel): execution_id: OptionalNullable[str] = UNSET r"""Allows you to specify a custom execution ID. If not provided, a random ID will be generated.""" - input: OptionalNullable[Dict[str, Any]] = UNSET - r"""The input to the workflow. This should be a dictionary that matches the workflow's input schema.""" + input: OptionalNullable[Any] = UNSET + r"""The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema.""" encoded_input: OptionalNullable[NetworkEncodedInput] = UNSET r"""Encoded input to the workflow, used when payload encoding is enabled.""" diff --git a/src/mistralai/client/runs.py b/src/mistralai/client/runs.py index 3e875ba8..4a468f47 100644 --- a/src/mistralai/client/runs.py +++ b/src/mistralai/client/runs.py @@ -114,7 +114,7 @@ def next_func() -> Optional[models.ListRunsV1WorkflowsRunsGetResponse]: results = JSONPath("$.executions").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit = request.page_size if not request.page_size is None else 50 + limit = request.page_size if isinstance(request.page_size, int) else 50 if len(results[0]) < limit: return None @@ -125,6 +125,9 @@ def next_func() -> Optional[models.ListRunsV1WorkflowsRunsGetResponse]: page_size=page_size, next_page_token=next_cursor, retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, ) response_data: Any = None @@ -256,7 +259,7 @@ async def empty_result(): results = JSONPath("$.executions").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit = request.page_size if not request.page_size is None else 50 + limit = request.page_size if isinstance(request.page_size, int) else 50 if len(results[0]) < limit: return empty_result() @@ -267,6 +270,9 @@ async def empty_result(): page_size=page_size, next_page_token=next_cursor, retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, ) response_data: Any = None diff --git a/src/mistralai/client/utils/metadata.py b/src/mistralai/client/utils/metadata.py index d46ffa59..3850a6ff 100644 --- a/src/mistralai/client/utils/metadata.py +++ b/src/mistralai/client/utils/metadata.py @@ -16,6 +16,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/src/mistralai/client/utils/security.py b/src/mistralai/client/utils/security.py index d8b9d8fe..77a4449d 100644 --- a/src/mistralai/client/utils/security.py +++ b/src/mistralai/client/utils/security.py @@ -20,7 +20,9 @@ import os -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]] = {} @@ -31,7 +33,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) @@ -53,6 +62,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 @@ -78,15 +90,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/src/mistralai/client/utils/serializers.py b/src/mistralai/client/utils/serializers.py index fbc2772d..691957f4 100644 --- a/src/mistralai/client/utils/serializers.py +++ b/src/mistralai/client/utils/serializers.py @@ -18,8 +18,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 @@ -47,8 +46,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 @@ -76,8 +74,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 @@ -105,8 +102,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/src/mistralai/client/workflows.py b/src/mistralai/client/workflows.py index aae12f77..32180c71 100644 --- a/src/mistralai/client/workflows.py +++ b/src/mistralai/client/workflows.py @@ -21,6 +21,7 @@ # region imports import asyncio +from pydantic import BaseModel import time # endregion imports @@ -58,7 +59,7 @@ def _init_sdks(self): def execute_workflow_and_wait( self, workflow_identifier: str, - input: OptionalNullable[Dict[str, Any]] = UNSET, + input: OptionalNullable[Dict[str, Any] | BaseModel] = UNSET, execution_id: OptionalNullable[str] = UNSET, deployment_name: OptionalNullable[str] = UNSET, custom_tracing_attributes: OptionalNullable[Dict[str, str]] = UNSET, @@ -71,7 +72,7 @@ def execute_workflow_and_wait( Args: workflow_identifier: The workflow name or ID. - input: Input parameters for the workflow + input: The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema. execution_id: Optional custom execution ID deployment_name: Name of the deployment to route this execution to custom_tracing_attributes: Custom tracing attributes @@ -155,7 +156,7 @@ def wait_for_workflow_completion( async def execute_workflow_and_wait_async( self, workflow_identifier: str, - input: OptionalNullable[Dict[str, Any]] = UNSET, + input: OptionalNullable[Dict[str, Any] | BaseModel] = UNSET, execution_id: OptionalNullable[str] = UNSET, deployment_name: OptionalNullable[str] = UNSET, custom_tracing_attributes: OptionalNullable[Dict[str, str]] = UNSET, @@ -168,7 +169,7 @@ async def execute_workflow_and_wait_async( Args: workflow_identifier: The workflow name or ID. - input: Input parameters for the workflow + input: The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema. execution_id: Optional custom execution ID deployment_name: Name of the deployment to route this execution to custom_tracing_attributes: Custom tracing attributes @@ -354,7 +355,7 @@ def next_func() -> Optional[models.GetWorkflowsV1WorkflowsGetResponse]: results = JSONPath("$.workflows").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit = request.limit if not request.limit is None else 50 + limit = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit: return None @@ -366,6 +367,9 @@ def next_func() -> Optional[models.GetWorkflowsV1WorkflowsGetResponse]: cursor=next_cursor, limit=limit, retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, ) response_data: Any = None @@ -493,7 +497,7 @@ async def empty_result(): results = JSONPath("$.workflows").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit = request.limit if not request.limit is None else 50 + limit = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit: return empty_result() @@ -505,6 +509,9 @@ async def empty_result(): cursor=next_cursor, limit=limit, retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, ) response_data: Any = None @@ -766,7 +773,7 @@ def execute_workflow( *, workflow_identifier: str, execution_id: OptionalNullable[str] = UNSET, - input: OptionalNullable[Dict[str, Any]] = UNSET, + input: OptionalNullable[Any] = UNSET, encoded_input: OptionalNullable[ Union[models.NetworkEncodedInput, models.NetworkEncodedInputTypedDict] ] = UNSET, @@ -784,7 +791,7 @@ def execute_workflow( :param workflow_identifier: :param execution_id: Allows you to specify a custom execution ID. If not provided, a random ID will be generated. - :param input: The input to the workflow. This should be a dictionary that matches the workflow's input schema. + :param input: The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema. :param encoded_input: Encoded input to the workflow, used when payload encoding is enabled. :param wait_for_result: If true, wait for the workflow to complete and return the result directly. :param timeout_seconds: Maximum time to wait for completion when wait_for_result is true. @@ -894,7 +901,7 @@ async def execute_workflow_async( *, workflow_identifier: str, execution_id: OptionalNullable[str] = UNSET, - input: OptionalNullable[Dict[str, Any]] = UNSET, + input: OptionalNullable[Any] = UNSET, encoded_input: OptionalNullable[ Union[models.NetworkEncodedInput, models.NetworkEncodedInputTypedDict] ] = UNSET, @@ -912,7 +919,7 @@ async def execute_workflow_async( :param workflow_identifier: :param execution_id: Allows you to specify a custom execution ID. If not provided, a random ID will be generated. - :param input: The input to the workflow. This should be a dictionary that matches the workflow's input schema. + :param input: The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema. :param encoded_input: Encoded input to the workflow, used when payload encoding is enabled. :param wait_for_result: If true, wait for the workflow to complete and return the result directly. :param timeout_seconds: Maximum time to wait for completion when wait_for_result is true. @@ -1025,7 +1032,7 @@ def execute_workflow_registration( *, workflow_registration_id: str, execution_id: OptionalNullable[str] = UNSET, - input: OptionalNullable[Dict[str, Any]] = UNSET, + input: OptionalNullable[Any] = UNSET, encoded_input: OptionalNullable[ Union[models.NetworkEncodedInput, models.NetworkEncodedInputTypedDict] ] = UNSET, @@ -1043,7 +1050,7 @@ def execute_workflow_registration( :param workflow_registration_id: :param execution_id: Allows you to specify a custom execution ID. If not provided, a random ID will be generated. - :param input: The input to the workflow. This should be a dictionary that matches the workflow's input schema. + :param input: The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema. :param encoded_input: Encoded input to the workflow, used when payload encoding is enabled. :param wait_for_result: If true, wait for the workflow to complete and return the result directly. :param timeout_seconds: Maximum time to wait for completion when wait_for_result is true. @@ -1156,7 +1163,7 @@ async def execute_workflow_registration_async( *, workflow_registration_id: str, execution_id: OptionalNullable[str] = UNSET, - input: OptionalNullable[Dict[str, Any]] = UNSET, + input: OptionalNullable[Any] = UNSET, encoded_input: OptionalNullable[ Union[models.NetworkEncodedInput, models.NetworkEncodedInputTypedDict] ] = UNSET, @@ -1174,7 +1181,7 @@ async def execute_workflow_registration_async( :param workflow_registration_id: :param execution_id: Allows you to specify a custom execution ID. If not provided, a random ID will be generated. - :param input: The input to the workflow. This should be a dictionary that matches the workflow's input schema. + :param input: The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema. :param encoded_input: Encoded input to the workflow, used when payload encoding is enabled. :param wait_for_result: If true, wait for the workflow to complete and return the result directly. :param timeout_seconds: Maximum time to wait for completion when wait_for_result is true. diff --git a/uv.lock b/uv.lock index ae8cabb5..8b5c0cfe 100644 --- a/uv.lock +++ b/uv.lock @@ -560,7 +560,7 @@ wheels = [ [[package]] name = "mistralai" -version = "2.2.0" +version = "2.2.1" source = { editable = "." } dependencies = [ { name = "eval-type-backport" },