Skip to content

Mistral

pip install datapizza-ai-clients-mistral

datapizza.clients.mistral.MistralClient

Bases: Client

A client for interacting with the Mistral API.

This class provides methods for invoking the Mistral API to generate responses based on given input data. It extends the Client class.

__init__

__init__(
    api_key,
    model="mistral-large-latest",
    system_prompt="",
    temperature=None,
    cache=None,
)

Parameters:

Name Type Description Default
api_key str

The API key for the Mistral API.

required
model str

The model to use for the Mistral API.

'mistral-large-latest'
system_prompt str

The system prompt to use for the Mistral API.

''
temperature float | None

The temperature to use for the Mistral API.

None
cache Cache | None

The cache to use for the Mistral API.

None

Usage Example

from datapizza.clients.mistral import MistralClient

client = MistralClient(
    api_key=os.getenv("MISTRAL_API_KEY"),
    model="mistral-small-latest",
    system_prompt="You are a helpful assistant that responds short and concise.",
)
response = client.invoke("hi")
print(response.text)