mistralai 0.4.2__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.
Files changed (254) hide show
  1. {mistralai-0.4.2 → mistralai-1.0.0}/LICENSE +1 -1
  2. mistralai-1.0.0/PKG-INFO +695 -0
  3. mistralai-1.0.0/README.md +672 -0
  4. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/__init__.py +5 -0
  5. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/_hooks/__init__.py +5 -0
  6. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/_hooks/custom_user_agent.py +16 -0
  7. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/_hooks/registration.py +15 -0
  8. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/_hooks/sdkhooks.py +57 -0
  9. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/_hooks/types.py +76 -0
  10. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/basesdk.py +253 -0
  11. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/chat.py +470 -0
  12. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/httpclient.py +78 -0
  13. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/__init__.py +28 -0
  14. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/assistantmessage.py +53 -0
  15. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionchoice.py +22 -0
  16. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionrequest.py +109 -0
  17. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionresponse.py +27 -0
  18. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/chatcompletionstreamrequest.py +107 -0
  19. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/completionchunk.py +27 -0
  20. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/completionevent.py +15 -0
  21. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/completionresponsestreamchoice.py +48 -0
  22. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/contentchunk.py +17 -0
  23. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/deltamessage.py +47 -0
  24. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/function.py +19 -0
  25. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/functioncall.py +22 -0
  26. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/httpvalidationerror.py +23 -0
  27. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/responseformat.py +18 -0
  28. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/sdkerror.py +22 -0
  29. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/security.py +16 -0
  30. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/systemmessage.py +26 -0
  31. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/textchunk.py +17 -0
  32. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/tool.py +18 -0
  33. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/toolcall.py +20 -0
  34. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/toolmessage.py +50 -0
  35. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/usageinfo.py +18 -0
  36. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/usermessage.py +26 -0
  37. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/models/validationerror.py +24 -0
  38. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/py.typed +1 -0
  39. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/sdk.py +107 -0
  40. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/sdkconfiguration.py +54 -0
  41. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/types/__init__.py +21 -0
  42. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/types/basemodel.py +39 -0
  43. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/__init__.py +84 -0
  44. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/annotations.py +19 -0
  45. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/enums.py +34 -0
  46. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/eventstreaming.py +178 -0
  47. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/forms.py +207 -0
  48. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/headers.py +136 -0
  49. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/logger.py +16 -0
  50. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/metadata.py +118 -0
  51. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/queryparams.py +203 -0
  52. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/requestbodies.py +66 -0
  53. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/retries.py +216 -0
  54. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/security.py +168 -0
  55. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/serializers.py +181 -0
  56. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/url.py +150 -0
  57. mistralai-1.0.0/packages/mistralai_azure/src/mistralai_azure/utils/values.py +128 -0
  58. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/__init__.py +5 -0
  59. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/_hooks/__init__.py +5 -0
  60. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/_hooks/custom_user_agent.py +16 -0
  61. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/_hooks/registration.py +15 -0
  62. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/_hooks/sdkhooks.py +57 -0
  63. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/_hooks/types.py +76 -0
  64. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/basesdk.py +253 -0
  65. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/chat.py +458 -0
  66. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/fim.py +438 -0
  67. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/httpclient.py +78 -0
  68. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/__init__.py +31 -0
  69. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/assistantmessage.py +53 -0
  70. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionchoice.py +22 -0
  71. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionrequest.py +105 -0
  72. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionresponse.py +27 -0
  73. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/chatcompletionstreamrequest.py +103 -0
  74. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/completionchunk.py +27 -0
  75. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/completionevent.py +15 -0
  76. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/completionresponsestreamchoice.py +48 -0
  77. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/contentchunk.py +17 -0
  78. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/deltamessage.py +47 -0
  79. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/fimcompletionrequest.py +94 -0
  80. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/fimcompletionresponse.py +27 -0
  81. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/fimcompletionstreamrequest.py +92 -0
  82. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/function.py +19 -0
  83. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/functioncall.py +22 -0
  84. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/httpvalidationerror.py +23 -0
  85. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/responseformat.py +18 -0
  86. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/sdkerror.py +22 -0
  87. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/security.py +16 -0
  88. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/systemmessage.py +26 -0
  89. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/textchunk.py +17 -0
  90. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/tool.py +18 -0
  91. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/toolcall.py +20 -0
  92. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/toolmessage.py +50 -0
  93. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/usageinfo.py +18 -0
  94. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/usermessage.py +26 -0
  95. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/models/validationerror.py +24 -0
  96. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/py.typed +1 -0
  97. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/sdk.py +174 -0
  98. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/sdkconfiguration.py +54 -0
  99. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/types/__init__.py +21 -0
  100. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/types/basemodel.py +39 -0
  101. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/__init__.py +84 -0
  102. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/annotations.py +19 -0
  103. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/enums.py +34 -0
  104. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/eventstreaming.py +178 -0
  105. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/forms.py +207 -0
  106. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/headers.py +136 -0
  107. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/logger.py +16 -0
  108. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/metadata.py +118 -0
  109. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/queryparams.py +203 -0
  110. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/requestbodies.py +66 -0
  111. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/retries.py +216 -0
  112. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/security.py +168 -0
  113. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/serializers.py +181 -0
  114. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/url.py +150 -0
  115. mistralai-1.0.0/packages/mistralai_gcp/src/mistralai_gcp/utils/values.py +128 -0
  116. mistralai-1.0.0/py.typed +1 -0
  117. mistralai-1.0.0/pyproject.toml +53 -0
  118. mistralai-1.0.0/src/mistralai/__init__.py +5 -0
  119. mistralai-1.0.0/src/mistralai/_hooks/__init__.py +5 -0
  120. mistralai-1.0.0/src/mistralai/_hooks/custom_user_agent.py +16 -0
  121. mistralai-1.0.0/src/mistralai/_hooks/deprecation_warning.py +26 -0
  122. mistralai-1.0.0/src/mistralai/_hooks/registration.py +17 -0
  123. mistralai-1.0.0/src/mistralai/_hooks/sdkhooks.py +57 -0
  124. mistralai-1.0.0/src/mistralai/_hooks/types.py +76 -0
  125. mistralai-1.0.0/src/mistralai/agents.py +434 -0
  126. mistralai-1.0.0/src/mistralai/async_client.py +15 -0
  127. mistralai-1.0.0/src/mistralai/basesdk.py +253 -0
  128. mistralai-1.0.0/src/mistralai/chat.py +470 -0
  129. mistralai-1.0.0/src/mistralai/client.py +14 -0
  130. mistralai-1.0.0/src/mistralai/embeddings.py +182 -0
  131. mistralai-1.0.0/src/mistralai/files.py +600 -0
  132. mistralai-1.0.0/src/mistralai/fim.py +438 -0
  133. mistralai-1.0.0/src/mistralai/fine_tuning.py +16 -0
  134. mistralai-1.0.0/src/mistralai/httpclient.py +78 -0
  135. mistralai-1.0.0/src/mistralai/jobs.py +844 -0
  136. mistralai-1.0.0/src/mistralai/models/__init__.py +82 -0
  137. mistralai-1.0.0/src/mistralai/models/agentscompletionrequest.py +96 -0
  138. mistralai-1.0.0/src/mistralai/models/agentscompletionstreamrequest.py +92 -0
  139. mistralai-1.0.0/src/mistralai/models/archiveftmodelout.py +19 -0
  140. mistralai-1.0.0/src/mistralai/models/assistantmessage.py +53 -0
  141. mistralai-1.0.0/src/mistralai/models/chatcompletionchoice.py +22 -0
  142. mistralai-1.0.0/src/mistralai/models/chatcompletionrequest.py +109 -0
  143. mistralai-1.0.0/src/mistralai/models/chatcompletionresponse.py +27 -0
  144. mistralai-1.0.0/src/mistralai/models/chatcompletionstreamrequest.py +107 -0
  145. mistralai-1.0.0/src/mistralai/models/checkpointout.py +25 -0
  146. mistralai-1.0.0/src/mistralai/models/completionchunk.py +27 -0
  147. mistralai-1.0.0/src/mistralai/models/completionevent.py +15 -0
  148. mistralai-1.0.0/src/mistralai/models/completionresponsestreamchoice.py +48 -0
  149. mistralai-1.0.0/src/mistralai/models/contentchunk.py +17 -0
  150. mistralai-1.0.0/src/mistralai/models/delete_model_v1_models_model_id_deleteop.py +18 -0
  151. mistralai-1.0.0/src/mistralai/models/deletefileout.py +24 -0
  152. mistralai-1.0.0/src/mistralai/models/deletemodelout.py +25 -0
  153. mistralai-1.0.0/src/mistralai/models/deltamessage.py +47 -0
  154. mistralai-1.0.0/src/mistralai/models/detailedjobout.py +91 -0
  155. mistralai-1.0.0/src/mistralai/models/embeddingrequest.py +61 -0
  156. mistralai-1.0.0/src/mistralai/models/embeddingresponse.py +24 -0
  157. mistralai-1.0.0/src/mistralai/models/embeddingresponsedata.py +19 -0
  158. mistralai-1.0.0/src/mistralai/models/eventout.py +50 -0
  159. mistralai-1.0.0/src/mistralai/models/files_api_routes_delete_fileop.py +16 -0
  160. mistralai-1.0.0/src/mistralai/models/files_api_routes_retrieve_fileop.py +16 -0
  161. mistralai-1.0.0/src/mistralai/models/files_api_routes_upload_fileop.py +51 -0
  162. mistralai-1.0.0/src/mistralai/models/fileschema.py +71 -0
  163. mistralai-1.0.0/src/mistralai/models/fimcompletionrequest.py +94 -0
  164. mistralai-1.0.0/src/mistralai/models/fimcompletionresponse.py +27 -0
  165. mistralai-1.0.0/src/mistralai/models/fimcompletionstreamrequest.py +92 -0
  166. mistralai-1.0.0/src/mistralai/models/finetuneablemodel.py +8 -0
  167. mistralai-1.0.0/src/mistralai/models/ftmodelcapabilitiesout.py +21 -0
  168. mistralai-1.0.0/src/mistralai/models/ftmodelout.py +65 -0
  169. mistralai-1.0.0/src/mistralai/models/function.py +19 -0
  170. mistralai-1.0.0/src/mistralai/models/functioncall.py +22 -0
  171. mistralai-1.0.0/src/mistralai/models/githubrepositoryin.py +52 -0
  172. mistralai-1.0.0/src/mistralai/models/githubrepositoryout.py +52 -0
  173. mistralai-1.0.0/src/mistralai/models/httpvalidationerror.py +23 -0
  174. mistralai-1.0.0/src/mistralai/models/jobin.py +73 -0
  175. mistralai-1.0.0/src/mistralai/models/jobmetadataout.py +54 -0
  176. mistralai-1.0.0/src/mistralai/models/jobout.py +107 -0
  177. mistralai-1.0.0/src/mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +18 -0
  178. mistralai-1.0.0/src/mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +18 -0
  179. mistralai-1.0.0/src/mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +15 -0
  180. mistralai-1.0.0/src/mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +18 -0
  181. mistralai-1.0.0/src/mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +81 -0
  182. mistralai-1.0.0/src/mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +16 -0
  183. mistralai-1.0.0/src/mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +18 -0
  184. mistralai-1.0.0/src/mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +21 -0
  185. mistralai-1.0.0/src/mistralai/models/jobsout.py +20 -0
  186. mistralai-1.0.0/src/mistralai/models/legacyjobmetadataout.py +80 -0
  187. mistralai-1.0.0/src/mistralai/models/listfilesout.py +17 -0
  188. mistralai-1.0.0/src/mistralai/models/metricout.py +50 -0
  189. mistralai-1.0.0/src/mistralai/models/modelcapabilities.py +21 -0
  190. mistralai-1.0.0/src/mistralai/models/modelcard.py +66 -0
  191. mistralai-1.0.0/src/mistralai/models/modellist.py +18 -0
  192. mistralai-1.0.0/src/mistralai/models/responseformat.py +18 -0
  193. mistralai-1.0.0/src/mistralai/models/retrieve_model_v1_models_model_id_getop.py +18 -0
  194. mistralai-1.0.0/src/mistralai/models/retrievefileout.py +71 -0
  195. mistralai-1.0.0/src/mistralai/models/sampletype.py +7 -0
  196. mistralai-1.0.0/src/mistralai/models/sdkerror.py +22 -0
  197. mistralai-1.0.0/src/mistralai/models/security.py +16 -0
  198. mistralai-1.0.0/src/mistralai/models/source.py +7 -0
  199. mistralai-1.0.0/src/mistralai/models/systemmessage.py +26 -0
  200. mistralai-1.0.0/src/mistralai/models/textchunk.py +17 -0
  201. mistralai-1.0.0/src/mistralai/models/tool.py +18 -0
  202. mistralai-1.0.0/src/mistralai/models/toolcall.py +20 -0
  203. mistralai-1.0.0/src/mistralai/models/toolmessage.py +50 -0
  204. mistralai-1.0.0/src/mistralai/models/trainingfile.py +17 -0
  205. mistralai-1.0.0/src/mistralai/models/trainingparameters.py +48 -0
  206. mistralai-1.0.0/src/mistralai/models/trainingparametersin.py +56 -0
  207. mistralai-1.0.0/src/mistralai/models/unarchiveftmodelout.py +19 -0
  208. mistralai-1.0.0/src/mistralai/models/updateftmodelin.py +44 -0
  209. mistralai-1.0.0/src/mistralai/models/uploadfileout.py +71 -0
  210. mistralai-1.0.0/src/mistralai/models/usageinfo.py +18 -0
  211. mistralai-1.0.0/src/mistralai/models/usermessage.py +26 -0
  212. mistralai-1.0.0/src/mistralai/models/validationerror.py +24 -0
  213. mistralai-1.0.0/src/mistralai/models/wandbintegration.py +56 -0
  214. mistralai-1.0.0/src/mistralai/models/wandbintegrationout.py +52 -0
  215. mistralai-1.0.0/src/mistralai/models_.py +928 -0
  216. mistralai-1.0.0/src/mistralai/py.typed +1 -0
  217. mistralai-1.0.0/src/mistralai/sdk.py +119 -0
  218. mistralai-1.0.0/src/mistralai/sdkconfiguration.py +54 -0
  219. mistralai-1.0.0/src/mistralai/types/__init__.py +21 -0
  220. mistralai-1.0.0/src/mistralai/types/basemodel.py +39 -0
  221. mistralai-1.0.0/src/mistralai/utils/__init__.py +86 -0
  222. mistralai-1.0.0/src/mistralai/utils/annotations.py +19 -0
  223. mistralai-1.0.0/src/mistralai/utils/enums.py +34 -0
  224. mistralai-1.0.0/src/mistralai/utils/eventstreaming.py +178 -0
  225. mistralai-1.0.0/src/mistralai/utils/forms.py +207 -0
  226. mistralai-1.0.0/src/mistralai/utils/headers.py +136 -0
  227. mistralai-1.0.0/src/mistralai/utils/logger.py +16 -0
  228. mistralai-1.0.0/src/mistralai/utils/metadata.py +118 -0
  229. mistralai-1.0.0/src/mistralai/utils/queryparams.py +203 -0
  230. mistralai-1.0.0/src/mistralai/utils/requestbodies.py +66 -0
  231. mistralai-1.0.0/src/mistralai/utils/retries.py +216 -0
  232. mistralai-1.0.0/src/mistralai/utils/security.py +185 -0
  233. mistralai-1.0.0/src/mistralai/utils/serializers.py +181 -0
  234. mistralai-1.0.0/src/mistralai/utils/url.py +150 -0
  235. mistralai-1.0.0/src/mistralai/utils/values.py +128 -0
  236. mistralai-0.4.2/PKG-INFO +0 -82
  237. mistralai-0.4.2/README.md +0 -62
  238. mistralai-0.4.2/pyproject.toml +0 -42
  239. mistralai-0.4.2/src/mistralai/__init__.py +0 -0
  240. mistralai-0.4.2/src/mistralai/async_client.py +0 -423
  241. mistralai-0.4.2/src/mistralai/client.py +0 -423
  242. mistralai-0.4.2/src/mistralai/client_base.py +0 -211
  243. mistralai-0.4.2/src/mistralai/constants.py +0 -5
  244. mistralai-0.4.2/src/mistralai/exceptions.py +0 -54
  245. mistralai-0.4.2/src/mistralai/files.py +0 -84
  246. mistralai-0.4.2/src/mistralai/jobs.py +0 -172
  247. mistralai-0.4.2/src/mistralai/models/__init__.py +0 -0
  248. mistralai-0.4.2/src/mistralai/models/chat_completion.py +0 -93
  249. mistralai-0.4.2/src/mistralai/models/common.py +0 -9
  250. mistralai-0.4.2/src/mistralai/models/embeddings.py +0 -19
  251. mistralai-0.4.2/src/mistralai/models/files.py +0 -23
  252. mistralai-0.4.2/src/mistralai/models/jobs.py +0 -100
  253. mistralai-0.4.2/src/mistralai/models/models.py +0 -39
  254. mistralai-0.4.2/src/mistralai/py.typed +0 -0
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2024 Mistral AI
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -0,0 +1,695 @@
1
+ Metadata-Version: 2.1
2
+ Name: mistralai
3
+ Version: 1.0.0
4
+ Summary: Python Client SDK for the Mistral AI API.
5
+ Author: Mistral
6
+ Requires-Python: >=3.8,<4.0
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.8
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Provides-Extra: gcp
14
+ Requires-Dist: google-auth (>=2.31.0,<3.0.0) ; extra == "gcp"
15
+ Requires-Dist: httpx (>=0.27.0,<0.28.0)
16
+ Requires-Dist: jsonpath-python (>=1.0.6,<2.0.0)
17
+ Requires-Dist: pydantic (>=2.8.2,<2.9.0)
18
+ Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
19
+ Requires-Dist: requests (>=2.32.3,<3.0.0) ; extra == "gcp"
20
+ Requires-Dist: typing-inspect (>=0.9.0,<0.10.0)
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Mistral Python Client
24
+
25
+ ## Migration warning
26
+
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
+ ```
43
+
44
+ <!-- Start SDK Installation [installation] -->
45
+ ## SDK Installation
46
+
47
+ PIP
48
+ ```bash
49
+ pip install mistralai
50
+ ```
51
+
52
+ Poetry
53
+ ```bash
54
+ poetry add mistralai
55
+ ```
56
+ <!-- End SDK Installation [installation] -->
57
+
58
+ <!-- Start SDK Example Usage [usage] -->
59
+ ## SDK Example Usage
60
+
61
+ ### Create Chat Completions
62
+
63
+ This example shows how to create chat completions.
64
+
65
+ ```python
66
+ # Synchronous Example
67
+ from mistralai import Mistral
68
+ import os
69
+
70
+ s = Mistral(
71
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
72
+ )
73
+
74
+
75
+ res = s.chat.complete(model="mistral-small-latest", messages=[
76
+ {
77
+ "content": "Who is the best French painter? Answer in one short sentence.",
78
+ "role": "user",
79
+ },
80
+ ])
81
+
82
+ if res is not None:
83
+ # handle response
84
+ pass
85
+ ```
86
+
87
+ </br>
88
+
89
+ The same SDK client can also be used to make asychronous requests by importing asyncio.
90
+ ```python
91
+ # Asynchronous Example
92
+ import asyncio
93
+ from mistralai import Mistral
94
+ import os
95
+
96
+ async def main():
97
+ s = Mistral(
98
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
99
+ )
100
+ res = await s.chat.complete_async(model="mistral-small-latest", messages=[
101
+ {
102
+ "content": "Who is the best French painter? Answer in one short sentence.",
103
+ "role": "user",
104
+ },
105
+ ])
106
+ if res is not None:
107
+ # handle response
108
+ pass
109
+
110
+ asyncio.run(main())
111
+ ```
112
+
113
+ ### Upload a file
114
+
115
+ This example shows how to upload a file.
116
+
117
+ ```python
118
+ # Synchronous Example
119
+ from mistralai import Mistral
120
+ import os
121
+
122
+ s = Mistral(
123
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
124
+ )
125
+
126
+
127
+ res = s.files.upload(file={
128
+ "file_name": "your_file_here",
129
+ "content": open("<file_path>", "rb"),
130
+ })
131
+
132
+ if res is not None:
133
+ # handle response
134
+ pass
135
+ ```
136
+
137
+ </br>
138
+
139
+ The same SDK client can also be used to make asychronous requests by importing asyncio.
140
+ ```python
141
+ # Asynchronous Example
142
+ import asyncio
143
+ from mistralai import Mistral
144
+ import os
145
+
146
+ async def main():
147
+ s = Mistral(
148
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
149
+ )
150
+ res = await s.files.upload_async(file={
151
+ "file_name": "your_file_here",
152
+ "content": open("<file_path>", "rb"),
153
+ })
154
+ if res is not None:
155
+ # handle response
156
+ pass
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
+
210
+ asyncio.run(main())
211
+ ```
212
+ <!-- End SDK Example Usage [usage] -->
213
+
214
+
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
223
+
224
+ **Prerequisites**
225
+
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.
227
+ See [instructions for deploying Mistral on Azure AI here](https://docs.mistral.ai/deployment/cloud/azure/).
228
+
229
+ Here's a basic example to get you started. You can also run [the example in the `examples` directory](/examples/azure).
230
+
231
+ ```python
232
+ import asyncio
233
+ import os
234
+
235
+ from mistralai_azure import MistralAzure
236
+
237
+ client = MistralAzure(
238
+ azure_api_key=os.getenv("AZURE_API_KEY", ""),
239
+ azure_endpoint=os.getenv("AZURE_ENDPOINT", "")
240
+ )
241
+
242
+ async def main() -> None:
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
+ ]
252
+ )
253
+ print(res)
254
+
255
+ asyncio.run(main())
256
+ ```
257
+ The documentation for the Azure SDK is available [here](packages/mistralai_azure/README.md).
258
+
259
+ ### Google Cloud
260
+
261
+
262
+ **Prerequisites**
263
+
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/).
265
+
266
+ To run this locally you will also need to ensure you are authenticated with Google Cloud. You can do this by running
267
+
268
+ ```bash
269
+ gcloud auth application-default login
270
+ ```
271
+
272
+ **Step 1: Install**
273
+
274
+ Install the extras dependencies specific to Google Cloud:
275
+
276
+ ```bash
277
+ pip install mistralai[gcp]
278
+ ```
279
+
280
+ **Step 2: Example Usage**
281
+
282
+ Here's a basic example to get you started.
283
+
284
+ ```python
285
+ import asyncio
286
+ from mistralai_gcp import MistralGoogleCloud
287
+
288
+ client = MistralGoogleCloud()
289
+
290
+
291
+ async def main() -> None:
292
+ res = await client.chat.complete_async(
293
+ model= "mistral-small-2402",
294
+ messages= [
295
+ {
296
+ "content": "Hello there!",
297
+ "role": "user"
298
+ }
299
+ ]
300
+ )
301
+ print(res)
302
+
303
+ asyncio.run(main())
304
+ ```
305
+
306
+ The documentation for the GCP SDK is available [here](packages/mistralai_gcp/README.md).
307
+
308
+
309
+ <!-- Start Available Resources and Operations [operations] -->
310
+ ## Available Resources and Operations
311
+
312
+ ### [models](docs/sdks/models/README.md)
313
+
314
+ * [list](docs/sdks/models/README.md#list) - List Models
315
+ * [retrieve](docs/sdks/models/README.md#retrieve) - Retrieve Model
316
+ * [delete](docs/sdks/models/README.md#delete) - Delete Model
317
+ * [update](docs/sdks/models/README.md#update) - Update Fine Tuned Model
318
+ * [archive](docs/sdks/models/README.md#archive) - Archive Fine Tuned Model
319
+ * [unarchive](docs/sdks/models/README.md#unarchive) - Unarchive Fine Tuned Model
320
+
321
+ ### [files](docs/sdks/files/README.md)
322
+
323
+ * [upload](docs/sdks/files/README.md#upload) - Upload File
324
+ * [list](docs/sdks/files/README.md#list) - List Files
325
+ * [retrieve](docs/sdks/files/README.md#retrieve) - Retrieve File
326
+ * [delete](docs/sdks/files/README.md#delete) - Delete File
327
+
328
+
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
336
+
337
+ ### [chat](docs/sdks/chat/README.md)
338
+
339
+ * [complete](docs/sdks/chat/README.md#complete) - Chat Completion
340
+ * [stream](docs/sdks/chat/README.md#stream) - Stream chat completion
341
+
342
+ ### [fim](docs/sdks/fim/README.md)
343
+
344
+ * [complete](docs/sdks/fim/README.md#complete) - Fim Completion
345
+ * [stream](docs/sdks/fim/README.md#stream) - Stream fim completion
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
+
352
+ ### [embeddings](docs/sdks/embeddings/README.md)
353
+
354
+ * [create](docs/sdks/embeddings/README.md#create) - Embeddings
355
+ <!-- End Available Resources and Operations [operations] -->
356
+
357
+ <!-- Start Server-sent event streaming [eventstream] -->
358
+ ## Server-sent event streaming
359
+
360
+ [Server-sent events][mdn-sse] are used to stream content from certain
361
+ operations. These operations will expose the stream as [Generator][generator] that
362
+ can be consumed using a simple `for` loop. The loop will
363
+ terminate when the server no longer has any events to send and closes the
364
+ underlying connection.
365
+
366
+ ```python
367
+ from mistralai import Mistral
368
+ import os
369
+
370
+ s = Mistral(
371
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
372
+ )
373
+
374
+
375
+ res = s.chat.stream(model="mistral-small-latest", messages=[
376
+ {
377
+ "content": "Who is the best French painter? Answer in one short sentence.",
378
+ "role": "user",
379
+ },
380
+ ])
381
+
382
+ if res is not None:
383
+ for event in res:
384
+ # handle event
385
+ print(event, flush=True)
386
+
387
+ ```
388
+
389
+ [mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
390
+ [generator]: https://wiki.python.org/moin/Generators
391
+ <!-- End Server-sent event streaming [eventstream] -->
392
+
393
+ <!-- Start File uploads [file-upload] -->
394
+ ## File uploads
395
+
396
+ Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
397
+
398
+ > [!TIP]
399
+ >
400
+ > For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
401
+ >
402
+
403
+ ```python
404
+ from mistralai import Mistral
405
+ import os
406
+
407
+ s = Mistral(
408
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
409
+ )
410
+
411
+
412
+ res = s.files.upload(file={
413
+ "file_name": "your_file_here",
414
+ "content": open("<file_path>", "rb"),
415
+ })
416
+
417
+ if res is not None:
418
+ # handle response
419
+ pass
420
+
421
+ ```
422
+ <!-- End File uploads [file-upload] -->
423
+
424
+ <!-- Start Retries [retries] -->
425
+ ## Retries
426
+
427
+ Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
428
+
429
+ To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
430
+ ```python
431
+ from mistral.utils import BackoffStrategy, RetryConfig
432
+ from mistralai import Mistral
433
+ import os
434
+
435
+ s = Mistral(
436
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
437
+ )
438
+
439
+
440
+ res = s.models.list(,
441
+ RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
442
+
443
+ if res is not None:
444
+ # handle response
445
+ pass
446
+
447
+ ```
448
+
449
+ If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
450
+ ```python
451
+ from mistral.utils import BackoffStrategy, RetryConfig
452
+ from mistralai import Mistral
453
+ import os
454
+
455
+ s = Mistral(
456
+ retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
457
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
458
+ )
459
+
460
+
461
+ res = s.models.list()
462
+
463
+ if res is not None:
464
+ # handle response
465
+ pass
466
+
467
+ ```
468
+ <!-- End Retries [retries] -->
469
+
470
+ <!-- Start Error Handling [errors] -->
471
+ ## Error Handling
472
+
473
+ Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
474
+
475
+ | Error Object | Status Code | Content Type |
476
+ | -------------------------- | -------------------------- | -------------------------- |
477
+ | models.HTTPValidationError | 422 | application/json |
478
+ | models.SDKError | 4xx-5xx | */* |
479
+
480
+ ### Example
481
+
482
+ ```python
483
+ from mistralai import Mistral, models
484
+ import os
485
+
486
+ s = Mistral(
487
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
488
+ )
489
+
490
+ res = None
491
+ try:
492
+ res = s.models.list()
493
+
494
+ except models.HTTPValidationError as e:
495
+ # handle exception
496
+ raise(e)
497
+ except models.SDKError as e:
498
+ # handle exception
499
+ raise(e)
500
+
501
+ if res is not None:
502
+ # handle response
503
+ pass
504
+
505
+ ```
506
+ <!-- End Error Handling [errors] -->
507
+
508
+ <!-- Start Server Selection [server] -->
509
+ ## Server Selection
510
+
511
+ ### Select Server by Name
512
+
513
+ You can override the default server globally by passing a server name to the `server: str` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
514
+
515
+ | Name | Server | Variables |
516
+ | ----- | ------ | --------- |
517
+ | `prod` | `https://api.mistral.ai` | None |
518
+
519
+ #### Example
520
+
521
+ ```python
522
+ from mistralai import Mistral
523
+ import os
524
+
525
+ s = Mistral(
526
+ server="prod",
527
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
528
+ )
529
+
530
+
531
+ res = s.models.list()
532
+
533
+ if res is not None:
534
+ # handle response
535
+ pass
536
+
537
+ ```
538
+
539
+
540
+ ### Override Server URL Per-Client
541
+
542
+ The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
543
+ ```python
544
+ from mistralai import Mistral
545
+ import os
546
+
547
+ s = Mistral(
548
+ server_url="https://api.mistral.ai",
549
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
550
+ )
551
+
552
+
553
+ res = s.models.list()
554
+
555
+ if res is not None:
556
+ # handle response
557
+ pass
558
+
559
+ ```
560
+ <!-- End Server Selection [server] -->
561
+
562
+ <!-- Start Custom HTTP Client [http-client] -->
563
+ ## Custom HTTP Client
564
+
565
+ The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
566
+ Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
567
+ This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
568
+
569
+ For example, you could specify a header for every request that this sdk makes as follows:
570
+ ```python
571
+ from mistralai import Mistral
572
+ import httpx
573
+
574
+ http_client = httpx.Client(headers={"x-custom-header": "someValue"})
575
+ s = Mistral(client=http_client)
576
+ ```
577
+
578
+ or you could wrap the client with your own custom logic:
579
+ ```python
580
+ from mistralai import Mistral
581
+ from mistralai.httpclient import AsyncHttpClient
582
+ import httpx
583
+
584
+ class CustomClient(AsyncHttpClient):
585
+ client: AsyncHttpClient
586
+
587
+ def __init__(self, client: AsyncHttpClient):
588
+ self.client = client
589
+
590
+ async def send(
591
+ self,
592
+ request: httpx.Request,
593
+ *,
594
+ stream: bool = False,
595
+ auth: Union[
596
+ httpx._types.AuthTypes, httpx._client.UseClientDefault, None
597
+ ] = httpx.USE_CLIENT_DEFAULT,
598
+ follow_redirects: Union[
599
+ bool, httpx._client.UseClientDefault
600
+ ] = httpx.USE_CLIENT_DEFAULT,
601
+ ) -> httpx.Response:
602
+ request.headers["Client-Level-Header"] = "added by client"
603
+
604
+ return await self.client.send(
605
+ request, stream=stream, auth=auth, follow_redirects=follow_redirects
606
+ )
607
+
608
+ def build_request(
609
+ self,
610
+ method: str,
611
+ url: httpx._types.URLTypes,
612
+ *,
613
+ content: Optional[httpx._types.RequestContent] = None,
614
+ data: Optional[httpx._types.RequestData] = None,
615
+ files: Optional[httpx._types.RequestFiles] = None,
616
+ json: Optional[Any] = None,
617
+ params: Optional[httpx._types.QueryParamTypes] = None,
618
+ headers: Optional[httpx._types.HeaderTypes] = None,
619
+ cookies: Optional[httpx._types.CookieTypes] = None,
620
+ timeout: Union[
621
+ httpx._types.TimeoutTypes, httpx._client.UseClientDefault
622
+ ] = httpx.USE_CLIENT_DEFAULT,
623
+ extensions: Optional[httpx._types.RequestExtensions] = None,
624
+ ) -> httpx.Request:
625
+ return self.client.build_request(
626
+ method,
627
+ url,
628
+ content=content,
629
+ data=data,
630
+ files=files,
631
+ json=json,
632
+ params=params,
633
+ headers=headers,
634
+ cookies=cookies,
635
+ timeout=timeout,
636
+ extensions=extensions,
637
+ )
638
+
639
+ s = Mistral(async_client=CustomClient(httpx.AsyncClient()))
640
+ ```
641
+ <!-- End Custom HTTP Client [http-client] -->
642
+
643
+ <!-- Start Authentication [security] -->
644
+ ## Authentication
645
+
646
+ ### Per-Client Security Schemes
647
+
648
+ This SDK supports the following security scheme globally:
649
+
650
+ | Name | Type | Scheme | Environment Variable |
651
+ | -------------------- | -------------------- | -------------------- | -------------------- |
652
+ | `api_key` | http | HTTP Bearer | `MISTRAL_API_KEY` |
653
+
654
+ To authenticate with the API the `null` parameter must be set when initializing the SDK client instance. For example:
655
+ ```python
656
+ from mistralai import Mistral
657
+ import os
658
+
659
+ s = Mistral(
660
+ api_key=os.getenv("MISTRAL_API_KEY", ""),
661
+ )
662
+
663
+
664
+ res = s.models.list()
665
+
666
+ if res is not None:
667
+ # handle response
668
+ pass
669
+
670
+ ```
671
+ <!-- End Authentication [security] -->
672
+
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.
677
+
678
+ ```python
679
+ from mistralai import Mistral
680
+ import logging
681
+
682
+ logging.basicConfig(level=logging.DEBUG)
683
+ s = Mistral(debug_logger=logging.getLogger("mistralai"))
684
+ ```
685
+ <!-- End Debugging [debug] -->
686
+
687
+ <!-- Placeholder for Future Speakeasy SDK Sections -->
688
+
689
+ # Development
690
+
691
+ ## Contributions
692
+
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.
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.
695
+