mistralai 1.3.1__tar.gz → 1.5.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-1.3.1 → mistralai-1.5.0}/PKG-INFO +41 -42
- {mistralai-1.3.1 → mistralai-1.5.0}/README-PYPI.md +39 -39
- {mistralai-1.3.1/packages/mistralai_azure/src/mistralai_azure → mistralai-1.5.0/packages/mistralai_gcp/src/mistralai_gcp}/_hooks/custom_user_agent.py +1 -1
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/sdk.py +1 -2
- {mistralai-1.3.1 → mistralai-1.5.0}/pyproject.toml +1 -1
- mistralai-1.5.0/src/mistralai/__init__.py +18 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/_version.py +4 -1
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/agents.py +58 -14
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/chat.py +140 -14
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/classifiers.py +32 -20
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/embeddings.py +16 -10
- mistralai-1.5.0/src/mistralai/extra/README.md +56 -0
- mistralai-1.5.0/src/mistralai/extra/__init__.py +5 -0
- mistralai-1.5.0/src/mistralai/extra/struct_chat.py +41 -0
- mistralai-1.5.0/src/mistralai/extra/tests/__init__.py +0 -0
- mistralai-1.5.0/src/mistralai/extra/tests/test_struct_chat.py +103 -0
- mistralai-1.5.0/src/mistralai/extra/tests/test_utils.py +162 -0
- mistralai-1.5.0/src/mistralai/extra/utils/__init__.py +3 -0
- mistralai-1.5.0/src/mistralai/extra/utils/_pydantic_helper.py +20 -0
- mistralai-1.5.0/src/mistralai/extra/utils/response_format.py +24 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/files.py +94 -34
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/fim.py +30 -14
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/httpclient.py +50 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/jobs.py +80 -32
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/mistral_jobs.py +64 -24
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/__init__.py +8 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/agentscompletionrequest.py +5 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/agentscompletionstreamrequest.py +5 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/chatcompletionrequest.py +5 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/chatcompletionstreamrequest.py +5 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/fileschema.py +3 -2
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/function.py +3 -0
- mistralai-1.5.0/src/mistralai/models/jsonschema.py +55 -0
- mistralai-1.5.0/src/mistralai/models/prediction.py +26 -0
- mistralai-1.5.0/src/mistralai/models/responseformat.py +52 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/responseformats.py +1 -1
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/retrievefileout.py +3 -2
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/toolcall.py +3 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/uploadfileout.py +3 -2
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models_.py +92 -48
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/sdk.py +13 -3
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/sdkconfiguration.py +10 -4
- mistralai-1.3.1/src/mistralai/__init__.py +0 -9
- mistralai-1.3.1/src/mistralai/models/responseformat.py +0 -17
- {mistralai-1.3.1 → mistralai-1.5.0}/LICENSE +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/_hooks/__init__.py +0 -0
- {mistralai-1.3.1/packages/mistralai_gcp/src/mistralai_gcp → mistralai-1.5.0/packages/mistralai_azure/src/mistralai_azure}/_hooks/custom_user_agent.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/_hooks/registration.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/_hooks/sdkhooks.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/_hooks/types.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/_version.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/basesdk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/chat.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/httpclient.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/assistantmessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionchoice.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionresponse.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionstreamrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/completionchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/completionevent.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/completionresponsestreamchoice.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/contentchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/deltamessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/function.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/functioncall.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/functionname.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/httpvalidationerror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/referencechunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/responseformat.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/responseformats.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/sdkerror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/security.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/systemmessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/textchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/tool.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/toolcall.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/toolchoice.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/toolchoiceenum.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/toolmessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/tooltypes.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/usageinfo.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/usermessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/models/validationerror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/py.typed +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/sdk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/sdkconfiguration.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/types/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/types/basemodel.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/annotations.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/enums.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/eventstreaming.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/forms.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/headers.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/logger.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/metadata.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/queryparams.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/requestbodies.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/retries.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/security.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/serializers.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/url.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_azure/src/mistralai_azure/utils/values.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/_hooks/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/_hooks/registration.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/_hooks/sdkhooks.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/_hooks/types.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/_version.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/basesdk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/chat.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/fim.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/httpclient.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/assistantmessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionchoice.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionresponse.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionstreamrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/completionchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/completionevent.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/completionresponsestreamchoice.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/contentchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/deltamessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/fimcompletionrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/fimcompletionresponse.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/fimcompletionstreamrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/function.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/functioncall.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/functionname.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/httpvalidationerror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/referencechunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/responseformat.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/responseformats.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/sdkerror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/security.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/systemmessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/textchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/tool.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/toolcall.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/toolchoice.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/toolchoiceenum.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/toolmessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/tooltypes.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/usageinfo.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/usermessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/models/validationerror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/py.typed +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/sdkconfiguration.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/types/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/types/basemodel.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/annotations.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/enums.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/eventstreaming.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/forms.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/headers.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/logger.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/metadata.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/queryparams.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/requestbodies.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/retries.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/security.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/serializers.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/url.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/packages/mistralai_gcp/src/mistralai_gcp/utils/values.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/py.typed +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/_hooks/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/_hooks/custom_user_agent.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/_hooks/deprecation_warning.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/_hooks/registration.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/_hooks/sdkhooks.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/_hooks/types.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/async_client.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/basesdk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/batch.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/client.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/fine_tuning.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/apiendpoint.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/archiveftmodelout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/assistantmessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/basemodelcard.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/batcherror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/batchjobin.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/batchjobout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/batchjobsout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/batchjobstatus.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/chatclassificationrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/chatcompletionchoice.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/chatcompletionresponse.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/checkpointout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/classificationobject.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/classificationrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/classificationresponse.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/completionchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/completionevent.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/completionresponsestreamchoice.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/contentchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/delete_model_v1_models_model_id_deleteop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/deletefileout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/deletemodelout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/deltamessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/detailedjobout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/embeddingrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/embeddingresponse.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/embeddingresponsedata.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/eventout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/filepurpose.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/files_api_routes_delete_fileop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/files_api_routes_download_fileop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/files_api_routes_get_signed_urlop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/files_api_routes_list_filesop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/files_api_routes_retrieve_fileop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/files_api_routes_upload_fileop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/filesignedurl.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/fimcompletionrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/fimcompletionresponse.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/fimcompletionstreamrequest.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/ftmodelcapabilitiesout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/ftmodelcard.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/ftmodelout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/functioncall.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/functionname.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/githubrepositoryin.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/githubrepositoryout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/httpvalidationerror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/imageurl.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/imageurlchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobin.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobmetadataout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_batch_cancel_batch_jobop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/jobsout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/legacyjobmetadataout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/listfilesout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/metricout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/modelcapabilities.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/modellist.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/referencechunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/retrieve_model_v1_models_model_id_getop.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/sampletype.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/sdkerror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/security.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/source.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/systemmessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/textchunk.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/tool.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/toolchoice.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/toolchoiceenum.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/toolmessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/tooltypes.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/trainingfile.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/trainingparameters.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/trainingparametersin.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/unarchiveftmodelout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/updateftmodelin.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/usageinfo.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/usermessage.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/validationerror.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/wandbintegration.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/models/wandbintegrationout.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/py.typed +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/types/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/types/basemodel.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/__init__.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/annotations.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/enums.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/eventstreaming.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/forms.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/headers.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/logger.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/metadata.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/queryparams.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/requestbodies.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/retries.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/security.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/serializers.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/url.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/utils/values.py +0 -0
- {mistralai-1.3.1 → mistralai-1.5.0}/src/mistralai/version.py +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: mistralai
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Python Client SDK for the Mistral AI API.
|
|
5
|
-
Home-page: https://github.com/mistralai/client-python.git
|
|
6
5
|
Author: Mistral
|
|
7
6
|
Requires-Python: >=3.8
|
|
8
7
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -68,6 +67,7 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
|
|
|
68
67
|
* [Server Selection](https://github.com/mistralai/client-python/blob/master/#server-selection)
|
|
69
68
|
* [Custom HTTP Client](https://github.com/mistralai/client-python/blob/master/#custom-http-client)
|
|
70
69
|
* [Authentication](https://github.com/mistralai/client-python/blob/master/#authentication)
|
|
70
|
+
* [Resource Management](https://github.com/mistralai/client-python/blob/master/#resource-management)
|
|
71
71
|
* [Debugging](https://github.com/mistralai/client-python/blob/master/#debugging)
|
|
72
72
|
* [IDE Support](https://github.com/mistralai/client-python/blob/master/#ide-support)
|
|
73
73
|
* [Development](https://github.com/mistralai/client-python/blob/master/#development)
|
|
@@ -78,6 +78,11 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
|
|
|
78
78
|
<!-- Start SDK Installation [installation] -->
|
|
79
79
|
## SDK Installation
|
|
80
80
|
|
|
81
|
+
> [!NOTE]
|
|
82
|
+
> **Python version upgrade policy**
|
|
83
|
+
>
|
|
84
|
+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
|
85
|
+
|
|
81
86
|
The SDK can be installed with either *pip* or *poetry* package managers.
|
|
82
87
|
|
|
83
88
|
### PIP
|
|
@@ -118,9 +123,7 @@ with Mistral(
|
|
|
118
123
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
119
124
|
"role": "user",
|
|
120
125
|
},
|
|
121
|
-
])
|
|
122
|
-
|
|
123
|
-
assert res is not None
|
|
126
|
+
], stream=False)
|
|
124
127
|
|
|
125
128
|
# Handle response
|
|
126
129
|
print(res)
|
|
@@ -145,9 +148,7 @@ async def main():
|
|
|
145
148
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
146
149
|
"role": "user",
|
|
147
150
|
},
|
|
148
|
-
])
|
|
149
|
-
|
|
150
|
-
assert res is not None
|
|
151
|
+
], stream=False)
|
|
151
152
|
|
|
152
153
|
# Handle response
|
|
153
154
|
print(res)
|
|
@@ -173,8 +174,6 @@ with Mistral(
|
|
|
173
174
|
"content": open("example.file", "rb"),
|
|
174
175
|
})
|
|
175
176
|
|
|
176
|
-
assert res is not None
|
|
177
|
-
|
|
178
177
|
# Handle response
|
|
179
178
|
print(res)
|
|
180
179
|
```
|
|
@@ -198,8 +197,6 @@ async def main():
|
|
|
198
197
|
"content": open("example.file", "rb"),
|
|
199
198
|
})
|
|
200
199
|
|
|
201
|
-
assert res is not None
|
|
202
|
-
|
|
203
200
|
# Handle response
|
|
204
201
|
print(res)
|
|
205
202
|
|
|
@@ -224,9 +221,7 @@ with Mistral(
|
|
|
224
221
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
225
222
|
"role": "user",
|
|
226
223
|
},
|
|
227
|
-
], agent_id="<
|
|
228
|
-
|
|
229
|
-
assert res is not None
|
|
224
|
+
], agent_id="<id>", stream=False)
|
|
230
225
|
|
|
231
226
|
# Handle response
|
|
232
227
|
print(res)
|
|
@@ -251,9 +246,7 @@ async def main():
|
|
|
251
246
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
252
247
|
"role": "user",
|
|
253
248
|
},
|
|
254
|
-
], agent_id="<
|
|
255
|
-
|
|
256
|
-
assert res is not None
|
|
249
|
+
], agent_id="<id>", stream=False)
|
|
257
250
|
|
|
258
251
|
# Handle response
|
|
259
252
|
print(res)
|
|
@@ -277,9 +270,7 @@ with Mistral(
|
|
|
277
270
|
res = mistral.embeddings.create(inputs=[
|
|
278
271
|
"Embed this sentence.",
|
|
279
272
|
"As well as this one.",
|
|
280
|
-
], model="
|
|
281
|
-
|
|
282
|
-
assert res is not None
|
|
273
|
+
], model="mistral-embed")
|
|
283
274
|
|
|
284
275
|
# Handle response
|
|
285
276
|
print(res)
|
|
@@ -302,9 +293,7 @@ async def main():
|
|
|
302
293
|
res = await mistral.embeddings.create_async(inputs=[
|
|
303
294
|
"Embed this sentence.",
|
|
304
295
|
"As well as this one.",
|
|
305
|
-
], model="
|
|
306
|
-
|
|
307
|
-
assert res is not None
|
|
296
|
+
], model="mistral-embed")
|
|
308
297
|
|
|
309
298
|
# Handle response
|
|
310
299
|
print(res)
|
|
@@ -506,9 +495,7 @@ with Mistral(
|
|
|
506
495
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
507
496
|
"role": "user",
|
|
508
497
|
},
|
|
509
|
-
])
|
|
510
|
-
|
|
511
|
-
assert res is not None
|
|
498
|
+
], stream=True)
|
|
512
499
|
|
|
513
500
|
with res as event_stream:
|
|
514
501
|
for event in event_stream:
|
|
@@ -545,8 +532,6 @@ with Mistral(
|
|
|
545
532
|
"content": open("example.file", "rb"),
|
|
546
533
|
})
|
|
547
534
|
|
|
548
|
-
assert res is not None
|
|
549
|
-
|
|
550
535
|
# Handle response
|
|
551
536
|
print(res)
|
|
552
537
|
|
|
@@ -571,8 +556,6 @@ with Mistral(
|
|
|
571
556
|
res = mistral.models.list(,
|
|
572
557
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
573
558
|
|
|
574
|
-
assert res is not None
|
|
575
|
-
|
|
576
559
|
# Handle response
|
|
577
560
|
print(res)
|
|
578
561
|
|
|
@@ -591,8 +574,6 @@ with Mistral(
|
|
|
591
574
|
|
|
592
575
|
res = mistral.models.list()
|
|
593
576
|
|
|
594
|
-
assert res is not None
|
|
595
|
-
|
|
596
577
|
# Handle response
|
|
597
578
|
print(res)
|
|
598
579
|
|
|
@@ -634,8 +615,6 @@ with Mistral(
|
|
|
634
615
|
|
|
635
616
|
res = mistral.models.list()
|
|
636
617
|
|
|
637
|
-
assert res is not None
|
|
638
|
-
|
|
639
618
|
# Handle response
|
|
640
619
|
print(res)
|
|
641
620
|
|
|
@@ -672,8 +651,6 @@ with Mistral(
|
|
|
672
651
|
|
|
673
652
|
res = mistral.models.list()
|
|
674
653
|
|
|
675
|
-
assert res is not None
|
|
676
|
-
|
|
677
654
|
# Handle response
|
|
678
655
|
print(res)
|
|
679
656
|
|
|
@@ -693,8 +670,6 @@ with Mistral(
|
|
|
693
670
|
|
|
694
671
|
res = mistral.models.list()
|
|
695
672
|
|
|
696
|
-
assert res is not None
|
|
697
|
-
|
|
698
673
|
# Handle response
|
|
699
674
|
print(res)
|
|
700
675
|
|
|
@@ -804,14 +779,38 @@ with Mistral(
|
|
|
804
779
|
|
|
805
780
|
res = mistral.models.list()
|
|
806
781
|
|
|
807
|
-
assert res is not None
|
|
808
|
-
|
|
809
782
|
# Handle response
|
|
810
783
|
print(res)
|
|
811
784
|
|
|
812
785
|
```
|
|
813
786
|
<!-- End Authentication [security] -->
|
|
814
787
|
|
|
788
|
+
<!-- Start Resource Management [resource-management] -->
|
|
789
|
+
## Resource Management
|
|
790
|
+
|
|
791
|
+
The `Mistral` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
|
792
|
+
|
|
793
|
+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
794
|
+
|
|
795
|
+
```python
|
|
796
|
+
from mistralai import Mistral
|
|
797
|
+
import os
|
|
798
|
+
def main():
|
|
799
|
+
with Mistral(
|
|
800
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
801
|
+
) as mistral:
|
|
802
|
+
# Rest of application here...
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
# Or when using async:
|
|
806
|
+
async def amain():
|
|
807
|
+
async with Mistral(
|
|
808
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
809
|
+
) as mistral:
|
|
810
|
+
# Rest of application here...
|
|
811
|
+
```
|
|
812
|
+
<!-- End Resource Management [resource-management] -->
|
|
813
|
+
|
|
815
814
|
<!-- Start Debugging [debug] -->
|
|
816
815
|
## Debugging
|
|
817
816
|
|
|
@@ -42,6 +42,7 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
|
|
|
42
42
|
* [Server Selection](https://github.com/mistralai/client-python/blob/master/#server-selection)
|
|
43
43
|
* [Custom HTTP Client](https://github.com/mistralai/client-python/blob/master/#custom-http-client)
|
|
44
44
|
* [Authentication](https://github.com/mistralai/client-python/blob/master/#authentication)
|
|
45
|
+
* [Resource Management](https://github.com/mistralai/client-python/blob/master/#resource-management)
|
|
45
46
|
* [Debugging](https://github.com/mistralai/client-python/blob/master/#debugging)
|
|
46
47
|
* [IDE Support](https://github.com/mistralai/client-python/blob/master/#ide-support)
|
|
47
48
|
* [Development](https://github.com/mistralai/client-python/blob/master/#development)
|
|
@@ -52,6 +53,11 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
|
|
|
52
53
|
<!-- Start SDK Installation [installation] -->
|
|
53
54
|
## SDK Installation
|
|
54
55
|
|
|
56
|
+
> [!NOTE]
|
|
57
|
+
> **Python version upgrade policy**
|
|
58
|
+
>
|
|
59
|
+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
|
60
|
+
|
|
55
61
|
The SDK can be installed with either *pip* or *poetry* package managers.
|
|
56
62
|
|
|
57
63
|
### PIP
|
|
@@ -92,9 +98,7 @@ with Mistral(
|
|
|
92
98
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
93
99
|
"role": "user",
|
|
94
100
|
},
|
|
95
|
-
])
|
|
96
|
-
|
|
97
|
-
assert res is not None
|
|
101
|
+
], stream=False)
|
|
98
102
|
|
|
99
103
|
# Handle response
|
|
100
104
|
print(res)
|
|
@@ -119,9 +123,7 @@ async def main():
|
|
|
119
123
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
120
124
|
"role": "user",
|
|
121
125
|
},
|
|
122
|
-
])
|
|
123
|
-
|
|
124
|
-
assert res is not None
|
|
126
|
+
], stream=False)
|
|
125
127
|
|
|
126
128
|
# Handle response
|
|
127
129
|
print(res)
|
|
@@ -147,8 +149,6 @@ with Mistral(
|
|
|
147
149
|
"content": open("example.file", "rb"),
|
|
148
150
|
})
|
|
149
151
|
|
|
150
|
-
assert res is not None
|
|
151
|
-
|
|
152
152
|
# Handle response
|
|
153
153
|
print(res)
|
|
154
154
|
```
|
|
@@ -172,8 +172,6 @@ async def main():
|
|
|
172
172
|
"content": open("example.file", "rb"),
|
|
173
173
|
})
|
|
174
174
|
|
|
175
|
-
assert res is not None
|
|
176
|
-
|
|
177
175
|
# Handle response
|
|
178
176
|
print(res)
|
|
179
177
|
|
|
@@ -198,9 +196,7 @@ with Mistral(
|
|
|
198
196
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
199
197
|
"role": "user",
|
|
200
198
|
},
|
|
201
|
-
], agent_id="<
|
|
202
|
-
|
|
203
|
-
assert res is not None
|
|
199
|
+
], agent_id="<id>", stream=False)
|
|
204
200
|
|
|
205
201
|
# Handle response
|
|
206
202
|
print(res)
|
|
@@ -225,9 +221,7 @@ async def main():
|
|
|
225
221
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
226
222
|
"role": "user",
|
|
227
223
|
},
|
|
228
|
-
], agent_id="<
|
|
229
|
-
|
|
230
|
-
assert res is not None
|
|
224
|
+
], agent_id="<id>", stream=False)
|
|
231
225
|
|
|
232
226
|
# Handle response
|
|
233
227
|
print(res)
|
|
@@ -251,9 +245,7 @@ with Mistral(
|
|
|
251
245
|
res = mistral.embeddings.create(inputs=[
|
|
252
246
|
"Embed this sentence.",
|
|
253
247
|
"As well as this one.",
|
|
254
|
-
], model="
|
|
255
|
-
|
|
256
|
-
assert res is not None
|
|
248
|
+
], model="mistral-embed")
|
|
257
249
|
|
|
258
250
|
# Handle response
|
|
259
251
|
print(res)
|
|
@@ -276,9 +268,7 @@ async def main():
|
|
|
276
268
|
res = await mistral.embeddings.create_async(inputs=[
|
|
277
269
|
"Embed this sentence.",
|
|
278
270
|
"As well as this one.",
|
|
279
|
-
], model="
|
|
280
|
-
|
|
281
|
-
assert res is not None
|
|
271
|
+
], model="mistral-embed")
|
|
282
272
|
|
|
283
273
|
# Handle response
|
|
284
274
|
print(res)
|
|
@@ -480,9 +470,7 @@ with Mistral(
|
|
|
480
470
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
481
471
|
"role": "user",
|
|
482
472
|
},
|
|
483
|
-
])
|
|
484
|
-
|
|
485
|
-
assert res is not None
|
|
473
|
+
], stream=True)
|
|
486
474
|
|
|
487
475
|
with res as event_stream:
|
|
488
476
|
for event in event_stream:
|
|
@@ -519,8 +507,6 @@ with Mistral(
|
|
|
519
507
|
"content": open("example.file", "rb"),
|
|
520
508
|
})
|
|
521
509
|
|
|
522
|
-
assert res is not None
|
|
523
|
-
|
|
524
510
|
# Handle response
|
|
525
511
|
print(res)
|
|
526
512
|
|
|
@@ -545,8 +531,6 @@ with Mistral(
|
|
|
545
531
|
res = mistral.models.list(,
|
|
546
532
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
547
533
|
|
|
548
|
-
assert res is not None
|
|
549
|
-
|
|
550
534
|
# Handle response
|
|
551
535
|
print(res)
|
|
552
536
|
|
|
@@ -565,8 +549,6 @@ with Mistral(
|
|
|
565
549
|
|
|
566
550
|
res = mistral.models.list()
|
|
567
551
|
|
|
568
|
-
assert res is not None
|
|
569
|
-
|
|
570
552
|
# Handle response
|
|
571
553
|
print(res)
|
|
572
554
|
|
|
@@ -608,8 +590,6 @@ with Mistral(
|
|
|
608
590
|
|
|
609
591
|
res = mistral.models.list()
|
|
610
592
|
|
|
611
|
-
assert res is not None
|
|
612
|
-
|
|
613
593
|
# Handle response
|
|
614
594
|
print(res)
|
|
615
595
|
|
|
@@ -646,8 +626,6 @@ with Mistral(
|
|
|
646
626
|
|
|
647
627
|
res = mistral.models.list()
|
|
648
628
|
|
|
649
|
-
assert res is not None
|
|
650
|
-
|
|
651
629
|
# Handle response
|
|
652
630
|
print(res)
|
|
653
631
|
|
|
@@ -667,8 +645,6 @@ with Mistral(
|
|
|
667
645
|
|
|
668
646
|
res = mistral.models.list()
|
|
669
647
|
|
|
670
|
-
assert res is not None
|
|
671
|
-
|
|
672
648
|
# Handle response
|
|
673
649
|
print(res)
|
|
674
650
|
|
|
@@ -778,14 +754,38 @@ with Mistral(
|
|
|
778
754
|
|
|
779
755
|
res = mistral.models.list()
|
|
780
756
|
|
|
781
|
-
assert res is not None
|
|
782
|
-
|
|
783
757
|
# Handle response
|
|
784
758
|
print(res)
|
|
785
759
|
|
|
786
760
|
```
|
|
787
761
|
<!-- End Authentication [security] -->
|
|
788
762
|
|
|
763
|
+
<!-- Start Resource Management [resource-management] -->
|
|
764
|
+
## Resource Management
|
|
765
|
+
|
|
766
|
+
The `Mistral` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
|
767
|
+
|
|
768
|
+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
769
|
+
|
|
770
|
+
```python
|
|
771
|
+
from mistralai import Mistral
|
|
772
|
+
import os
|
|
773
|
+
def main():
|
|
774
|
+
with Mistral(
|
|
775
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
776
|
+
) as mistral:
|
|
777
|
+
# Rest of application here...
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
# Or when using async:
|
|
781
|
+
async def amain():
|
|
782
|
+
async with Mistral(
|
|
783
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
784
|
+
) as mistral:
|
|
785
|
+
# Rest of application here...
|
|
786
|
+
```
|
|
787
|
+
<!-- End Resource Management [resource-management] -->
|
|
788
|
+
|
|
789
789
|
<!-- Start Debugging [debug] -->
|
|
790
790
|
## Debugging
|
|
791
791
|
|
|
@@ -30,8 +30,7 @@ def get_model_info(model: str) -> Tuple[str, str]:
|
|
|
30
30
|
# if the model requiers the legacy fomat, use it, else do nothing.
|
|
31
31
|
if model in LEGACY_MODEL_ID_FORMAT:
|
|
32
32
|
return "-".join(model.split("-")[:-1]), LEGACY_MODEL_ID_FORMAT[model]
|
|
33
|
-
|
|
34
|
-
return model, model
|
|
33
|
+
return model, model
|
|
35
34
|
|
|
36
35
|
|
|
37
36
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from ._version import (
|
|
4
|
+
__title__,
|
|
5
|
+
__version__,
|
|
6
|
+
__openapi_doc_version__,
|
|
7
|
+
__gen_version__,
|
|
8
|
+
__user_agent__,
|
|
9
|
+
)
|
|
10
|
+
from .sdk import *
|
|
11
|
+
from .sdkconfiguration import *
|
|
12
|
+
from .models import *
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
VERSION: str = __version__
|
|
16
|
+
OPENAPI_DOC_VERSION = __openapi_doc_version__
|
|
17
|
+
SPEAKEASY_GENERATOR_VERSION = __gen_version__
|
|
18
|
+
USER_AGENT = __user_agent__
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "mistralai"
|
|
6
|
-
__version__: str = "1.
|
|
6
|
+
__version__: str = "1.5.0"
|
|
7
|
+
__openapi_doc_version__: str = "0.0.2"
|
|
8
|
+
__gen_version__: str = "2.497.0"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 1.5.0 2.497.0 0.0.2 mistralai"
|
|
7
10
|
|
|
8
11
|
try:
|
|
9
12
|
if __package__ is not None:
|
|
@@ -43,11 +43,14 @@ class Agents(BaseSDK):
|
|
|
43
43
|
presence_penalty: Optional[float] = None,
|
|
44
44
|
frequency_penalty: Optional[float] = None,
|
|
45
45
|
n: OptionalNullable[int] = UNSET,
|
|
46
|
+
prediction: Optional[
|
|
47
|
+
Union[models.Prediction, models.PredictionTypedDict]
|
|
48
|
+
] = None,
|
|
46
49
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
47
50
|
server_url: Optional[str] = None,
|
|
48
51
|
timeout_ms: Optional[int] = None,
|
|
49
52
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
50
|
-
) ->
|
|
53
|
+
) -> models.ChatCompletionResponse:
|
|
51
54
|
r"""Agents Completion
|
|
52
55
|
|
|
53
56
|
:param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
|
|
@@ -62,6 +65,7 @@ class Agents(BaseSDK):
|
|
|
62
65
|
:param presence_penalty: presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.
|
|
63
66
|
:param frequency_penalty: frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.
|
|
64
67
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
68
|
+
:param prediction:
|
|
65
69
|
:param retries: Override the default retry configuration for this method
|
|
66
70
|
:param server_url: Override the default server URL for this method
|
|
67
71
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -93,6 +97,9 @@ class Agents(BaseSDK):
|
|
|
93
97
|
presence_penalty=presence_penalty,
|
|
94
98
|
frequency_penalty=frequency_penalty,
|
|
95
99
|
n=n,
|
|
100
|
+
prediction=utils.get_pydantic_model(
|
|
101
|
+
prediction, Optional[models.Prediction]
|
|
102
|
+
),
|
|
96
103
|
agent_id=agent_id,
|
|
97
104
|
)
|
|
98
105
|
|
|
@@ -138,13 +145,16 @@ class Agents(BaseSDK):
|
|
|
138
145
|
|
|
139
146
|
data: Any = None
|
|
140
147
|
if utils.match_response(http_res, "200", "application/json"):
|
|
141
|
-
return utils.unmarshal_json(
|
|
142
|
-
http_res.text, Optional[models.ChatCompletionResponse]
|
|
143
|
-
)
|
|
148
|
+
return utils.unmarshal_json(http_res.text, models.ChatCompletionResponse)
|
|
144
149
|
if utils.match_response(http_res, "422", "application/json"):
|
|
145
150
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
146
151
|
raise models.HTTPValidationError(data=data)
|
|
147
|
-
if utils.match_response(http_res,
|
|
152
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
153
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
154
|
+
raise models.SDKError(
|
|
155
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
156
|
+
)
|
|
157
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
148
158
|
http_res_text = utils.stream_to_text(http_res)
|
|
149
159
|
raise models.SDKError(
|
|
150
160
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -191,11 +201,14 @@ class Agents(BaseSDK):
|
|
|
191
201
|
presence_penalty: Optional[float] = None,
|
|
192
202
|
frequency_penalty: Optional[float] = None,
|
|
193
203
|
n: OptionalNullable[int] = UNSET,
|
|
204
|
+
prediction: Optional[
|
|
205
|
+
Union[models.Prediction, models.PredictionTypedDict]
|
|
206
|
+
] = None,
|
|
194
207
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
195
208
|
server_url: Optional[str] = None,
|
|
196
209
|
timeout_ms: Optional[int] = None,
|
|
197
210
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
198
|
-
) ->
|
|
211
|
+
) -> models.ChatCompletionResponse:
|
|
199
212
|
r"""Agents Completion
|
|
200
213
|
|
|
201
214
|
:param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
|
|
@@ -210,6 +223,7 @@ class Agents(BaseSDK):
|
|
|
210
223
|
:param presence_penalty: presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.
|
|
211
224
|
:param frequency_penalty: frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.
|
|
212
225
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
226
|
+
:param prediction:
|
|
213
227
|
:param retries: Override the default retry configuration for this method
|
|
214
228
|
:param server_url: Override the default server URL for this method
|
|
215
229
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -241,6 +255,9 @@ class Agents(BaseSDK):
|
|
|
241
255
|
presence_penalty=presence_penalty,
|
|
242
256
|
frequency_penalty=frequency_penalty,
|
|
243
257
|
n=n,
|
|
258
|
+
prediction=utils.get_pydantic_model(
|
|
259
|
+
prediction, Optional[models.Prediction]
|
|
260
|
+
),
|
|
244
261
|
agent_id=agent_id,
|
|
245
262
|
)
|
|
246
263
|
|
|
@@ -286,13 +303,16 @@ class Agents(BaseSDK):
|
|
|
286
303
|
|
|
287
304
|
data: Any = None
|
|
288
305
|
if utils.match_response(http_res, "200", "application/json"):
|
|
289
|
-
return utils.unmarshal_json(
|
|
290
|
-
http_res.text, Optional[models.ChatCompletionResponse]
|
|
291
|
-
)
|
|
306
|
+
return utils.unmarshal_json(http_res.text, models.ChatCompletionResponse)
|
|
292
307
|
if utils.match_response(http_res, "422", "application/json"):
|
|
293
308
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
294
309
|
raise models.HTTPValidationError(data=data)
|
|
295
|
-
if utils.match_response(http_res,
|
|
310
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
311
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
312
|
+
raise models.SDKError(
|
|
313
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
314
|
+
)
|
|
315
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
296
316
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
297
317
|
raise models.SDKError(
|
|
298
318
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -339,11 +359,14 @@ class Agents(BaseSDK):
|
|
|
339
359
|
presence_penalty: Optional[float] = None,
|
|
340
360
|
frequency_penalty: Optional[float] = None,
|
|
341
361
|
n: OptionalNullable[int] = UNSET,
|
|
362
|
+
prediction: Optional[
|
|
363
|
+
Union[models.Prediction, models.PredictionTypedDict]
|
|
364
|
+
] = None,
|
|
342
365
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
343
366
|
server_url: Optional[str] = None,
|
|
344
367
|
timeout_ms: Optional[int] = None,
|
|
345
368
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
346
|
-
) ->
|
|
369
|
+
) -> eventstreaming.EventStream[models.CompletionEvent]:
|
|
347
370
|
r"""Stream Agents completion
|
|
348
371
|
|
|
349
372
|
Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
|
|
@@ -360,6 +383,7 @@ class Agents(BaseSDK):
|
|
|
360
383
|
:param presence_penalty: presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.
|
|
361
384
|
:param frequency_penalty: frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.
|
|
362
385
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
386
|
+
:param prediction:
|
|
363
387
|
:param retries: Override the default retry configuration for this method
|
|
364
388
|
:param server_url: Override the default server URL for this method
|
|
365
389
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -391,6 +415,9 @@ class Agents(BaseSDK):
|
|
|
391
415
|
presence_penalty=presence_penalty,
|
|
392
416
|
frequency_penalty=frequency_penalty,
|
|
393
417
|
n=n,
|
|
418
|
+
prediction=utils.get_pydantic_model(
|
|
419
|
+
prediction, Optional[models.Prediction]
|
|
420
|
+
),
|
|
394
421
|
agent_id=agent_id,
|
|
395
422
|
)
|
|
396
423
|
|
|
@@ -446,7 +473,12 @@ class Agents(BaseSDK):
|
|
|
446
473
|
http_res_text = utils.stream_to_text(http_res)
|
|
447
474
|
data = utils.unmarshal_json(http_res_text, models.HTTPValidationErrorData)
|
|
448
475
|
raise models.HTTPValidationError(data=data)
|
|
449
|
-
if utils.match_response(http_res,
|
|
476
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
477
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
478
|
+
raise models.SDKError(
|
|
479
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
480
|
+
)
|
|
481
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
450
482
|
http_res_text = utils.stream_to_text(http_res)
|
|
451
483
|
raise models.SDKError(
|
|
452
484
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -493,11 +525,14 @@ class Agents(BaseSDK):
|
|
|
493
525
|
presence_penalty: Optional[float] = None,
|
|
494
526
|
frequency_penalty: Optional[float] = None,
|
|
495
527
|
n: OptionalNullable[int] = UNSET,
|
|
528
|
+
prediction: Optional[
|
|
529
|
+
Union[models.Prediction, models.PredictionTypedDict]
|
|
530
|
+
] = None,
|
|
496
531
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
497
532
|
server_url: Optional[str] = None,
|
|
498
533
|
timeout_ms: Optional[int] = None,
|
|
499
534
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
500
|
-
) ->
|
|
535
|
+
) -> eventstreaming.EventStreamAsync[models.CompletionEvent]:
|
|
501
536
|
r"""Stream Agents completion
|
|
502
537
|
|
|
503
538
|
Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
|
|
@@ -514,6 +549,7 @@ class Agents(BaseSDK):
|
|
|
514
549
|
:param presence_penalty: presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.
|
|
515
550
|
:param frequency_penalty: frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.
|
|
516
551
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
552
|
+
:param prediction:
|
|
517
553
|
:param retries: Override the default retry configuration for this method
|
|
518
554
|
:param server_url: Override the default server URL for this method
|
|
519
555
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -545,6 +581,9 @@ class Agents(BaseSDK):
|
|
|
545
581
|
presence_penalty=presence_penalty,
|
|
546
582
|
frequency_penalty=frequency_penalty,
|
|
547
583
|
n=n,
|
|
584
|
+
prediction=utils.get_pydantic_model(
|
|
585
|
+
prediction, Optional[models.Prediction]
|
|
586
|
+
),
|
|
548
587
|
agent_id=agent_id,
|
|
549
588
|
)
|
|
550
589
|
|
|
@@ -600,7 +639,12 @@ class Agents(BaseSDK):
|
|
|
600
639
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
601
640
|
data = utils.unmarshal_json(http_res_text, models.HTTPValidationErrorData)
|
|
602
641
|
raise models.HTTPValidationError(data=data)
|
|
603
|
-
if utils.match_response(http_res,
|
|
642
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
643
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
644
|
+
raise models.SDKError(
|
|
645
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
646
|
+
)
|
|
647
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
604
648
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
605
649
|
raise models.SDKError(
|
|
606
650
|
"API error occurred", http_res.status_code, http_res_text, http_res
|