Skip to content
Merged
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.6
configChecksum: 95068806fbe0942ab6561ca540458fc9
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: 6d0c183b-fffd-4345-bc10-c73b69c91605
pristine_commit_hash: 731e3f6f8d8451435e03d69da2dbe80bb13412f6
pristine_tree_hash: df3f3821a4a083ea62b654833f022a2df2c149ac
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:2d58e5f157ee7ec7ba8a5bfc2726bcb56555d3b6
pristine_git_object: 0e124f2202191d3a222b9a2abe6a91ee036adc01
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:44b01585b9cbca3c9696c40b817529e76d6e7c32
pristine_git_object: a9887a9a95308cad10cbaa2593b8552159cb0dca
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.6
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:3cdb686b793df49b7b8b8ad1f8ea3bfda1ff762c3b130004d9d959024a40ae7b
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.761.1
Expand Down
2 changes: 1 addition & 1 deletion examples/fixtures/ft_training_file.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
{"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "What is the smallest country in the world?"}, {"role": "assistant", "content": "Vatican City. Smaller than your average theme park."}]}
{"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "What language has the most native speakers?"}, {"role": "assistant", "content": "Mandarin Chinese. Because it's not all about English, you know."}]}
{"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "What is the hardest natural substance on Earth?"}, {"role": "assistant", "content": "Diamond. Not your average rock."}]}
{"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "What element does 'O' represent on the periodic table?"}, {"role": "assistant", "content": "Oxygen. The stuff you breathe. Hopefully, this isn't news."}]}
{"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "What element does 'O' represent on the periodic table?"}, {"role": "assistant", "content": "Oxygen. The stuff you breathe. Hopefully this isn't news."}]}
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}")
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ 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",
]
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 = [
Comment thread
anth2o marked this conversation as resolved.
"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()
Comment thread
mistralai-nfau marked this conversation as resolved.
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