mistralai 0.5.5a50__py3-none-any.whl → 1.0.0rc2__py3-none-any.whl

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 (96) hide show
  1. mistralai/agents.py +434 -0
  2. mistralai/basesdk.py +43 -6
  3. mistralai/chat.py +29 -34
  4. mistralai/embeddings.py +4 -4
  5. mistralai/files.py +10 -10
  6. mistralai/fim.py +17 -18
  7. mistralai/fine_tuning.py +10 -849
  8. mistralai/jobs.py +854 -0
  9. mistralai/models/__init__.py +4 -2
  10. mistralai/models/agentscompletionrequest.py +96 -0
  11. mistralai/models/agentscompletionstreamrequest.py +92 -0
  12. mistralai/models/assistantmessage.py +4 -9
  13. mistralai/models/chatcompletionchoice.py +4 -15
  14. mistralai/models/chatcompletionrequest.py +11 -16
  15. mistralai/models/chatcompletionstreamrequest.py +11 -16
  16. mistralai/models/completionresponsestreamchoice.py +4 -9
  17. mistralai/models/deltamessage.py +4 -9
  18. mistralai/models/detailedjobout.py +4 -9
  19. mistralai/models/embeddingrequest.py +4 -9
  20. mistralai/models/eventout.py +4 -9
  21. mistralai/models/fileschema.py +4 -9
  22. mistralai/models/fimcompletionrequest.py +11 -16
  23. mistralai/models/fimcompletionstreamrequest.py +11 -16
  24. mistralai/models/ftmodelout.py +4 -9
  25. mistralai/models/githubrepositoryin.py +4 -9
  26. mistralai/models/githubrepositoryout.py +4 -9
  27. mistralai/models/httpvalidationerror.py +1 -1
  28. mistralai/models/jobin.py +4 -9
  29. mistralai/models/jobmetadataout.py +4 -9
  30. mistralai/models/jobout.py +4 -9
  31. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +4 -9
  32. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +4 -9
  33. mistralai/models/legacyjobmetadataout.py +4 -9
  34. mistralai/models/metricout.py +4 -9
  35. mistralai/models/modelcard.py +4 -9
  36. mistralai/models/retrievefileout.py +4 -9
  37. mistralai/models/security.py +4 -4
  38. mistralai/models/toolmessage.py +4 -9
  39. mistralai/models/trainingparameters.py +4 -9
  40. mistralai/models/trainingparametersin.py +4 -9
  41. mistralai/models/updateftmodelin.py +4 -9
  42. mistralai/models/uploadfileout.py +4 -9
  43. mistralai/models/wandbintegration.py +4 -9
  44. mistralai/models/wandbintegrationout.py +4 -9
  45. mistralai/models_.py +14 -14
  46. mistralai/sdk.py +14 -6
  47. mistralai/sdkconfiguration.py +5 -4
  48. mistralai/types/basemodel.py +10 -6
  49. mistralai/utils/__init__.py +4 -0
  50. mistralai/utils/eventstreaming.py +8 -9
  51. mistralai/utils/logger.py +16 -0
  52. mistralai/utils/retries.py +2 -2
  53. mistralai/utils/security.py +5 -2
  54. {mistralai-0.5.5a50.dist-info → mistralai-1.0.0rc2.dist-info}/METADATA +113 -53
  55. {mistralai-0.5.5a50.dist-info → mistralai-1.0.0rc2.dist-info}/RECORD +96 -89
  56. mistralai_azure/basesdk.py +42 -4
  57. mistralai_azure/chat.py +15 -20
  58. mistralai_azure/models/__init__.py +2 -2
  59. mistralai_azure/models/assistantmessage.py +4 -9
  60. mistralai_azure/models/chatcompletionchoice.py +4 -15
  61. mistralai_azure/models/chatcompletionrequest.py +7 -12
  62. mistralai_azure/models/chatcompletionstreamrequest.py +7 -12
  63. mistralai_azure/models/completionresponsestreamchoice.py +4 -9
  64. mistralai_azure/models/deltamessage.py +4 -9
  65. mistralai_azure/models/httpvalidationerror.py +1 -1
  66. mistralai_azure/models/toolmessage.py +4 -9
  67. mistralai_azure/sdk.py +7 -2
  68. mistralai_azure/sdkconfiguration.py +5 -4
  69. mistralai_azure/types/basemodel.py +10 -6
  70. mistralai_azure/utils/__init__.py +4 -0
  71. mistralai_azure/utils/eventstreaming.py +8 -9
  72. mistralai_azure/utils/logger.py +16 -0
  73. mistralai_azure/utils/retries.py +2 -2
  74. mistralai_gcp/basesdk.py +42 -4
  75. mistralai_gcp/chat.py +12 -17
  76. mistralai_gcp/fim.py +12 -13
  77. mistralai_gcp/models/__init__.py +2 -2
  78. mistralai_gcp/models/assistantmessage.py +4 -9
  79. mistralai_gcp/models/chatcompletionchoice.py +4 -15
  80. mistralai_gcp/models/chatcompletionrequest.py +9 -14
  81. mistralai_gcp/models/chatcompletionstreamrequest.py +9 -14
  82. mistralai_gcp/models/completionresponsestreamchoice.py +4 -9
  83. mistralai_gcp/models/deltamessage.py +4 -9
  84. mistralai_gcp/models/fimcompletionrequest.py +11 -16
  85. mistralai_gcp/models/fimcompletionstreamrequest.py +11 -16
  86. mistralai_gcp/models/httpvalidationerror.py +1 -1
  87. mistralai_gcp/models/toolmessage.py +4 -9
  88. mistralai_gcp/sdk.py +9 -0
  89. mistralai_gcp/sdkconfiguration.py +5 -4
  90. mistralai_gcp/types/basemodel.py +10 -6
  91. mistralai_gcp/utils/__init__.py +4 -0
  92. mistralai_gcp/utils/eventstreaming.py +8 -9
  93. mistralai_gcp/utils/logger.py +16 -0
  94. mistralai_gcp/utils/retries.py +2 -2
  95. {mistralai-0.5.5a50.dist-info → mistralai-1.0.0rc2.dist-info}/LICENSE +0 -0
  96. {mistralai-0.5.5a50.dist-info → mistralai-1.0.0rc2.dist-info}/WHEEL +0 -0
mistralai_gcp/sdk.py CHANGED
@@ -11,11 +11,13 @@ import httpx
11
11
  from mistralai_gcp import models
12
12
  from mistralai_gcp._hooks import BeforeRequestHook, SDKHooks
13
13
  from mistralai_gcp.chat import Chat
14
+ from mistralai_gcp.fim import Fim
14
15
  from mistralai_gcp.types import Nullable
15
16
 
16
17
  from .basesdk import BaseSDK
17
18
  from .httpclient import AsyncHttpClient, HttpClient
18
19
  from .sdkconfiguration import SDKConfiguration
20
+ from .utils.logger import Logger, NoOpLogger
19
21
  from .utils.retries import RetryConfig
20
22
 
21
23
 
@@ -23,6 +25,7 @@ class MistralGoogleCloud(BaseSDK):
23
25
  r"""Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it."""
24
26
 
25
27
  chat: Chat
28
+ fim: Fim
26
29
  r"""Chat Completion API"""
27
30
 
28
31
  def __init__(
@@ -32,6 +35,7 @@ class MistralGoogleCloud(BaseSDK):
32
35
  client: Optional[HttpClient] = None,
33
36
  async_client: Optional[AsyncHttpClient] = None,
34
37
  retry_config: Optional[Nullable[RetryConfig]] = None,
38
+ debug_logger: Optional[Logger] = None,
35
39
  ) -> None:
