Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 9 additions & 61 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ management:
docVersion: 1.0.0
speakeasyVersion: 1.761.1
generationVersion: 2.879.6
releaseVersion: 2.3.2
configChecksum: c93d1019e9a3a1a37a0c7d7bf48aa381
releaseVersion: 2.3.3
configChecksum: 5eb51d5a89615cea944d6092f8237540
repoURL: https://github.com/mistralai/client-python.git
installationURL: https://github.com/mistralai/client-python.git
published: true
persistentEdits:
generation_id: 87bc3ff0-98ad-4b9d-9b68-f8eb30116ac5
pristine_commit_hash: 8b68490f4bb48a091c4b0e16a738af9e7ff83490
pristine_tree_hash: b87817d13d249439af787f92e305f67aeaa2ef27
generation_id: 652bedff-cd51-4074-b8a3-7276c726b989
pristine_commit_hash: a61841da472bcf174c6c1b46c0ce089d4a42add1
pristine_tree_hash: dbc75069ca4311b0265944efc6bab6ff37764e8e
features:
python:
acceptHeaders: 3.0.0
Expand Down Expand Up @@ -61,7 +61,6 @@ trackedFiles:
id: 89aa447020cd
last_write_checksum: sha1:f84632c81029fcdda8c3b0c768d02b836fc80526
pristine_git_object: 8d79f0abb72526f1fb34a4c03e5bba612c6ba2ae
deleted: true
USAGE.md:
id: 3aed33ce6e6f
last_write_checksum: sha1:d172deb3ee1630f16b279de22aec1f8f68d7565f
Expand Down Expand Up @@ -3228,8 +3227,8 @@ trackedFiles:
pristine_git_object: 036d44b8cfc51599873bd5c401a6aed30450536c
src/mistralai/client/_version.py:
id: cc807b30de19
last_write_checksum: sha1:dca0e0738b2373b2584935344961ec24f471cfc3
pristine_git_object: aa5d0670adfd0d8f55285e170ea83e032364276f
last_write_checksum: sha1:43dbe31ce3ff191a049d5afa94284215658819b6
pristine_git_object: 68f6bbaad876c281017c0f91df5904ff64688cac
src/mistralai/client/accesses.py:
id: 76fc53bfcf59
last_write_checksum: sha1:0c417e7a0bf9dfc523dbabee816b73d7a4d52f1d
Expand Down Expand Up @@ -3284,8 +3283,8 @@ trackedFiles:
pristine_git_object: fc9d6319b4d321e21a7b7d73515f9d13b9ac8a2a
src/mistralai/client/conversations.py:
id: 40692a878064
last_write_checksum: sha1:3e52c3d1441c9f276ff03bd6ed6fd74b6752ab1a
pristine_git_object: 1e48d6c421cc6428c247d0643df3324f866be4e0
last_write_checksum: sha1:0cd8d8edb4a44e3a2ddccae2e8253edbffc1c236
pristine_git_object: cf4a05e5a71219a4614a367c8cc810994a38b479
src/mistralai/client/datasets.py:
id: e5a6ae2a2d85
last_write_checksum: sha1:52f8dc6df7430622882b02e8d01d8da02e4e998f
Expand Down Expand Up @@ -8312,57 +8311,6 @@ examples:
application/json: {"scheduler_url": "https://closed-passport.info/", "namespace": "<value>", "tls": false}
examplesVersion: 1.0.2
generatedTests: {}
releaseNotes: |
## Python SDK Changes:
* `mistral.chat.complete()`: `response.choices[].messages[]` **Changed** (Breaking ⚠️)
* `mistral.agents.complete()`: `response.choices[].messages[]` **Changed** (Breaking ⚠️)
* `mistral.fim.complete()`: `response.choices[].messages[]` **Changed** (Breaking ⚠️)
* `mistral.beta.observability.datasets.delete()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.campaigns.delete()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.chat_completion_events.judge()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.chat_completion_events.fields.list()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.chat_completion_events.fields.fetch_options()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.chat_completion_events.fields.fetch_option_counts()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.judges.create()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.judges.list()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.judges.fetch()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.judges.delete()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.judges.update()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.judges.judge_conversation()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.campaigns.create()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.campaigns.list()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.campaigns.fetch()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.list_records()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.campaigns.fetch_status()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.campaigns.list_events()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.create()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.list()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.fetch()`: `error.detail.error_code` **Changed**
* `mistral.beta.libraries.list()`: `request` **Changed**
* `mistral.beta.observability.chat_completion_events.fetch_similar_events()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.update()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.records.update_properties()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.import_from_campaign()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.import_from_explorer()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.import_from_file()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.import_from_playground()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.import_from_dataset_records()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.export_to_jsonl()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.fetch_task()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.list_tasks()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.records.fetch()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.records.delete()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.records.bulk_delete()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.records.judge()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.records.update_payload()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.datasets.create_record()`: `error.detail.error_code` **Changed**
* `mistral.beta.observability.chat_completion_events.fetch()`: `error.detail.error_code` **Changed**
* `mistral.chat.stream()`: `response.[].data.choices[].delta` **Changed**
* `mistral.beta.observability.chat_completion_events.search_ids()`: `error.detail.error_code` **Changed**
* `mistral.fim.stream()`: `response.[].data.choices[].delta` **Changed**
* `mistral.beta.observability.chat_completion_events.search()`: `error.detail.error_code` **Changed**
* `mistral.agents.stream()`: `response.[].data.choices[].delta` **Changed**
* `mistral.workflows.deployments.get_deployment()`: `response.workers[].is_active` **Added**
generatedFiles:
- .gitattributes
- .vscode/settings.json
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ generation:
generateNewTests: false
skipResponseBodyAssertions: false
python:
version: 2.3.2
version: 2.3.3
additionalDependencies:
dev:
pytest: ^8.2.2
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ targets:
sourceRevisionDigest: sha256:5a5b1104accc69fa8fca26e9abd7e089535bbffd20f667013984cbe9e9cf819d
sourceBlobDigest: sha256:3f88e405b674dc0f964605664fc15629b119a4481b08a5c8ac0e79dddcb19f91
codeSamplesNamespace: mistral-openapi-code-samples
codeSamplesRevisionDigest: sha256:eca5f8b43169d558d70aa5eda99c74bd6853a4e08ee024de57b42ef1f07dce50
codeSamplesRevisionDigest: sha256:2c11518813badf11fa378b003d8d2964f0e6c5e2cbb6af6814dbb9c0de42bfdf
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.761.1
Expand Down
3 changes: 3 additions & 0 deletions examples/mistral/chat/function_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def retrieve_payment_date(data: dict[str, list[Any]], transaction_id: str) -> st
]

