mistralai 1.9.11__py3-none-any.whl → 1.10.1__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.
- mistralai/_hooks/registration.py +5 -0
- mistralai/_hooks/tracing.py +75 -0
- mistralai/_version.py +2 -2
- mistralai/accesses.py +8 -8
- mistralai/agents.py +29 -17
- mistralai/chat.py +41 -29
- mistralai/classifiers.py +13 -1
- mistralai/conversations.py +294 -62
- mistralai/documents.py +19 -3
- mistralai/embeddings.py +13 -7
- mistralai/extra/README.md +1 -1
- mistralai/extra/mcp/auth.py +10 -11
- mistralai/extra/mcp/base.py +17 -16
- mistralai/extra/mcp/sse.py +13 -15
- mistralai/extra/mcp/stdio.py +5 -6
- mistralai/extra/observability/__init__.py +15 -0
- mistralai/extra/observability/otel.py +372 -0
- mistralai/extra/run/context.py +33 -43
- mistralai/extra/run/result.py +29 -30
- mistralai/extra/run/tools.py +34 -23
- mistralai/extra/struct_chat.py +15 -8
- mistralai/extra/utils/response_format.py +5 -3
- mistralai/files.py +6 -0
- mistralai/fim.py +17 -5
- mistralai/mistral_agents.py +229 -1
- mistralai/mistral_jobs.py +39 -13
- mistralai/models/__init__.py +99 -3
- mistralai/models/agent.py +15 -2
- mistralai/models/agentconversation.py +11 -3
- mistralai/models/agentcreationrequest.py +6 -2
- mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
- mistralai/models/agents_api_v1_agents_getop.py +40 -3
- mistralai/models/agents_api_v1_agents_listop.py +72 -2
- mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
- mistralai/models/agents_api_v1_conversations_listop.py +39 -2
- mistralai/models/agentscompletionrequest.py +21 -6
- mistralai/models/agentscompletionstreamrequest.py +21 -6
- mistralai/models/agentupdaterequest.py +18 -2
- mistralai/models/audioencoding.py +13 -0
- mistralai/models/audioformat.py +19 -0
- mistralai/models/audiotranscriptionrequest.py +2 -0
- mistralai/models/batchjobin.py +26 -5
- mistralai/models/batchjobout.py +5 -0
- mistralai/models/batchrequest.py +48 -0
- mistralai/models/chatcompletionrequest.py +22 -5
- mistralai/models/chatcompletionstreamrequest.py +22 -5
- mistralai/models/classificationrequest.py +37 -3
- mistralai/models/conversationrequest.py +15 -4
- mistralai/models/conversationrestartrequest.py +50 -2
- mistralai/models/conversationrestartstreamrequest.py +50 -2
- mistralai/models/conversationstreamrequest.py +15 -4
- mistralai/models/documentout.py +26 -10
- mistralai/models/documentupdatein.py +24 -3
- mistralai/models/embeddingrequest.py +19 -11
- mistralai/models/files_api_routes_list_filesop.py +7 -0
- mistralai/models/fimcompletionrequest.py +8 -9
- mistralai/models/fimcompletionstreamrequest.py +8 -9
- mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +40 -3
- mistralai/models/libraries_documents_list_v1op.py +15 -2
- mistralai/models/libraryout.py +10 -7
- mistralai/models/listfilesout.py +35 -4
- mistralai/models/modelcapabilities.py +13 -4
- mistralai/models/modelconversation.py +8 -2
- mistralai/models/ocrpageobject.py +26 -5
- mistralai/models/ocrrequest.py +17 -1
- mistralai/models/ocrtableobject.py +31 -0
- mistralai/models/prediction.py +4 -0
- mistralai/models/requestsource.py +7 -0
- mistralai/models/responseformat.py +4 -2
- mistralai/models/responseformats.py +0 -1
- mistralai/models/sharingdelete.py +36 -5
- mistralai/models/sharingin.py +36 -5
- mistralai/models/sharingout.py +3 -3
- mistralai/models/toolexecutiondeltaevent.py +13 -4
- mistralai/models/toolexecutiondoneevent.py +13 -4
- mistralai/models/toolexecutionentry.py +9 -4
- mistralai/models/toolexecutionstartedevent.py +13 -4
- mistralai/models/toolfilechunk.py +11 -4
- mistralai/models/toolreferencechunk.py +13 -4
- mistralai/models_.py +2 -14
- mistralai/ocr.py +18 -0
- mistralai/transcriptions.py +4 -4
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/METADATA +162 -152
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/RECORD +168 -144
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/WHEEL +1 -1
- mistralai_azure/_version.py +3 -3
- mistralai_azure/basesdk.py +15 -5
- mistralai_azure/chat.py +59 -98
- mistralai_azure/models/__init__.py +50 -3
- mistralai_azure/models/chatcompletionrequest.py +16 -4
- mistralai_azure/models/chatcompletionstreamrequest.py +16 -4
- mistralai_azure/models/httpvalidationerror.py +11 -6
- mistralai_azure/models/mistralazureerror.py +26 -0
- mistralai_azure/models/no_response_error.py +13 -0
- mistralai_azure/models/prediction.py +4 -0
- mistralai_azure/models/responseformat.py +4 -2
- mistralai_azure/models/responseformats.py +0 -1
- mistralai_azure/models/responsevalidationerror.py +25 -0
- mistralai_azure/models/sdkerror.py +30 -14
- mistralai_azure/models/systemmessage.py +7 -3
- mistralai_azure/models/systemmessagecontentchunks.py +21 -0
- mistralai_azure/models/thinkchunk.py +35 -0
- mistralai_azure/ocr.py +15 -36
- mistralai_azure/utils/__init__.py +18 -5
- mistralai_azure/utils/eventstreaming.py +10 -0
- mistralai_azure/utils/serializers.py +3 -2
- mistralai_azure/utils/unmarshal_json_response.py +24 -0
- mistralai_gcp/_hooks/types.py +7 -0
- mistralai_gcp/_version.py +4 -4
- mistralai_gcp/basesdk.py +27 -25
- mistralai_gcp/chat.py +75 -98
- mistralai_gcp/fim.py +39 -74
- mistralai_gcp/httpclient.py +6 -16
- mistralai_gcp/models/__init__.py +321 -116
- mistralai_gcp/models/assistantmessage.py +1 -1
- mistralai_gcp/models/chatcompletionrequest.py +36 -7
- mistralai_gcp/models/chatcompletionresponse.py +6 -6
- mistralai_gcp/models/chatcompletionstreamrequest.py +36 -7
- mistralai_gcp/models/completionresponsestreamchoice.py +1 -1
- mistralai_gcp/models/deltamessage.py +1 -1
- mistralai_gcp/models/fimcompletionrequest.py +3 -9
- mistralai_gcp/models/fimcompletionresponse.py +6 -6
- mistralai_gcp/models/fimcompletionstreamrequest.py +3 -9
- mistralai_gcp/models/httpvalidationerror.py +11 -6
- mistralai_gcp/models/imageurl.py +1 -1
- mistralai_gcp/models/jsonschema.py +1 -1
- mistralai_gcp/models/mistralgcperror.py +26 -0
- mistralai_gcp/models/mistralpromptmode.py +8 -0
- mistralai_gcp/models/no_response_error.py +13 -0
- mistralai_gcp/models/prediction.py +4 -0
- mistralai_gcp/models/responseformat.py +5 -3
- mistralai_gcp/models/responseformats.py +0 -1
- mistralai_gcp/models/responsevalidationerror.py +25 -0
- mistralai_gcp/models/sdkerror.py +30 -14
- mistralai_gcp/models/systemmessage.py +7 -3
- mistralai_gcp/models/systemmessagecontentchunks.py +21 -0
- mistralai_gcp/models/thinkchunk.py +35 -0
- mistralai_gcp/models/toolmessage.py +1 -1
- mistralai_gcp/models/usageinfo.py +71 -8
- mistralai_gcp/models/usermessage.py +1 -1
- mistralai_gcp/sdk.py +12 -10
- mistralai_gcp/sdkconfiguration.py +0 -7
- mistralai_gcp/types/basemodel.py +3 -3
- mistralai_gcp/utils/__init__.py +143 -45
- mistralai_gcp/utils/datetimes.py +23 -0
- mistralai_gcp/utils/enums.py +67 -27
- mistralai_gcp/utils/eventstreaming.py +10 -0
- mistralai_gcp/utils/forms.py +49 -28
- mistralai_gcp/utils/serializers.py +33 -3
- mistralai_gcp/utils/unmarshal_json_response.py +24 -0
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/licenses/LICENSE +0 -0
mistralai/_hooks/registration.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from .custom_user_agent import CustomUserAgentHook
|
|
2
2
|
from .deprecation_warning import DeprecationWarningHook
|
|
3
|
+
from .tracing import TracingHook
|
|
3
4
|
from .types import Hooks
|
|
4
5
|
|
|
5
6
|
# This file is only ever generated once on the first generation and then is free to be modified.
|
|
@@ -13,5 +14,9 @@ def init_hooks(hooks: Hooks):
|
|
|
13
14
|
with an instance of a hook that implements that specific Hook interface
|
|
14
15
|
Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance
|
|
15
16
|
"""
|
|
17
|
+
tracing_hook = TracingHook()
|
|
16
18
|
hooks.register_before_request_hook(CustomUserAgentHook())
|
|
17
19
|
hooks.register_after_success_hook(DeprecationWarningHook())
|
|
20
|
+
hooks.register_after_success_hook(tracing_hook)
|
|
21
|
+
hooks.register_before_request_hook(tracing_hook)
|
|
22
|
+
hooks.register_after_error_hook(tracing_hook)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Optional, Tuple, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
from opentelemetry.trace import Span
|
|
6
|
+
|
|
7
|
+
from ..extra.observability.otel import (
|
|
8
|
+
get_or_create_otel_tracer,
|
|
9
|
+
get_response_and_error,
|
|
10
|
+
get_traced_request_and_span,
|
|
11
|
+
get_traced_response,
|
|
12
|
+
)
|
|
13
|
+
from .types import (
|
|
14
|
+
AfterErrorContext,
|
|
15
|
+
AfterErrorHook,
|
|
16
|
+
AfterSuccessContext,
|
|
17
|
+
AfterSuccessHook,
|
|
18
|
+
BeforeRequestContext,
|
|
19
|
+
BeforeRequestHook,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class TracingHook(BeforeRequestHook, AfterSuccessHook, AfterErrorHook):
|
|
26
|
+
def __init__(self) -> None:
|
|
27
|
+
self.tracing_enabled, self.tracer = get_or_create_otel_tracer()
|
|
28
|
+
self.request_span: Optional[Span] = None
|
|
29
|
+
|
|
30
|
+
def before_request(
|
|
31
|
+
self, hook_ctx: BeforeRequestContext, request: httpx.Request
|
|
32
|
+
) -> Union[httpx.Request, Exception]:
|
|
33
|
+
# Refresh tracer/provider per request so tracing can be enabled if the
|
|
34
|
+
# application configures OpenTelemetry after the client is instantiated.
|
|
35
|
+
self.tracing_enabled, self.tracer = get_or_create_otel_tracer()
|
|
36
|
+
self.request_span = None
|
|
37
|
+
request, self.request_span = get_traced_request_and_span(
|
|
38
|
+
tracing_enabled=self.tracing_enabled,
|
|
39
|
+
tracer=self.tracer,
|
|
40
|
+
span=self.request_span,
|
|
41
|
+
operation_id=hook_ctx.operation_id,
|
|
42
|
+
request=request,
|
|
43
|
+
)
|
|
44
|
+
return request
|
|
45
|
+
|
|
46
|
+
def after_success(
|
|
47
|
+
self, hook_ctx: AfterSuccessContext, response: httpx.Response
|
|
48
|
+
) -> Union[httpx.Response, Exception]:
|
|
49
|
+
response = get_traced_response(
|
|
50
|
+
tracing_enabled=self.tracing_enabled,
|
|
51
|
+
tracer=self.tracer,
|
|
52
|
+
span=self.request_span,
|
|
53
|
+
operation_id=hook_ctx.operation_id,
|
|
54
|
+
response=response,
|
|
55
|
+
)
|
|
56
|
+
self.request_span = None
|
|
57
|
+
return response
|
|
58
|
+
|
|
59
|
+
def after_error(
|
|
60
|
+
self,
|
|
61
|
+
hook_ctx: AfterErrorContext,
|
|
62
|
+
response: Optional[httpx.Response],
|
|
63
|
+
error: Optional[Exception],
|
|
64
|
+
) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]:
|
|
65
|
+
if response:
|
|
66
|
+
response, error = get_response_and_error(
|
|
67
|
+
tracing_enabled=self.tracing_enabled,
|
|
68
|
+
tracer=self.tracer,
|
|
69
|
+
span=self.request_span,
|
|
70
|
+
operation_id=hook_ctx.operation_id,
|
|
71
|
+
response=response,
|
|
72
|
+
error=error,
|
|
73
|
+
)
|
|
74
|
+
self.request_span = None
|
|
75
|
+
return response, error
|
mistralai/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "mistralai"
|
|
6
|
-
__version__: str = "1.
|
|
6
|
+
__version__: str = "1.10.1"
|
|
7
7
|
__openapi_doc_version__: str = "1.0.0"
|
|
8
8
|
__gen_version__: str = "2.687.13"
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 1.
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 1.10.1 2.687.13 1.0.0 mistralai"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
mistralai/accesses.py
CHANGED
|
@@ -194,10 +194,10 @@ class Accesses(BaseSDK):
|
|
|
194
194
|
self,
|
|
195
195
|
*,
|
|
196
196
|
library_id: str,
|
|
197
|
-
org_id: str,
|
|
198
197
|
level: models.ShareEnum,
|
|
199
198
|
share_with_uuid: str,
|
|
200
199
|
share_with_type: models.EntityType,
|
|
200
|
+
org_id: OptionalNullable[str] = UNSET,
|
|
201
201
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
202
202
|
server_url: Optional[str] = None,
|
|
203
203
|
timeout_ms: Optional[int] = None,
|
|
@@ -208,10 +208,10 @@ class Accesses(BaseSDK):
|
|
|
208
208
|
Given a library id, you can create or update the access level of an entity. You have to be owner of the library to share a library. An owner cannot change their own role. A library cannot be shared outside of the organization.
|
|
209
209
|
|
|
210
210
|
:param library_id:
|
|
211
|
-
:param org_id:
|
|
212
211
|
:param level:
|
|
213
212
|
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
214
213
|
:param share_with_type: The type of entity, used to share a library.
|
|
214
|
+
:param org_id:
|
|
215
215
|
:param retries: Override the default retry configuration for this method
|
|
216
216
|
:param server_url: Override the default server URL for this method
|
|
217
217
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -300,10 +300,10 @@ class Accesses(BaseSDK):
|
|
|
300
300
|
self,
|
|
301
301
|
*,
|
|
302
302
|
library_id: str,
|
|
303
|
-
org_id: str,
|
|
304
303
|
level: models.ShareEnum,
|
|
305
304
|
share_with_uuid: str,
|
|
306
305
|
share_with_type: models.EntityType,
|
|
306
|
+
org_id: OptionalNullable[str] = UNSET,
|
|
307
307
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
308
308
|
server_url: Optional[str] = None,
|
|
309
309
|
timeout_ms: Optional[int] = None,
|
|
@@ -314,10 +314,10 @@ class Accesses(BaseSDK):
|
|
|
314
314
|
Given a library id, you can create or update the access level of an entity. You have to be owner of the library to share a library. An owner cannot change their own role. A library cannot be shared outside of the organization.
|
|
315
315
|
|
|
316
316
|
:param library_id:
|
|
317
|
-
:param org_id:
|
|
318
317
|
:param level:
|
|
319
318
|
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
320
319
|
:param share_with_type: The type of entity, used to share a library.
|
|
320
|
+
:param org_id:
|
|
321
321
|
:param retries: Override the default retry configuration for this method
|
|
322
322
|
:param server_url: Override the default server URL for this method
|
|
323
323
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -406,9 +406,9 @@ class Accesses(BaseSDK):
|
|
|
406
406
|
self,
|
|
407
407
|
*,
|
|
408
408
|
library_id: str,
|
|
409
|
-
org_id: str,
|
|
410
409
|
share_with_uuid: str,
|
|
411
410
|
share_with_type: models.EntityType,
|
|
411
|
+
org_id: OptionalNullable[str] = UNSET,
|
|
412
412
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
413
413
|
server_url: Optional[str] = None,
|
|
414
414
|
timeout_ms: Optional[int] = None,
|
|
@@ -419,9 +419,9 @@ class Accesses(BaseSDK):
|
|
|
419
419
|
Given a library id, you can delete the access level of an entity. An owner cannot delete it's own access. You have to be the owner of the library to delete an acces other than yours.
|
|
420
420
|
|
|
421
421
|
:param library_id:
|
|
422
|
-
:param org_id:
|
|
423
422
|
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
424
423
|
:param share_with_type: The type of entity, used to share a library.
|
|
424
|
+
:param org_id:
|
|
425
425
|
:param retries: Override the default retry configuration for this method
|
|
426
426
|
:param server_url: Override the default server URL for this method
|
|
427
427
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -509,9 +509,9 @@ class Accesses(BaseSDK):
|
|
|
509
509
|
self,
|
|
510
510
|
*,
|
|
511
511
|
library_id: str,
|
|
512
|
-
org_id: str,
|
|
513
512
|
share_with_uuid: str,
|
|
514
513
|
share_with_type: models.EntityType,
|
|
514
|
+
org_id: OptionalNullable[str] = UNSET,
|
|
515
515
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
516
516
|
server_url: Optional[str] = None,
|
|
517
517
|
timeout_ms: Optional[int] = None,
|
|
@@ -522,9 +522,9 @@ class Accesses(BaseSDK):
|
|
|
522
522
|
Given a library id, you can delete the access level of an entity. An owner cannot delete it's own access. You have to be the owner of the library to delete an acces other than yours.
|
|
523
523
|
|
|
524
524
|
:param library_id:
|
|
525
|
-
:param org_id:
|
|
526
525
|
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
527
526
|
:param share_with_type: The type of entity, used to share a library.
|
|
527
|
+
:param org_id:
|
|
528
528
|
:param retries: Override the default retry configuration for this method
|
|
529
529
|
:param server_url: Override the default server URL for this method
|
|
530
530
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
mistralai/agents.py
CHANGED
|
@@ -6,7 +6,7 @@ from mistralai._hooks import HookContext
|
|
|
6
6
|
from mistralai.types import OptionalNullable, UNSET
|
|
7
7
|
from mistralai.utils import eventstreaming, get_security_from_env
|
|
8
8
|
from mistralai.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
|
-
from typing import Any, List, Mapping, Optional, Union
|
|
9
|
+
from typing import Any, Dict, List, Mapping, Optional, Union
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class Agents(BaseSDK):
|
|
@@ -29,6 +29,7 @@ class Agents(BaseSDK):
|
|
|
29
29
|
]
|
|
30
30
|
] = None,
|
|
31
31
|
random_seed: OptionalNullable[int] = UNSET,
|
|
32
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
32
33
|
response_format: Optional[
|
|
33
34
|
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
|
34
35
|
] = None,
|
|
@@ -62,13 +63,14 @@ class Agents(BaseSDK):
|
|
|
62
63
|
:param stream: Whether to stream back partial progress. If set, tokens will be sent as data-only server-side 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.
|
|
63
64
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
64
65
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
65
|
-
:param
|
|
66
|
+
:param metadata:
|
|
67
|
+
:param response_format: Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.
|
|
66
68
|
:param tools:
|
|
67
69
|
:param tool_choice:
|
|
68
|
-
: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.
|
|
69
|
-
: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.
|
|
70
|
+
:param presence_penalty: The `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.
|
|
71
|
+
:param frequency_penalty: The `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.
|
|
70
72
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
71
|
-
:param prediction:
|
|
73
|
+
:param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.
|
|
72
74
|
:param parallel_tool_calls:
|
|
73
75
|
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
74
76
|
:param retries: Override the default retry configuration for this method
|
|
@@ -91,6 +93,7 @@ class Agents(BaseSDK):
|
|
|
91
93
|
stream=stream,
|
|
92
94
|
stop=stop,
|
|
93
95
|
random_seed=random_seed,
|
|
96
|
+
metadata=metadata,
|
|
94
97
|
messages=utils.get_pydantic_model(
|
|
95
98
|
messages, List[models.AgentsCompletionRequestMessages]
|
|
96
99
|
),
|
|
@@ -188,6 +191,7 @@ class Agents(BaseSDK):
|
|
|
188
191
|
]
|
|
189
192
|
] = None,
|
|
190
193
|
random_seed: OptionalNullable[int] = UNSET,
|
|
194
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
191
195
|
response_format: Optional[
|
|
192
196
|
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
|
193
197
|
] = None,
|
|
@@ -221,13 +225,14 @@ class Agents(BaseSDK):
|
|
|
221
225
|
:param stream: Whether to stream back partial progress. If set, tokens will be sent as data-only server-side 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.
|
|
222
226
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
223
227
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
224
|
-
:param
|
|
228
|
+
:param metadata:
|
|
229
|
+
:param response_format: Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.
|
|
225
230
|
:param tools:
|
|
226
231
|
:param tool_choice:
|
|
227
|
-
: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.
|
|
228
|
-
: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.
|
|
232
|
+
:param presence_penalty: The `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.
|
|
233
|
+
:param frequency_penalty: The `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.
|
|
229
234
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
230
|
-
:param prediction:
|
|
235
|
+
:param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.
|
|
231
236
|
:param parallel_tool_calls:
|
|
232
237
|
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
233
238
|
:param retries: Override the default retry configuration for this method
|
|
@@ -250,6 +255,7 @@ class Agents(BaseSDK):
|
|
|
250
255
|
stream=stream,
|
|
251
256
|
stop=stop,
|
|
252
257
|
random_seed=random_seed,
|
|
258
|
+
metadata=metadata,
|
|
253
259
|
messages=utils.get_pydantic_model(
|
|
254
260
|
messages, List[models.AgentsCompletionRequestMessages]
|
|
255
261
|
),
|
|
@@ -347,6 +353,7 @@ class Agents(BaseSDK):
|
|
|
347
353
|
]
|
|
348
354
|
] = None,
|
|
349
355
|
random_seed: OptionalNullable[int] = UNSET,
|
|
356
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
350
357
|
response_format: Optional[
|
|
351
358
|
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
|
352
359
|
] = None,
|
|
@@ -382,13 +389,14 @@ class Agents(BaseSDK):
|
|
|
382
389
|
:param stream:
|
|
383
390
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
384
391
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
385
|
-
:param
|
|
392
|
+
:param metadata:
|
|
393
|
+
:param response_format: Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.
|
|
386
394
|
:param tools:
|
|
387
395
|
:param tool_choice:
|
|
388
|
-
: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.
|
|
389
|
-
: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.
|
|
396
|
+
:param presence_penalty: The `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.
|
|
397
|
+
:param frequency_penalty: The `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.
|
|
390
398
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
391
|
-
:param prediction:
|
|
399
|
+
:param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.
|
|
392
400
|
:param parallel_tool_calls:
|
|
393
401
|
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
394
402
|
:param retries: Override the default retry configuration for this method
|
|
@@ -411,6 +419,7 @@ class Agents(BaseSDK):
|
|
|
411
419
|
stream=stream,
|
|
412
420
|
stop=stop,
|
|
413
421
|
random_seed=random_seed,
|
|
422
|
+
metadata=metadata,
|
|
414
423
|
messages=utils.get_pydantic_model(
|
|
415
424
|
messages, List[models.AgentsCompletionStreamRequestMessages]
|
|
416
425
|
),
|
|
@@ -516,6 +525,7 @@ class Agents(BaseSDK):
|
|
|
516
525
|
]
|
|
517
526
|
] = None,
|
|
518
527
|
random_seed: OptionalNullable[int] = UNSET,
|
|
528
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
519
529
|
response_format: Optional[
|
|
520
530
|
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
|
521
531
|
] = None,
|
|
@@ -551,13 +561,14 @@ class Agents(BaseSDK):
|
|
|
551
561
|
:param stream:
|
|
552
562
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
553
563
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
554
|
-
:param
|
|
564
|
+
:param metadata:
|
|
565
|
+
:param response_format: Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.
|
|
555
566
|
:param tools:
|
|
556
567
|
:param tool_choice:
|
|
557
|
-
: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.
|
|
558
|
-
: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.
|
|
568
|
+
:param presence_penalty: The `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.
|
|
569
|
+
:param frequency_penalty: The `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.
|
|
559
570
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
560
|
-
:param prediction:
|
|
571
|
+
:param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.
|
|
561
572
|
:param parallel_tool_calls:
|
|
562
573
|
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
563
574
|
:param retries: Override the default retry configuration for this method
|
|
@@ -580,6 +591,7 @@ class Agents(BaseSDK):
|
|
|
580
591
|
stream=stream,
|
|
581
592
|
stop=stop,
|
|
582
593
|
random_seed=random_seed,
|
|
594
|
+
metadata=metadata,
|
|
583
595
|
messages=utils.get_pydantic_model(
|
|
584
596
|
messages, List[models.AgentsCompletionStreamRequestMessages]
|
|
585
597
|
),
|
mistralai/chat.py
CHANGED
|
@@ -6,7 +6,7 @@ from mistralai._hooks import HookContext
|
|
|
6
6
|
from mistralai.types import OptionalNullable, UNSET
|
|
7
7
|
from mistralai.utils import eventstreaming, get_security_from_env
|
|
8
8
|
from mistralai.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
|
-
from typing import Any, List, Mapping, Optional, Union
|
|
9
|
+
from typing import Any, Dict, List, Mapping, Optional, Union
|
|
10
10
|
|
|
11
11
|
# region imports
|
|
12
12
|
from typing import Type
|
|
@@ -105,6 +105,7 @@ class Chat(BaseSDK):
|
|
|
105
105
|
stream: Optional[bool] = False,
|
|
106
106
|
stop: Optional[Union[models.Stop, models.StopTypedDict]] = None,
|
|
107
107
|
random_seed: OptionalNullable[int] = UNSET,
|
|
108
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
108
109
|
response_format: Optional[
|
|
109
110
|
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
|
110
111
|
] = None,
|
|
@@ -141,14 +142,15 @@ class Chat(BaseSDK):
|
|
|
141
142
|
:param stream: Whether to stream back partial progress. If set, tokens will be sent as data-only server-side 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.
|
|
142
143
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
143
144
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
144
|
-
:param
|
|
145
|
-
:param
|
|
146
|
-
:param
|
|
147
|
-
:param
|
|
148
|
-
:param
|
|
145
|
+
:param metadata:
|
|
146
|
+
:param response_format: Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.
|
|
147
|
+
:param tools: A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for.
|
|
148
|
+
:param tool_choice: Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.
|
|
149
|
+
:param presence_penalty: The `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.
|
|
150
|
+
:param frequency_penalty: The `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.
|
|
149
151
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
150
|
-
:param prediction:
|
|
151
|
-
:param parallel_tool_calls:
|
|
152
|
+
:param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.
|
|
153
|
+
:param parallel_tool_calls: Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel.
|
|
152
154
|
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
153
155
|
:param safe_prompt: Whether to inject a safety prompt before all conversations.
|
|
154
156
|
:param retries: Override the default retry configuration for this method
|
|
@@ -174,6 +176,7 @@ class Chat(BaseSDK):
|
|
|
174
176
|
stream=stream,
|
|
175
177
|
stop=stop,
|
|
176
178
|
random_seed=random_seed,
|
|
179
|
+
metadata=metadata,
|
|
177
180
|
messages=utils.get_pydantic_model(messages, List[models.Messages]),
|
|
178
181
|
response_format=utils.get_pydantic_model(
|
|
179
182
|
response_format, Optional[models.ResponseFormat]
|
|
@@ -263,6 +266,7 @@ class Chat(BaseSDK):
|
|
|
263
266
|
stream: Optional[bool] = False,
|
|
264
267
|
stop: Optional[Union[models.Stop, models.StopTypedDict]] = None,
|
|
265
268
|
random_seed: OptionalNullable[int] = UNSET,
|
|
269
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
266
270
|
response_format: Optional[
|
|
267
271
|
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
|
268
272
|
] = None,
|
|
@@ -299,14 +303,15 @@ class Chat(BaseSDK):
|
|
|
299
303
|
:param stream: Whether to stream back partial progress. If set, tokens will be sent as data-only server-side 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.
|
|
300
304
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
301
305
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
302
|
-
:param
|
|
303
|
-
:param
|
|
304
|
-
:param
|
|
305
|
-
:param
|
|
306
|
-
:param
|
|
306
|
+
:param metadata:
|
|
307
|
+
:param response_format: Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.
|
|
308
|
+
:param tools: A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for.
|
|
309
|
+
:param tool_choice: Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.
|
|
310
|
+
:param presence_penalty: The `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.
|
|
311
|
+
:param frequency_penalty: The `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.
|
|
307
312
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
308
|
-
:param prediction:
|
|
309
|
-
:param parallel_tool_calls:
|
|
313
|
+
:param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.
|
|
314
|
+
:param parallel_tool_calls: Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel.
|
|
310
315
|
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
311
316
|
:param safe_prompt: Whether to inject a safety prompt before all conversations.
|
|
312
317
|
:param retries: Override the default retry configuration for this method
|
|
@@ -332,6 +337,7 @@ class Chat(BaseSDK):
|
|
|
332
337
|
stream=stream,
|
|
333
338
|
stop=stop,
|
|
334
339
|
random_seed=random_seed,
|
|
340
|
+
metadata=metadata,
|
|
335
341
|
messages=utils.get_pydantic_model(messages, List[models.Messages]),
|
|
336
342
|
response_format=utils.get_pydantic_model(
|
|
337
343
|
response_format, Optional[models.ResponseFormat]
|
|
@@ -429,6 +435,7 @@ class Chat(BaseSDK):
|
|
|
429
435
|
]
|
|
430
436
|
] = None,
|
|
431
437
|
random_seed: OptionalNullable[int] = UNSET,
|
|
438
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
432
439
|
response_format: Optional[
|
|
433
440
|
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
|
434
441
|
] = None,
|
|
@@ -467,14 +474,15 @@ class Chat(BaseSDK):
|
|
|
467
474
|
:param stream:
|
|
468
475
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
469
476
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
470
|
-
:param
|
|
471
|
-
:param
|
|
472
|
-
:param
|
|
473
|
-
:param
|
|
474
|
-
:param
|
|
477
|
+
:param metadata:
|
|
478
|
+
:param response_format: Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.
|
|
479
|
+
:param tools: A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for.
|
|
480
|
+
:param tool_choice: Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.
|
|
481
|
+
:param presence_penalty: The `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.
|
|
482
|
+
:param frequency_penalty: The `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.
|
|
475
483
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
476
|
-
:param prediction:
|
|
477
|
-
:param parallel_tool_calls:
|
|
484
|
+
:param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.
|
|
485
|
+
:param parallel_tool_calls: Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel.
|
|
478
486
|
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
479
487
|
:param safe_prompt: Whether to inject a safety prompt before all conversations.
|
|
480
488
|
:param retries: Override the default retry configuration for this method
|
|
@@ -500,6 +508,7 @@ class Chat(BaseSDK):
|
|
|
500
508
|
stream=stream,
|
|
501
509
|
stop=stop,
|
|
502
510
|
random_seed=random_seed,
|
|
511
|
+
metadata=metadata,
|
|
503
512
|
messages=utils.get_pydantic_model(
|
|
504
513
|
messages, List[models.ChatCompletionStreamRequestMessages]
|
|
505
514
|
),
|
|
@@ -607,6 +616,7 @@ class Chat(BaseSDK):
|
|
|
607
616
|
]
|
|
608
617
|
] = None,
|
|
609
618
|
random_seed: OptionalNullable[int] = UNSET,
|
|
619
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
610
620
|
response_format: Optional[
|
|
611
621
|
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
|
612
622
|
] = None,
|
|
@@ -645,14 +655,15 @@ class Chat(BaseSDK):
|
|
|
645
655
|
:param stream:
|
|
646
656
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
647
657
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
648
|
-
:param
|
|
649
|
-
:param
|
|
650
|
-
:param
|
|
651
|
-
:param
|
|
652
|
-
:param
|
|
658
|
+
:param metadata:
|
|
659
|
+
:param response_format: Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide.
|
|
660
|
+
:param tools: A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for.
|
|
661
|
+
:param tool_choice: Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.
|
|
662
|
+
:param presence_penalty: The `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.
|
|
663
|
+
:param frequency_penalty: The `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.
|
|
653
664
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
654
|
-
:param prediction:
|
|
655
|
-
:param parallel_tool_calls:
|
|
665
|
+
:param prediction: Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.
|
|
666
|
+
:param parallel_tool_calls: Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel.
|
|
656
667
|
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
657
668
|
:param safe_prompt: Whether to inject a safety prompt before all conversations.
|
|
658
669
|
:param retries: Override the default retry configuration for this method
|
|
@@ -678,6 +689,7 @@ class Chat(BaseSDK):
|
|
|
678
689
|
stream=stream,
|
|
679
690
|
stop=stop,
|
|
680
691
|
random_seed=random_seed,
|
|
692
|
+
metadata=metadata,
|
|
681
693
|
messages=utils.get_pydantic_model(
|
|
682
694
|
messages, List[models.ChatCompletionStreamRequestMessages]
|
|
683
695
|
),
|
mistralai/classifiers.py
CHANGED
|
@@ -6,7 +6,7 @@ from mistralai._hooks import HookContext
|
|
|
6
6
|
from mistralai.types import OptionalNullable, UNSET
|
|
7
7
|
from mistralai.utils import get_security_from_env
|
|
8
8
|
from mistralai.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
|
-
from typing import Any, Mapping, Optional, Union
|
|
9
|
+
from typing import Any, Dict, Mapping, Optional, Union
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class Classifiers(BaseSDK):
|
|
@@ -20,6 +20,7 @@ class Classifiers(BaseSDK):
|
|
|
20
20
|
models.ClassificationRequestInputs,
|
|
21
21
|
models.ClassificationRequestInputsTypedDict,
|
|
22
22
|
],
|
|
23
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
23
24
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
24
25
|
server_url: Optional[str] = None,
|
|
25
26
|
timeout_ms: Optional[int] = None,
|
|
@@ -29,6 +30,7 @@ class Classifiers(BaseSDK):
|
|
|
29
30
|
|
|
30
31
|
:param model: ID of the model to use.
|
|
31
32
|
:param inputs: Text to classify.
|
|
33
|
+
:param metadata:
|
|
32
34
|
:param retries: Override the default retry configuration for this method
|
|
33
35
|
:param server_url: Override the default server URL for this method
|
|
34
36
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -46,6 +48,7 @@ class Classifiers(BaseSDK):
|
|
|
46
48
|
|
|
47
49
|
request = models.ClassificationRequest(
|
|
48
50
|
model=model,
|
|
51
|
+
metadata=metadata,
|
|
49
52
|
inputs=inputs,
|
|
50
53
|
)
|
|
51
54
|
|
|
@@ -116,6 +119,7 @@ class Classifiers(BaseSDK):
|
|
|
116
119
|
models.ClassificationRequestInputs,
|
|
117
120
|
models.ClassificationRequestInputsTypedDict,
|
|
118
121
|
],
|
|
122
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
119
123
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
120
124
|
server_url: Optional[str] = None,
|
|
121
125
|
timeout_ms: Optional[int] = None,
|
|
@@ -125,6 +129,7 @@ class Classifiers(BaseSDK):
|
|
|
125
129
|
|
|
126
130
|
:param model: ID of the model to use.
|
|
127
131
|
:param inputs: Text to classify.
|
|
132
|
+
:param metadata:
|
|
128
133
|
:param retries: Override the default retry configuration for this method
|
|
129
134
|
:param server_url: Override the default server URL for this method
|
|
130
135
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -142,6 +147,7 @@ class Classifiers(BaseSDK):
|
|
|
142
147
|
|
|
143
148
|
request = models.ClassificationRequest(
|
|
144
149
|
model=model,
|
|
150
|
+
metadata=metadata,
|
|
145
151
|
inputs=inputs,
|
|
146
152
|
)
|
|
147
153
|
|
|
@@ -404,6 +410,7 @@ class Classifiers(BaseSDK):
|
|
|
404
410
|
models.ClassificationRequestInputs,
|
|
405
411
|
models.ClassificationRequestInputsTypedDict,
|
|
406
412
|
],
|
|
413
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
407
414
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
408
415
|
server_url: Optional[str] = None,
|
|
409
416
|
timeout_ms: Optional[int] = None,
|
|
@@ -413,6 +420,7 @@ class Classifiers(BaseSDK):
|
|
|
413
420
|
|
|
414
421
|
:param model: ID of the model to use.
|
|
415
422
|
:param inputs: Text to classify.
|
|
423
|
+
:param metadata:
|
|
416
424
|
:param retries: Override the default retry configuration for this method
|
|
417
425
|
:param server_url: Override the default server URL for this method
|
|
418
426
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -430,6 +438,7 @@ class Classifiers(BaseSDK):
|
|
|
430
438
|
|
|
431
439
|
request = models.ClassificationRequest(
|
|
432
440
|
model=model,
|
|
441
|
+
metadata=metadata,
|
|
433
442
|
inputs=inputs,
|
|
434
443
|
)
|
|
435
444
|
|
|
@@ -500,6 +509,7 @@ class Classifiers(BaseSDK):
|
|
|
500
509
|
models.ClassificationRequestInputs,
|
|
501
510
|
models.ClassificationRequestInputsTypedDict,
|
|
502
511
|
],
|
|
512
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET,
|
|
503
513
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
504
514
|
server_url: Optional[str] = None,
|
|
505
515
|
timeout_ms: Optional[int] = None,
|
|
@@ -509,6 +519,7 @@ class Classifiers(BaseSDK):
|
|
|
509
519
|
|
|
510
520
|
:param model: ID of the model to use.
|
|
511
521
|
:param inputs: Text to classify.
|
|
522
|
+
:param metadata:
|
|
512
523
|
:param retries: Override the default retry configuration for this method
|
|
513
524
|
:param server_url: Override the default server URL for this method
|
|
514
525
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -526,6 +537,7 @@ class Classifiers(BaseSDK):
|
|
|
526
537
|
|
|
527
538
|
request = models.ClassificationRequest(
|
|
528
539
|
model=model,
|
|
540
|
+
metadata=metadata,
|
|
529
541
|
inputs=inputs,
|
|
530
542
|
)
|
|
531
543
|
|