36
40
  r"""Instantiates the SDK configuring it with the provided parameters.
37
41
 
@@ -73,6 +77,9 @@ class MistralGoogleCloud(BaseSDK):
73
77
  if async_client is None:
74
78
  async_client = httpx.AsyncClient()
75
79
 
80
+ if debug_logger is None:
81
+ debug_logger = NoOpLogger()
82
+
76
83
  assert issubclass(
77
84
  type(async_client), AsyncHttpClient
78
85
  ), "The provided async_client must implement the AsyncHttpClient protocol."
@@ -94,6 +101,7 @@ class MistralGoogleCloud(BaseSDK):
94
101
  server_url=f"https://{region}-aiplatform.googleapis.com",
95
102
  server=None,
96
103
  retry_config=retry_config,
104
+ debug_logger=debug_logger,
97
105
  ),
98
106
  )
99
107
 
@@ -116,6 +124,7 @@ class MistralGoogleCloud(BaseSDK):
116
124
 
117
125
  def _init_sdks(self):
118
126
  self.chat = Chat(self.sdk_configuration)
127
+ self.fim = Fim(self.sdk_configuration)
119
128
 
120
129
 
121
130
  class GoogleCloudBeforeRequestHook(BeforeRequestHook):
@@ -3,7 +3,7 @@
3
3
 
4
4
  from ._hooks import SDKHooks
5
5
  from .httpclient import AsyncHttpClient, HttpClient
6
- from .utils import RetryConfig, remove_suffix
6
+ from .utils import Logger, RetryConfig, remove_suffix
7
7
  from dataclasses import dataclass
8
8
  from mistralai_gcp import models
9
9
  from mistralai_gcp.types import OptionalNullable, UNSET
@@ -23,14 +23,15 @@ SERVERS = {
23
23
  class SDKConfiguration:
24
24
  client: HttpClient
25
25
  async_client: AsyncHttpClient
26
+ debug_logger: Logger
26
27
  security: Optional[Union[models.Security,Callable[[], models.Security]]] = None
27
28
  server_url: Optional[str] = ""
28
29
  server: Optional[str] = ""
29
30
  language: str = "python"
30
31
  openapi_doc_version: str = "0.0.2"
31
- sdk_version: str = "0.5.5-alpha.53"
32
- gen_version: str = "2.382.1"
33
- user_agent: str = "speakeasy-sdk/python 0.5.5-alpha.53 2.382.1 0.0.2 mistralai-gcp"
32
+ sdk_version: str = "1.0.0-alpha.12"
33
+ gen_version: str = "2.386.0"
34
+ user_agent: str = "speakeasy-sdk/python 1.0.0-alpha.12 2.386.0 0.0.2 mistralai-gcp"
34
35
  retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
35
36
  timeout_ms: Optional[int] = None
36
37
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  from pydantic import ConfigDict, model_serializer
4
4
  from pydantic import BaseModel as PydanticBaseModel
5
- from typing import Literal, Optional, TypeVar, Union, NewType
6
- from typing_extensions import TypeAliasType
5
+ from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union, NewType
6
+ from typing_extensions import TypeAliasType, TypeAlias
7
7
 
8
8
 
9
9
  class BaseModel(PydanticBaseModel):
@@ -26,10 +26,14 @@ UNSET_SENTINEL = "~?~unset~?~sentinel~?~"
26
26
 
27
27
 
28
28
  T = TypeVar("T")
29
- Nullable = TypeAliasType("Nullable", Union[T, None], type_params=(T,))
30
- OptionalNullable = TypeAliasType(
31
- "OptionalNullable", Union[Optional[Nullable[T]], Unset], type_params=(T,)
32
- )
29
+ if TYPE_CHECKING:
30
+ Nullable: TypeAlias = Union[T, None]
31
+ OptionalNullable: TypeAlias = Union[Optional[Nullable[T]], Unset]
32
+ else:
33
+ Nullable = TypeAliasType("Nullable", Union[T, None], type_params=(T,))
34
+ OptionalNullable = TypeAliasType(
35
+ "OptionalNullable", Union[Optional[Nullable[T]], Unset], type_params=(T,)
36
+ )
33
37
 
34
38
  UnrecognizedInt = NewType("UnrecognizedInt", int)
35
39
  UnrecognizedStr = NewType("UnrecognizedStr", str)
@@ -34,6 +34,7 @@ from .serializers import (
34
34
  )
35
35
  from .url import generate_url, template_url, remove_suffix
36
36
  from .values import get_global_from_env, match_content_type, match_status_codes, match_response
37
+ from .logger import Logger, get_body_content, NoOpLogger
37
38
 
38
39
  __all__ = [
39
40
  "BackoffStrategy",
@@ -41,6 +42,7 @@ __all__ = [
41
42
  "find_metadata",
42
43
  "FormMetadata",
43
44
  "generate_url",
45
+ "get_body_content",
44
46
  "get_discriminator",
45
47
  "get_global_from_env",
46
48
  "get_headers",
@@ -49,11 +51,13 @@ __all__ = [
49
51
  "get_response_headers",
50
52
  "get_security",
51
53
  "HeaderMetadata",
54
+ "Logger",
52
55
  "marshal_json",
53
56
  "match_content_type",
54
57
  "match_status_codes",
55
58
  "match_response",
56
59
  "MultipartFormMetadata",
60
+ "NoOpLogger",
57
61
  "OpenEnumMeta",
58
62
  "PathParamMetadata",
59
63
  "QueryParamMetadata",
@@ -147,15 +147,14 @@ def _parse_event(
147
147
  data = data[:-1]
148
148
  event.data = data
149
149
 
150
- if (
151
- data.isnumeric()
152
- or data == "true"
153
- or data == "false"
154
- or data == "null"
155
- or data.startswith("{")
156
- or data.startswith("[")
157
- or data.startswith('"')
158
- ):
150
+ data_is_primitive = (
151
+ data.isnumeric() or data == "true" or data == "false" or data == "null"
152
+ )
153
+ data_is_json = (
154
+ data.startswith("{") or data.startswith("[") or data.startswith('"')
155
+ )
156
+
157
+ if data_is_primitive or data_is_json:
159
158
  try:
160
159
  event.data = json.loads(data)
161
160
  except Exception:
@@ -0,0 +1,16 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import httpx
4
+ from typing import Any, Protocol
5
+
6
+ class Logger(Protocol):
7
+ def debug(self, msg: str, *args: Any, **kwargs: Any) -> None:
8
+ pass
9
+
10
+ class NoOpLogger:
11
+ def debug(self, msg: str, *args: Any, **kwargs: Any) -> None:
12
+ pass
13
+
14
+ def get_body_content(req: httpx.Request) -> str:
15
+ return "<streaming body>" if not hasattr(req, "_content") else str(req.content)
16
+
@@ -76,7 +76,7 @@ def retry(func, retries: Retries):
76
76
 
77
77
  status_major = res.status_code / 100
78
78
 
79
- if status_major >= code_range and status_major < code_range + 1:
79
+ if code_range <= status_major < code_range + 1:
80
80
  raise TemporaryError(res)
81
81
  else:
82
82
  parsed_code = int(code)
@@ -125,7 +125,7 @@ async def retry_async(func, retries: Retries):
125
125
 
126
126
  status_major = res.status_code / 100
127
127
 
128
- if status_major >= code_range and status_major < code_range + 1:
128
+ if code_range <= status_major < code_range + 1:
129
129
  raise TemporaryError(res)
130
130
  else:
131
131
  parsed_code = int(code)