Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 2.63 KB

README.md

File metadata and controls

54 lines (35 loc) · 2.63 KB

Embeddings

(embeddings)

Overview

Embeddings API.

Available Operations

create

Embeddings

Example Usage

from mistralai import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.embeddings.create(model="mistral-embed", inputs=[
        "Embed this sentence.",
        "As well as this one.",
    ])

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
model str ✔️ ID of the model to use. mistral-embed
inputs models.Inputs ✔️ Text to embed. [
"Embed this sentence.",
"As well as this one."
]
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.EmbeddingResponse

Errors

Error Type Status Code Content Type
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*