response = client.chat.complete(model=model, messages=messages, tools=tools, temperature=0)
assert response.choices[0].message is not None

assert response.choices[0].message is not None
print(response.choices[0].message.content)
Expand All @@ -102,6 +103,7 @@ def retrieve_payment_date(data: dict[str, list[Any]], transaction_id: str) -> st
messages.append(UserMessage(content="My transaction ID is T1001."))

response = client.chat.complete(model=model, messages=messages, tools=tools, temperature=0)
assert response.choices[0].message is not None

assert response.choices[0].message is not None
tool_calls = response.choices[0].message.tool_calls
Expand Down Expand Up @@ -131,6 +133,7 @@ def retrieve_payment_date(data: dict[str, list[Any]], transaction_id: str) -> st
print(messages)

response = client.chat.complete(model=model, messages=messages, tools=tools, temperature=0)
assert response.choices[0].message is not None

assert response.choices[0].message is not None
print(f"{response.choices[0].message.content}")
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ realtime = [
"websockets >=13.0",
]

workflow_payload_offloading_azure = [
"azure-storage-blob[aio]>=12.28.0,<13.0.0",
]
workflow_payload_offloading_gcs = [
"gcloud-aio-storage>=9.3.0,<10.0.0",
"opentelemetry-instrumentation-aiohttp-client>=0.60b1,<0.61", # For observability
]
workflow_payload_offloading_s3 = [
"aioboto3>=12.4.0,<13.0.0",
]

workflow_payload_offloading = [
"mistralai[workflow_payload_offloading_azure]",
"mistralai[workflow_payload_offloading_gcs]",
"mistralai[workflow_payload_offloading_s3]",
]
workflow_payload_encryption = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where should we document those optional dependencies ? I'm thinking we should add documentation about payload offloading and encryption in https://github.com/mistralai/platform-docs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we'll document it once fully finished and available

"cryptography>=41.0.0,<47.0.0",
]


[project.urls]
Repository = "https://github.com/mistralai/client-python.git"

Expand Down
4 changes: 4 additions & 0 deletions src/mistralai/client/_hooks/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .traceparent import TraceparentInjectionHook
from .tracing import TracingHook
from .types import Hooks
from .workflow_encoding_hook import WorkflowEncodingHook

# This file is only ever generated once on the first generation and then is free to be modified.
# Any hooks you wish to add should be registered in the init_hooks function. Feel free to define them
Expand All @@ -16,9 +17,12 @@ def init_hooks(hooks: Hooks):
Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance
"""
tracing_hook = TracingHook()
workflow_encoding_hook = WorkflowEncodingHook()
hooks.register_before_request_hook(CustomUserAgentHook())
hooks.register_before_request_hook(TraceparentInjectionHook())
hooks.register_after_success_hook(DeprecationWarningHook())
hooks.register_after_success_hook(tracing_hook)
hooks.register_before_request_hook(tracing_hook)
hooks.register_after_error_hook(tracing_hook)
hooks.register_before_request_hook(workflow_encoding_hook)
hooks.register_after_success_hook(workflow_encoding_hook)
Loading
Loading