(embeddings)
Embeddings API.
- create - Embeddings
Embeddings
from mistralai import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as s:
res = s.embeddings.create(inputs=[
"Embed this sentence.",
"As well as this one.",
], model="Wrangler")
if res is not None:
# handle response
pass
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
inputs |
models.Inputs | ✔️ | Text to embed. | [ "Embed this sentence.", "As well as this one." ] |
model |
Optional[str] | ➖ | ID of the model to use. | |
encoding_format |
OptionalNullable[str] | ➖ | The format to return the embeddings in. | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.HTTPValidationError | 422 | application/json |
models.SDKError | 4XX, 5XX | */* |