mistral_common.experimental.app.models
EngineBackend
Bases: StrEnum
The engine backend to use.
Attributes:
| Name | Type | Description |
|---|---|---|
llama_cpp |
The |
OpenAIChatCompletionRequest(**data)
Bases: BaseModel
OpenAI chat completion request.
This class is used to parse the request body for the OpenAI chat completion endpoint.
Attributes:
| Name | Type | Description |
|---|---|---|
messages |
list[dict[str, str | list[dict[str, str | dict[str, Any]]] | None]]
|
The messages to use for the chat completion. |
tools |
list[dict[str, Any]] | None
|
The tools to use for the chat completion. |
Note
This class accepts extra fields that are not validated.
Source code in pydantic/main.py
drop_extra_fields()
Drop extra fields from the model.
This method is used to drop extra fields from the model, which are not defined in the model fields.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The extra fields that were dropped from the model. |
Source code in src/mistral_common/experimental/app/models.py
Settings
Bases: BaseSettings
Settings for the Mistral-common API.
Attributes:
| Name | Type | Description |
|---|---|---|
app_name |
str
|
The name of the application. |
app_version |
str
|
The version of the application. |
engine_url |
str
|
The URL of the engine, with any trailing slash stripped. |
engine_backend |
EngineBackend
|
The backend to use for the engine. |
api_key |
str
|
The API key for the engine, or an empty string if none. |
timeout |
float
|
The timeout for the engine API in seconds, as a positive finite float. Numbers and numeric strings are accepted. |
tokenizer
property
writable
The application's tokenizer.
Returns:
| Type | Description |
|---|---|
MistralTokenizer
|
The loaded MistralTokenizer. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the tokenizer has not been initialized yet. |
model_post_init(context)
Initialize the private tokenizer slot to None.
get_settings()
Get the settings for the Mistral-common API.
Returns:
| Type | Description |
|---|---|
Settings
|
A Settings instance built from the environment. |
resolve_engine_timeout(timeout)
Convert an engine timeout to a positive finite float.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
TimeoutType
|
The timeout in seconds, as a number or a string that converts to one. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The timeout as a positive finite float. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |