mistralai 0.5.5a50__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mistralai-0.5.5a50 → mistralai-1.0.0}/PKG-INFO +136 -67
- {mistralai-0.5.5a50 → mistralai-1.0.0}/README.md +135 -66
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/basesdk.py +42 -4
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/chat.py +15 -20
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/__init__.py +3 -3
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/assistantmessage.py +4 -9
- mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionchoice.py +22 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionrequest.py +7 -12
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionstreamrequest.py +7 -12
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/completionresponsestreamchoice.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/deltamessage.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/functioncall.py +9 -3
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/httpvalidationerror.py +1 -1
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/toolmessage.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/sdk.py +7 -2
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/sdkconfiguration.py +5 -4
- {mistralai-0.5.5a50/packages/mistralai_gcp/src/mistralai_gcp → mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure}/types/basemodel.py +10 -6
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/__init__.py +4 -0
- {mistralai-0.5.5a50/packages/mistralai_gcp/src/mistralai_gcp → mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure}/utils/eventstreaming.py +8 -9
- mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/logger.py +16 -0
- {mistralai-0.5.5a50/packages/mistralai_gcp/src/mistralai_gcp → mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure}/utils/retries.py +2 -2
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/basesdk.py +42 -4
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/chat.py +12 -17
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/fim.py +12 -13
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/__init__.py +3 -3
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/assistantmessage.py +4 -9
- mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionchoice.py +22 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionrequest.py +9 -14
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionstreamrequest.py +9 -14
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/completionresponsestreamchoice.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/deltamessage.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/fimcompletionrequest.py +11 -16
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/fimcompletionstreamrequest.py +11 -16
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/functioncall.py +9 -3
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/httpvalidationerror.py +1 -1
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/toolmessage.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/sdk.py +9 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/sdkconfiguration.py +5 -4
- {mistralai-0.5.5a50/src/mistralai → mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp}/types/basemodel.py +10 -6
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/__init__.py +4 -0
- {mistralai-0.5.5a50/src/mistralai → mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp}/utils/eventstreaming.py +8 -9
- mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/logger.py +16 -0
- {mistralai-0.5.5a50/src/mistralai → mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp}/utils/retries.py +2 -2
- {mistralai-0.5.5a50 → mistralai-1.0.0}/pyproject.toml +1 -1
- mistralai-1.0.0/src/mistralai/agents.py +434 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/basesdk.py +43 -6
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/chat.py +29 -34
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/client.py +1 -1
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/embeddings.py +4 -4
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/files.py +10 -10
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/fim.py +17 -18
- mistralai-1.0.0/src/mistralai/fine_tuning.py +16 -0
- mistralai-0.5.5a50/src/mistralai/fine_tuning.py → mistralai-1.0.0/src/mistralai/jobs.py +43 -54
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/__init__.py +6 -4
- mistralai-1.0.0/src/mistralai/models/agentscompletionrequest.py +96 -0
- mistralai-1.0.0/src/mistralai/models/agentscompletionstreamrequest.py +92 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/assistantmessage.py +4 -9
- mistralai-1.0.0/src/mistralai/models/chatcompletionchoice.py +22 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/chatcompletionrequest.py +11 -16
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/chatcompletionstreamrequest.py +11 -16
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/completionresponsestreamchoice.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/delete_model_v1_models_model_id_deleteop.py +2 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/deltamessage.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/detailedjobout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/embeddingrequest.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/eventout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/fileschema.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/fimcompletionrequest.py +11 -16
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/fimcompletionstreamrequest.py +11 -16
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/ftmodelout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/functioncall.py +9 -3
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/githubrepositoryin.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/githubrepositoryout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/httpvalidationerror.py +1 -1
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobin.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobmetadataout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +2 -0
- mistralai-1.0.0/src/mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +15 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +2 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +2 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/legacyjobmetadataout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/metricout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/modelcard.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/retrieve_model_v1_models_model_id_getop.py +2 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/retrievefileout.py +4 -9
- mistralai-1.0.0/src/mistralai/models/security.py +16 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/toolmessage.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/trainingparameters.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/trainingparametersin.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/updateftmodelin.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/uploadfileout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/wandbintegration.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/wandbintegrationout.py +4 -9
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models_.py +24 -24
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/sdk.py +14 -6
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/sdkconfiguration.py +5 -4
- {mistralai-0.5.5a50/packages/mistralai_azure/src/mistralai_azure → mistralai-1.0.0/src/mistralai}/types/basemodel.py +10 -6
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/__init__.py +4 -0
- {mistralai-0.5.5a50/packages/mistralai_azure/src/mistralai_azure → mistralai-1.0.0/src/mistralai}/utils/eventstreaming.py +8 -9
- mistralai-1.0.0/src/mistralai/utils/logger.py +16 -0
- {mistralai-0.5.5a50/packages/mistralai_azure/src/mistralai_azure → mistralai-1.0.0/src/mistralai}/utils/retries.py +2 -2
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/security.py +5 -2
- mistralai-0.5.5a50/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionchoice.py +0 -33
- mistralai-0.5.5a50/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionchoice.py +0 -33
- mistralai-0.5.5a50/src/mistralai/models/chatcompletionchoice.py +0 -33
- mistralai-0.5.5a50/src/mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +0 -73
- mistralai-0.5.5a50/src/mistralai/models/security.py +0 -16
- {mistralai-0.5.5a50 → mistralai-1.0.0}/LICENSE +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/__init__.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/_hooks/__init__.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/_hooks/custom_user_agent.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/_hooks/registration.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/_hooks/sdkhooks.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/_hooks/types.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/httpclient.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionresponse.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/completionchunk.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/completionevent.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/contentchunk.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/function.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/responseformat.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/sdkerror.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/security.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/systemmessage.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/textchunk.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/tool.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/toolcall.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/usageinfo.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/usermessage.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/models/validationerror.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/py.typed +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/types/__init__.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/annotations.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/enums.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/forms.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/headers.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/metadata.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/queryparams.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/requestbodies.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/security.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/serializers.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/url.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_azure/src/mistralai_azure/utils/values.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/__init__.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/_hooks/__init__.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/_hooks/custom_user_agent.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/_hooks/registration.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/_hooks/sdkhooks.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/_hooks/types.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/httpclient.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionresponse.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/completionchunk.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/completionevent.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/contentchunk.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/fimcompletionresponse.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/function.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/responseformat.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/sdkerror.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/security.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/systemmessage.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/textchunk.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/tool.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/toolcall.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/usageinfo.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/usermessage.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/models/validationerror.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/py.typed +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/types/__init__.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/annotations.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/enums.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/forms.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/headers.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/metadata.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/queryparams.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/requestbodies.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/security.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/serializers.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/url.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/values.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/py.typed +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/__init__.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/_hooks/__init__.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/_hooks/custom_user_agent.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/_hooks/deprecation_warning.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/_hooks/registration.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/_hooks/sdkhooks.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/_hooks/types.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/async_client.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/httpclient.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/archiveftmodelout.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/chatcompletionresponse.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/checkpointout.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/completionchunk.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/completionevent.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/contentchunk.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/deletefileout.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/deletemodelout.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/embeddingresponse.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/embeddingresponsedata.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/files_api_routes_delete_fileop.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/files_api_routes_retrieve_fileop.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/files_api_routes_upload_fileop.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/fimcompletionresponse.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/finetuneablemodel.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/ftmodelcapabilitiesout.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/function.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/jobsout.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/listfilesout.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/modelcapabilities.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/modellist.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/responseformat.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/sampletype.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/sdkerror.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/source.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/systemmessage.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/textchunk.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/tool.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/toolcall.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/trainingfile.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/unarchiveftmodelout.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/usageinfo.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/usermessage.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/models/validationerror.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/py.typed +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/types/__init__.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/annotations.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/enums.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/forms.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/headers.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/metadata.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/queryparams.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/requestbodies.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/serializers.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/url.py +0 -0
- {mistralai-0.5.5a50 → mistralai-1.0.0}/src/mistralai/utils/values.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mistralai
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Python Client SDK for the Mistral AI API.
|
|
5
5
|
Author: Mistral
|
|
6
6
|
Requires-Python: >=3.8,<4.0
|
|
@@ -20,16 +20,26 @@ Requires-Dist: requests (>=2.32.3,<3.0.0) ; extra == "gcp"
|
|
|
20
20
|
Requires-Dist: typing-inspect (>=0.9.0,<0.10.0)
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
<div align="left">
|
|
26
|
-
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
|
|
27
|
-
</div>
|
|
23
|
+
# Mistral Python Client
|
|
28
24
|
|
|
29
25
|
## Migration warning
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
This documentation is for Mistral AI SDK v1. You can find more details on how to migrate from v0 to v1 [here](MIGRATION.md)
|
|
28
|
+
|
|
29
|
+
## API Key Setup
|
|
30
|
+
|
|
31
|
+
Before you begin, you will need a Mistral AI API key.
|
|
32
|
+
|
|
33
|
+
1. Get your own Mistral API Key: <https://docs.mistral.ai/#api-access>
|
|
34
|
+
2. Set your Mistral API Key as an environment variable. You only need to do this once.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# set Mistral API Key (using zsh for example)
|
|
38
|
+
$ echo 'export MISTRAL_API_KEY=[your_key_here]' >> ~/.zshenv
|
|
39
|
+
|
|
40
|
+
# reload the environment (or just quit and open a new terminal)
|
|
41
|
+
$ source ~/.zshenv
|
|
42
|
+
```
|
|
33
43
|
|
|
34
44
|
<!-- Start SDK Installation [installation] -->
|
|
35
45
|
## SDK Installation
|
|
@@ -62,12 +72,12 @@ s = Mistral(
|
|
|
62
72
|
)
|
|
63
73
|
|
|
64
74
|
|
|
65
|
-
res = s.chat.
|
|
75
|
+
res = s.chat.complete(model="mistral-small-latest", messages=[
|
|
66
76
|
{
|
|
67
77
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
68
78
|
"role": "user",
|
|
69
79
|
},
|
|
70
|
-
]
|
|
80
|
+
])
|
|
71
81
|
|
|
72
82
|
if res is not None:
|
|
73
83
|
# handle response
|
|
@@ -87,12 +97,12 @@ async def main():
|
|
|
87
97
|
s = Mistral(
|
|
88
98
|
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
89
99
|
)
|
|
90
|
-
res = await s.chat.
|
|
100
|
+
res = await s.chat.complete_async(model="mistral-small-latest", messages=[
|
|
91
101
|
{
|
|
92
102
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
93
103
|
"role": "user",
|
|
94
104
|
},
|
|
95
|
-
]
|
|
105
|
+
])
|
|
96
106
|
if res is not None:
|
|
97
107
|
# handle response
|
|
98
108
|
pass
|
|
@@ -145,19 +155,78 @@ async def main():
|
|
|
145
155
|
# handle response
|
|
146
156
|
pass
|
|
147
157
|
|
|
158
|
+
asyncio.run(main())
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Create Agents Completions
|
|
162
|
+
|
|
163
|
+
This example shows how to create agents completions.
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
# Synchronous Example
|
|
167
|
+
from mistralai import Mistral
|
|
168
|
+
import os
|
|
169
|
+
|
|
170
|
+
s = Mistral(
|
|
171
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
res = s.agents.complete(messages=[
|
|
176
|
+
{
|
|
177
|
+
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
178
|
+
"role": "user",
|
|
179
|
+
},
|
|
180
|
+
], agent_id="<value>")
|
|
181
|
+
|
|
182
|
+
if res is not None:
|
|
183
|
+
# handle response
|
|
184
|
+
pass
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
</br>
|
|
188
|
+
|
|
189
|
+
The same SDK client can also be used to make asychronous requests by importing asyncio.
|
|
190
|
+
```python
|
|
191
|
+
# Asynchronous Example
|
|
192
|
+
import asyncio
|
|
193
|
+
from mistralai import Mistral
|
|
194
|
+
import os
|
|
195
|
+
|
|
196
|
+
async def main():
|
|
197
|
+
s = Mistral(
|
|
198
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
199
|
+
)
|
|
200
|
+
res = await s.agents.complete_async(messages=[
|
|
201
|
+
{
|
|
202
|
+
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
203
|
+
"role": "user",
|
|
204
|
+
},
|
|
205
|
+
], agent_id="<value>")
|
|
206
|
+
if res is not None:
|
|
207
|
+
# handle response
|
|
208
|
+
pass
|
|
209
|
+
|
|
148
210
|
asyncio.run(main())
|
|
149
211
|
```
|
|
150
212
|
<!-- End SDK Example Usage [usage] -->
|
|
151
213
|
|
|
152
|
-
### Azure AI
|
|
153
214
|
|
|
154
|
-
|
|
215
|
+
### More examples
|
|
216
|
+
|
|
217
|
+
You can run the examples in the `examples/` directory using `poetry run` or by entering the virtual environment using `poetry shell`.
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
## Providers' SDKs Example Usage
|
|
221
|
+
|
|
222
|
+
### Azure AI
|
|
155
223
|
|
|
156
224
|
**Prerequisites**
|
|
225
|
+
|
|
157
226
|
Before you begin, ensure you have `AZUREAI_ENDPOINT` and an `AZURE_API_KEY`. To obtain these, you will need to deploy Mistral on Azure AI.
|
|
158
227
|
See [instructions for deploying Mistral on Azure AI here](https://docs.mistral.ai/deployment/cloud/azure/).
|
|
159
228
|
|
|
160
|
-
Here's a basic example to get you started. You can also run [the example in the `examples` directory](/examples/azure
|
|
229
|
+
Here's a basic example to get you started. You can also run [the example in the `examples` directory](/examples/azure).
|
|
161
230
|
|
|
162
231
|
```python
|
|
163
232
|
import asyncio
|
|
@@ -167,35 +236,32 @@ from mistralai_azure import MistralAzure
|
|
|
167
236
|
|
|
168
237
|
client = MistralAzure(
|
|
169
238
|
azure_api_key=os.getenv("AZURE_API_KEY", ""),
|
|
170
|
-
azure_endpoint="
|
|
239
|
+
azure_endpoint=os.getenv("AZURE_ENDPOINT", "")
|
|
171
240
|
)
|
|
172
241
|
|
|
173
242
|
async def main() -> None:
|
|
174
|
-
res = await client.chat.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
]
|
|
184
|
-
}
|
|
243
|
+
res = await client.chat.complete_async(
|
|
244
|
+
max_tokens= 100,
|
|
245
|
+
temperature= 0.5,
|
|
246
|
+
messages= [
|
|
247
|
+
{
|
|
248
|
+
"content": "Hello there!",
|
|
249
|
+
"role": "user"
|
|
250
|
+
}
|
|
251
|
+
]
|
|
185
252
|
)
|
|
186
253
|
print(res)
|
|
187
254
|
|
|
188
255
|
asyncio.run(main())
|
|
189
256
|
```
|
|
190
|
-
The documentation for the Azure SDK is available [
|
|
257
|
+
The documentation for the Azure SDK is available [here](packages/mistralai_azure/README.md).
|
|
191
258
|
|
|
192
259
|
### Google Cloud
|
|
193
260
|
|
|
194
|
-
TODO ADJUST LINKS
|
|
195
261
|
|
|
196
262
|
**Prerequisites**
|
|
197
263
|
|
|
198
|
-
Before you begin, you will need to create a Google Cloud project and enable the Mistral API. To do this, follow the instructions [here](https://docs.mistral.ai/deployment/cloud/
|
|
264
|
+
Before you begin, you will need to create a Google Cloud project and enable the Mistral API. To do this, follow the instructions [here](https://docs.mistral.ai/deployment/cloud/vertex/).
|
|
199
265
|
|
|
200
266
|
To run this locally you will also need to ensure you are authenticated with Google Cloud. You can do this by running
|
|
201
267
|
|
|
@@ -223,23 +289,21 @@ client = MistralGoogleCloud()
|
|
|
223
289
|
|
|
224
290
|
|
|
225
291
|
async def main() -> None:
|
|
226
|
-
res = await client.chat.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
]
|
|
235
|
-
}
|
|
292
|
+
res = await client.chat.complete_async(
|
|
293
|
+
model= "mistral-small-2402",
|
|
294
|
+
messages= [
|
|
295
|
+
{
|
|
296
|
+
"content": "Hello there!",
|
|
297
|
+
"role": "user"
|
|
298
|
+
}
|
|
299
|
+
]
|
|
236
300
|
)
|
|
237
301
|
print(res)
|
|
238
302
|
|
|
239
303
|
asyncio.run(main())
|
|
240
304
|
```
|
|
241
305
|
|
|
242
|
-
The documentation for the GCP SDK is available [
|
|
306
|
+
The documentation for the GCP SDK is available [here](packages/mistralai_gcp/README.md).
|
|
243
307
|
|
|
244
308
|
|
|
245
309
|
<!-- Start Available Resources and Operations [operations] -->
|
|
@@ -261,24 +325,30 @@ The documentation for the GCP SDK is available [GCP](packages/mistralai_gcp/READ
|
|
|
261
325
|
* [retrieve](docs/sdks/files/README.md#retrieve) - Retrieve File
|
|
262
326
|
* [delete](docs/sdks/files/README.md#delete) - Delete File
|
|
263
327
|
|
|
264
|
-
### [fine_tuning](docs/sdks/finetuning/README.md)
|
|
265
328
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
* [
|
|
269
|
-
* [
|
|
270
|
-
* [
|
|
329
|
+
### [fine_tuning.jobs](docs/sdks/jobs/README.md)
|
|
330
|
+
|
|
331
|
+
* [list](docs/sdks/jobs/README.md#list) - Get Fine Tuning Jobs
|
|
332
|
+
* [create](docs/sdks/jobs/README.md#create) - Create Fine Tuning Job
|
|
333
|
+
* [get](docs/sdks/jobs/README.md#get) - Get Fine Tuning Job
|
|
334
|
+
* [cancel](docs/sdks/jobs/README.md#cancel) - Cancel Fine Tuning Job
|
|
335
|
+
* [start](docs/sdks/jobs/README.md#start) - Start Fine Tuning Job
|
|
271
336
|
|
|
272
337
|
### [chat](docs/sdks/chat/README.md)
|
|
273
338
|
|
|
274
|
-
* [
|
|
339
|
+
* [complete](docs/sdks/chat/README.md#complete) - Chat Completion
|
|
275
340
|
* [stream](docs/sdks/chat/README.md#stream) - Stream chat completion
|
|
276
341
|
|
|
277
342
|
### [fim](docs/sdks/fim/README.md)
|
|
278
343
|
|
|
279
|
-
* [
|
|
344
|
+
* [complete](docs/sdks/fim/README.md#complete) - Fim Completion
|
|
280
345
|
* [stream](docs/sdks/fim/README.md#stream) - Stream fim completion
|
|
281
346
|
|
|
347
|
+
### [agents](docs/sdks/agents/README.md)
|
|
348
|
+
|
|
349
|
+
* [complete](docs/sdks/agents/README.md#complete) - Agents Completion
|
|
350
|
+
* [stream](docs/sdks/agents/README.md#stream) - Stream Agents completion
|
|
351
|
+
|
|
282
352
|
### [embeddings](docs/sdks/embeddings/README.md)
|
|
283
353
|
|
|
284
354
|
* [create](docs/sdks/embeddings/README.md#create) - Embeddings
|
|
@@ -302,12 +372,12 @@ s = Mistral(
|
|
|
302
372
|
)
|
|
303
373
|
|
|
304
374
|
|
|
305
|
-
res = s.chat.stream(messages=[
|
|
375
|
+
res = s.chat.stream(model="mistral-small-latest", messages=[
|
|
306
376
|
{
|
|
307
377
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
308
378
|
"role": "user",
|
|
309
379
|
},
|
|
310
|
-
]
|
|
380
|
+
])
|
|
311
381
|
|
|
312
382
|
if res is not None:
|
|
313
383
|
for event in res:
|
|
@@ -577,11 +647,11 @@ s = Mistral(async_client=CustomClient(httpx.AsyncClient()))
|
|
|
577
647
|
|
|
578
648
|
This SDK supports the following security scheme globally:
|
|
579
649
|
|
|
580
|
-
| Name
|
|
581
|
-
|
|
|
582
|
-
| `api_key`
|
|
650
|
+
| Name | Type | Scheme | Environment Variable |
|
|
651
|
+
| -------------------- | -------------------- | -------------------- | -------------------- |
|
|
652
|
+
| `api_key` | http | HTTP Bearer | `MISTRAL_API_KEY` |
|
|
583
653
|
|
|
584
|
-
To authenticate with the API the `
|
|
654
|
+
To authenticate with the API the `null` parameter must be set when initializing the SDK client instance. For example:
|
|
585
655
|
```python
|
|
586
656
|
from mistralai import Mistral
|
|
587
657
|
import os
|
|
@@ -599,28 +669,27 @@ if res is not None:
|
|
|
599
669
|
|
|
600
670
|
```
|
|
601
671
|
<!-- End Authentication [security] -->
|
|
602
|
-
## Providers Support
|
|
603
672
|
|
|
604
|
-
|
|
673
|
+
<!-- Start Debugging [debug] -->
|
|
674
|
+
## Debugging
|
|
675
|
+
|
|
676
|
+
To emit debug logs for SDK requests and responses you can pass a logger object directly into your SDK object.
|
|
605
677
|
|
|
606
|
-
|
|
607
|
-
|
|
678
|
+
```python
|
|
679
|
+
from mistralai import Mistral
|
|
680
|
+
import logging
|
|
608
681
|
|
|
682
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
683
|
+
s = Mistral(debug_logger=logging.getLogger("mistralai"))
|
|
684
|
+
```
|
|
685
|
+
<!-- End Debugging [debug] -->
|
|
609
686
|
|
|
610
687
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
611
688
|
|
|
612
689
|
# Development
|
|
613
690
|
|
|
614
|
-
## Maturity
|
|
615
|
-
|
|
616
|
-
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
617
|
-
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
618
|
-
looking for the latest version.
|
|
619
|
-
|
|
620
691
|
## Contributions
|
|
621
692
|
|
|
622
693
|
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
|
|
623
694
|
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
|
624
695
|
|
|
625
|
-
### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
|
|
626
|
-
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
<div align="left">
|
|
4
|
-
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
|
|
5
|
-
</div>
|
|
1
|
+
# Mistral Python Client
|
|
6
2
|
|
|
7
3
|
## Migration warning
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
This documentation is for Mistral AI SDK v1. You can find more details on how to migrate from v0 to v1 [here](MIGRATION.md)
|
|
6
|
+
|
|
7
|
+
## API Key Setup
|
|
8
|
+
|
|
9
|
+
Before you begin, you will need a Mistral AI API key.
|
|
10
|
+
|
|
11
|
+
1. Get your own Mistral API Key: <https://docs.mistral.ai/#api-access>
|
|
12
|
+
2. Set your Mistral API Key as an environment variable. You only need to do this once.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# set Mistral API Key (using zsh for example)
|
|
16
|
+
$ echo 'export MISTRAL_API_KEY=[your_key_here]' >> ~/.zshenv
|
|
17
|
+
|
|
18
|
+
# reload the environment (or just quit and open a new terminal)
|
|
19
|
+
$ source ~/.zshenv
|
|
20
|
+
```
|
|
11
21
|
|
|
12
22
|
<!-- Start SDK Installation [installation] -->
|
|
13
23
|
## SDK Installation
|
|
@@ -40,12 +50,12 @@ s = Mistral(
|
|
|
40
50
|
)
|
|
41
51
|
|
|
42
52
|
|
|
43
|
-
res = s.chat.
|
|
53
|
+
res = s.chat.complete(model="mistral-small-latest", messages=[
|
|
44
54
|
{
|
|
45
55
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
46
56
|
"role": "user",
|
|
47
57
|
},
|
|
48
|
-
]
|
|
58
|
+
])
|
|
49
59
|
|
|
50
60
|
if res is not None:
|
|
51
61
|
# handle response
|
|
@@ -65,12 +75,12 @@ async def main():
|
|
|
65
75
|
s = Mistral(
|
|
66
76
|
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
67
77
|
)
|
|
68
|
-
res = await s.chat.
|
|
78
|
+
res = await s.chat.complete_async(model="mistral-small-latest", messages=[
|
|
69
79
|
{
|
|
70
80
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
71
81
|
"role": "user",
|
|
72
82
|
},
|
|
73
|
-
]
|
|
83
|
+
])
|
|
74
84
|
if res is not None:
|
|
75
85
|
# handle response
|
|
76
86
|
pass
|
|
@@ -123,19 +133,78 @@ async def main():
|
|
|
123
133
|
# handle response
|
|
124
134
|
pass
|
|
125
135
|
|
|
136
|
+
asyncio.run(main())
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Create Agents Completions
|
|
140
|
+
|
|
141
|
+
This example shows how to create agents completions.
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
# Synchronous Example
|
|
145
|
+
from mistralai import Mistral
|
|
146
|
+
import os
|
|
147
|
+
|
|
148
|
+
s = Mistral(
|
|
149
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
res = s.agents.complete(messages=[
|
|
154
|
+
{
|
|
155
|
+
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
156
|
+
"role": "user",
|
|
157
|
+
},
|
|
158
|
+
], agent_id="<value>")
|
|
159
|
+
|
|
160
|
+
if res is not None:
|
|
161
|
+
# handle response
|
|
162
|
+
pass
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
</br>
|
|
166
|
+
|
|
167
|
+
The same SDK client can also be used to make asychronous requests by importing asyncio.
|
|
168
|
+
```python
|
|
169
|
+
# Asynchronous Example
|
|
170
|
+
import asyncio
|
|
171
|
+
from mistralai import Mistral
|
|
172
|
+
import os
|
|
173
|
+
|
|
174
|
+
async def main():
|
|
175
|
+
s = Mistral(
|
|
176
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
177
|
+
)
|
|
178
|
+
res = await s.agents.complete_async(messages=[
|
|
179
|
+
{
|
|
180
|
+
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
181
|
+
"role": "user",
|
|
182
|
+
},
|
|
183
|
+
], agent_id="<value>")
|
|
184
|
+
if res is not None:
|
|
185
|
+
# handle response
|
|
186
|
+
pass
|
|
187
|
+
|
|
126
188
|
asyncio.run(main())
|
|
127
189
|
```
|
|
128
190
|
<!-- End SDK Example Usage [usage] -->
|
|
129
191
|
|
|
130
|
-
### Azure AI
|
|
131
192
|
|
|
132
|
-
|
|
193
|
+
### More examples
|
|
194
|
+
|
|
195
|
+
You can run the examples in the `examples/` directory using `poetry run` or by entering the virtual environment using `poetry shell`.
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## Providers' SDKs Example Usage
|
|
199
|
+
|
|
200
|
+
### Azure AI
|
|
133
201
|
|
|
134
202
|
**Prerequisites**
|
|
203
|
+
|
|
135
204
|
Before you begin, ensure you have `AZUREAI_ENDPOINT` and an `AZURE_API_KEY`. To obtain these, you will need to deploy Mistral on Azure AI.
|
|
136
205
|
See [instructions for deploying Mistral on Azure AI here](https://docs.mistral.ai/deployment/cloud/azure/).
|
|
137
206
|
|
|
138
|
-
Here's a basic example to get you started. You can also run [the example in the `examples` directory](/examples/azure
|
|
207
|
+
Here's a basic example to get you started. You can also run [the example in the `examples` directory](/examples/azure).
|
|
139
208
|
|
|
140
209
|
```python
|
|
141
210
|
import asyncio
|
|
@@ -145,35 +214,32 @@ from mistralai_azure import MistralAzure
|
|
|
145
214
|
|
|
146
215
|
client = MistralAzure(
|
|
147
216
|
azure_api_key=os.getenv("AZURE_API_KEY", ""),
|
|
148
|
-
azure_endpoint="
|
|
217
|
+
azure_endpoint=os.getenv("AZURE_ENDPOINT", "")
|
|
149
218
|
)
|
|
150
219
|
|
|
151
220
|
async def main() -> None:
|
|
152
|
-
res = await client.chat.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
]
|
|
162
|
-
}
|
|
221
|
+
res = await client.chat.complete_async(
|
|
222
|
+
max_tokens= 100,
|
|
223
|
+
temperature= 0.5,
|
|
224
|
+
messages= [
|
|
225
|
+
{
|
|
226
|
+
"content": "Hello there!",
|
|
227
|
+
"role": "user"
|
|
228
|
+
}
|
|
229
|
+
]
|
|
163
230
|
)
|
|
164
231
|
print(res)
|
|
165
232
|
|
|
166
233
|
asyncio.run(main())
|
|
167
234
|
```
|
|
168
|
-
The documentation for the Azure SDK is available [
|
|
235
|
+
The documentation for the Azure SDK is available [here](packages/mistralai_azure/README.md).
|
|
169
236
|
|
|
170
237
|
### Google Cloud
|
|
171
238
|
|
|
172
|
-
TODO ADJUST LINKS
|
|
173
239
|
|
|
174
240
|
**Prerequisites**
|
|
175
241
|
|
|
176
|
-
Before you begin, you will need to create a Google Cloud project and enable the Mistral API. To do this, follow the instructions [here](https://docs.mistral.ai/deployment/cloud/
|
|
242
|
+
Before you begin, you will need to create a Google Cloud project and enable the Mistral API. To do this, follow the instructions [here](https://docs.mistral.ai/deployment/cloud/vertex/).
|
|
177
243
|
|
|
178
244
|
To run this locally you will also need to ensure you are authenticated with Google Cloud. You can do this by running
|
|
179
245
|
|
|
@@ -201,23 +267,21 @@ client = MistralGoogleCloud()
|
|
|
201
267
|
|
|
202
268
|
|
|
203
269
|
async def main() -> None:
|
|
204
|
-
res = await client.chat.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
]
|
|
213
|
-
}
|
|
270
|
+
res = await client.chat.complete_async(
|
|
271
|
+
model= "mistral-small-2402",
|
|
272
|
+
messages= [
|
|
273
|
+
{
|
|
274
|
+
"content": "Hello there!",
|
|
275
|
+
"role": "user"
|
|
276
|
+
}
|
|
277
|
+
]
|
|
214
278
|
)
|
|
215
279
|
print(res)
|
|
216
280
|
|
|
217
281
|
asyncio.run(main())
|
|
218
282
|
```
|
|
219
283
|
|
|
220
|
-
The documentation for the GCP SDK is available [
|
|
284
|
+
The documentation for the GCP SDK is available [here](packages/mistralai_gcp/README.md).
|
|
221
285
|
|
|
222
286
|
|
|
223
287
|
<!-- Start Available Resources and Operations [operations] -->
|
|
@@ -239,24 +303,30 @@ The documentation for the GCP SDK is available [GCP](packages/mistralai_gcp/READ
|
|
|
239
303
|
* [retrieve](docs/sdks/files/README.md#retrieve) - Retrieve File
|
|
240
304
|
* [delete](docs/sdks/files/README.md#delete) - Delete File
|
|
241
305
|
|
|
242
|
-
### [fine_tuning](docs/sdks/finetuning/README.md)
|
|
243
306
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
* [
|
|
247
|
-
* [
|
|
248
|
-
* [
|
|
307
|
+
### [fine_tuning.jobs](docs/sdks/jobs/README.md)
|
|
308
|
+
|
|
309
|
+
* [list](docs/sdks/jobs/README.md#list) - Get Fine Tuning Jobs
|
|
310
|
+
* [create](docs/sdks/jobs/README.md#create) - Create Fine Tuning Job
|
|
311
|
+
* [get](docs/sdks/jobs/README.md#get) - Get Fine Tuning Job
|
|
312
|
+
* [cancel](docs/sdks/jobs/README.md#cancel) - Cancel Fine Tuning Job
|
|
313
|
+
* [start](docs/sdks/jobs/README.md#start) - Start Fine Tuning Job
|
|
249
314
|
|
|
250
315
|
### [chat](docs/sdks/chat/README.md)
|
|
251
316
|
|
|
252
|
-
* [
|
|
317
|
+
* [complete](docs/sdks/chat/README.md#complete) - Chat Completion
|
|
253
318
|
* [stream](docs/sdks/chat/README.md#stream) - Stream chat completion
|
|
254
319
|
|
|
255
320
|
### [fim](docs/sdks/fim/README.md)
|
|
256
321
|
|
|
257
|
-
* [
|
|
322
|
+
* [complete](docs/sdks/fim/README.md#complete) - Fim Completion
|
|
258
323
|
* [stream](docs/sdks/fim/README.md#stream) - Stream fim completion
|
|
259
324
|
|
|
325
|
+
### [agents](docs/sdks/agents/README.md)
|
|
326
|
+
|
|
327
|
+
* [complete](docs/sdks/agents/README.md#complete) - Agents Completion
|
|
328
|
+
* [stream](docs/sdks/agents/README.md#stream) - Stream Agents completion
|
|
329
|
+
|
|
260
330
|
### [embeddings](docs/sdks/embeddings/README.md)
|
|
261
331
|
|
|
262
332
|
* [create](docs/sdks/embeddings/README.md#create) - Embeddings
|
|
@@ -280,12 +350,12 @@ s = Mistral(
|
|
|
280
350
|
)
|
|
281
351
|
|
|
282
352
|
|
|
283
|
-
res = s.chat.stream(messages=[
|
|
353
|
+
res = s.chat.stream(model="mistral-small-latest", messages=[
|
|
284
354
|
{
|
|
285
355
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
286
356
|
"role": "user",
|
|
287
357
|
},
|
|
288
|
-
]
|
|
358
|
+
])
|
|
289
359
|
|
|
290
360
|
if res is not None:
|
|
291
361
|
for event in res:
|
|
@@ -555,11 +625,11 @@ s = Mistral(async_client=CustomClient(httpx.AsyncClient()))
|
|
|
555
625
|
|
|
556
626
|
This SDK supports the following security scheme globally:
|
|
557
627
|
|
|
558
|
-
| Name
|
|
559
|
-
|
|
|
560
|
-
| `api_key`
|
|
628
|
+
| Name | Type | Scheme | Environment Variable |
|
|
629
|
+
| -------------------- | -------------------- | -------------------- | -------------------- |
|
|
630
|
+
| `api_key` | http | HTTP Bearer | `MISTRAL_API_KEY` |
|
|
561
631
|
|
|
562
|
-
To authenticate with the API the `
|
|
632
|
+
To authenticate with the API the `null` parameter must be set when initializing the SDK client instance. For example:
|
|
563
633
|
```python
|
|
564
634
|
from mistralai import Mistral
|
|
565
635
|
import os
|
|
@@ -577,27 +647,26 @@ if res is not None:
|
|
|
577
647
|
|
|
578
648
|
```
|
|
579
649
|
<!-- End Authentication [security] -->
|
|
580
|
-
## Providers Support
|
|
581
650
|
|
|
582
|
-
|
|
651
|
+
<!-- Start Debugging [debug] -->
|
|
652
|
+
## Debugging
|
|
653
|
+
|
|
654
|
+
To emit debug logs for SDK requests and responses you can pass a logger object directly into your SDK object.
|
|
583
655
|
|
|
584
|
-
|
|
585
|
-
|
|
656
|
+
```python
|
|
657
|
+
from mistralai import Mistral
|
|
658
|
+
import logging
|
|
586
659
|
|
|
660
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
661
|
+
s = Mistral(debug_logger=logging.getLogger("mistralai"))
|
|
662
|
+
```
|
|
663
|
+
<!-- End Debugging [debug] -->
|
|
587
664
|
|
|
588
665
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
589
666
|
|
|
590
667
|
# Development
|
|
591
668
|
|
|
592
|
-
## Maturity
|
|
593
|
-
|
|
594
|
-
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
595
|
-
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
596
|
-
looking for the latest version.
|
|
597
|
-
|
|
598
669
|
## Contributions
|
|
599
670
|
|
|
600
671
|
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
|
|
601
672
|
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
|
602
|
-
|
|
603
|
-
### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
|