Skip to content
Draft
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
50 changes: 39 additions & 11 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.1
configChecksum: cfc814ae7d34226a7aa57f42b133b76e
releaseVersion: 2.3.0
configChecksum: 23f8bedccc0eae8d219fc0f204f0d860
repoURL: https://github.com/mistralai/client-python.git
installationURL: https://github.com/mistralai/client-python.git
published: true
persistentEdits:
generation_id: da4d1522-be42-4fed-8e47-6a1a86083dd9
pristine_commit_hash: 0af2a650df50ba629dd4358d9ecd97a7a865b28a
pristine_tree_hash: 21954a44b6b1fcad3bcbbb7ec53a7846e7141605
generation_id: fe142125-1872-4182-81ba-bc06f9c54162
pristine_commit_hash: 35add5123f1208507e0bfe5ca855b6de0b6b252b
pristine_tree_hash: 31fb38dc60d808cfb99e3bd8405df845ece4b4b2
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 @@ -2666,6 +2665,11 @@ trackedFiles:
id: 5e2ddf7b3863
last_write_checksum: sha1:3aa9c92e9872fe75032e53e311bf050dbab51e98
pristine_git_object: 2a64e130e526f8d99e623e7cbc0c7add82d8fab0
docs/models/tooltypes.md:
id: adb50fe63ea2
last_write_checksum: sha1:d0d67b717773cbc99add6716e0287e64f04d24df
pristine_git_object: 345ee7dc07187e1ee06726ec63ffb75e1a34e736
deleted: true
docs/models/trainingfile.md:
id: 4039958e8930
last_write_checksum: sha1:d02543c2d1446e56501f2ac358a09669b0077648
Expand Down Expand Up @@ -2874,6 +2878,11 @@ trackedFiles:
id: fc4df52fb9b5
last_write_checksum: sha1:72636dc7ae74264bb5158d284ef6f83da5290b27
pristine_git_object: 4ca7333c412ad819e3e02c61debe402e3f9b0af9
docs/models/workerinfo.md:
id: f8e56340a1d8
last_write_checksum: sha1:29c6d1ac23a55a0a8ecb108833c516332d358b11
pristine_git_object: 997f62ab0242d0017871a434ffbfbc2c58c69294
deleted: true
docs/models/workflow.md:
id: a782201b7327
last_write_checksum: sha1:0a6dbea734dc94626fb53ab37c619fef48b9db63
Expand Down Expand Up @@ -3194,6 +3203,11 @@ trackedFiles:
id: 4f1a657c8f68
last_write_checksum: sha1:8ddfebe91ff50ea863d4c0bd85c75458a482667e
pristine_git_object: 3b4d135f39bdfc3237c36c03367952eae54bdd48
docs/sdks/workers/README.md:
id: aaba95bc3191
last_write_checksum: sha1:d940b7a4fc0866c94714f1e2a994cf08f1f83b58
pristine_git_object: 5e2380d1d15afd204e20d0a16adc84f30e91e041
deleted: true
docs/sdks/workflows/README.md:
id: 80c76ce944c0
last_write_checksum: sha1:af6d1ec6698a8d58a743d67e897910038bed299a
Expand Down Expand Up @@ -3228,8 +3242,8 @@ trackedFiles:
pristine_git_object: 036d44b8cfc51599873bd5c401a6aed30450536c
src/mistralai/client/_version.py:
id: cc807b30de19
last_write_checksum: sha1:9a1feeb59a26a1eef191112013191e9f32399ef6
pristine_git_object: aa94ac8d12a7009a1cd3a1c33379fe4b341e71c2
last_write_checksum: sha1:421e56bc3992cac6dd6e90992f219ac2a798fea0
pristine_git_object: 0a44f4d847ea627a02c57dd61fb3f5c691327131
src/mistralai/client/accesses.py:
id: 76fc53bfcf59
last_write_checksum: sha1:0c417e7a0bf9dfc523dbabee816b73d7a4d52f1d
Expand Down Expand Up @@ -5386,6 +5400,11 @@ trackedFiles:
id: cbe8c44aee50
last_write_checksum: sha1:53949106f192944a13a8fcbeb37b3d08478b7bbc
pristine_git_object: 1a7781fc2c1001002785d512ed7909ce91a9129f
src/mistralai/client/models/tooltypes.py:
id: 86c3b54272fd
last_write_checksum: sha1:e90c15c1e645a5f207af0c7ac728cb0a521c6706
pristine_git_object: e601c1967c42ef8d0c2eea98bc5c0ca722cde066
deleted: true
src/mistralai/client/models/trainingfile.py:
id: 2edf9bce227d
last_write_checksum: sha1:f72468d666e903a966c12273be5a64048dcd59a0
Expand Down Expand Up @@ -5566,6 +5585,11 @@ trackedFiles:
id: 26b0903423e5
last_write_checksum: sha1:e486f50095cc7540ce828fff7571c6aa6748bf2f
pristine_git_object: f82b6ec1c89cae83ea21d9bae12a1984679262ae
src/mistralai/client/models/workerinfo.py:
id: 0c231087534e
last_write_checksum: sha1:0d9e4e56c7a4c570ccf49bcdc835b33f7500629b
pristine_git_object: 65edcec61125e3276bddabf424ec289667b3b671
deleted: true
src/mistralai/client/models/workflow.py:
id: 1548cd73984e
last_write_checksum: sha1:14e1db57af8784d77633d7dc1d22198f2377909b
Expand Down Expand Up @@ -5788,8 +5812,8 @@ trackedFiles:
pristine_git_object: d036900982e6db67d9d3f79f4e906541a1af0179
src/mistralai/client/sdk.py:
id: 48edbcb38d7e
last_write_checksum: sha1:a606046063cd946633918efa1662846c987c9b7e
pristine_git_object: 03338f46bd3d32f1770ed9b6e4d30f9d707867df
last_write_checksum: sha1:92a9a2ed0c76f0d2a94ff6199148340039af33d5
pristine_git_object: b06724d8f1d9111d5aa9beebe9f3d89a798c3e1c
src/mistralai/client/sdkconfiguration.py:
id: b7dd68a0235e
last_write_checksum: sha1:c6944f12c6fdc992d43db943b24c8c90854cde5e
Expand Down Expand Up @@ -5890,6 +5914,11 @@ trackedFiles:
id: ab76b1377d79
last_write_checksum: sha1:c46a418a865955ab8b72d7d2584ba9b758f75165
pristine_git_object: c4f1a71e1da1cb4ebda3ef4fb69cbbe98370d2ae
src/mistralai/client/workers.py:
id: 54a46aba8359
last_write_checksum: sha1:009ae7cbfc6ff8eb8bf29a6ccca93192ef643416
pristine_git_object: e2d41c70ecaeec1439ff9398b79de2af7eca54f1
deleted: true
src/mistralai/client/workflows.py:
id: e2a0381191f6
last_write_checksum: sha1:643f6debca318789195f27e7ccf9ff959d558f46
Expand Down Expand Up @@ -8312,7 +8341,6 @@ examples:
application/json: {"scheduler_url": "https://closed-passport.info/", "namespace": "<value>", "tls": false}
examplesVersion: 1.0.2
generatedTests: {}
releaseNotes: "## Python SDK Changes:\n* `mistral.ocr.process()`: \n * `request` **Changed** (Breaking ⚠️)\n * `response.pages[]` **Changed**\n* `mistral.chat.complete()`: `response.choices[]` **Changed**\n* `mistral.fim.complete()`: `response.choices[]` **Changed**\n* `mistral.agents.complete()`: `response.choices[]` **Changed**\n* `mistral.workflows.executions.stream()`: `request.event_source` **Changed**\n"
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.1
version: 2.3.0
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:4d69c08534e6e63c9fadb6f11344bf178f9dbf962fe0e319013c96096a0b5244
sourceBlobDigest: sha256:3cbfbae3d8be0884f2d588d3f9eec1b70c811931631a7ac240b7e7444cc081da
codeSamplesNamespace: mistral-openapi-code-samples
codeSamplesRevisionDigest: sha256:6afb787e5bd692753cade5670341d5cfd2307608034185cd6641ac02990b7104
codeSamplesRevisionDigest: sha256:0abd47e1cec85efd5b5949d51c5763e0622bb6dd1d7abab906f20318272977fa
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,13 +94,15 @@ 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

print(response.choices[0].message.content)

messages.append(AssistantMessage(content=response.choices[0].message.content))
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

tool_calls = response.choices[0].message.tool_calls
if not tool_calls:
Expand Down Expand Up @@ -129,5 +131,6 @@ 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

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 = [
"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