Working with Mistral AI in Pixeltable

Pixeltable's Mistral AI integration enables you to access Mistral's LLM and other models via the Mistral AI API.

Providers · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

What it uses

Install
terminal
pip install pixeltable mistralai
Environment variables it names
MISTRAL_API_KEY
Pixeltable calls
mistralai.chat_completions()pxt.create_table()add_computed_column()insert()

A look at the code

working-with-mistralai.ipynb
from pixeltable.functions.mistralai import chat_completions
# Create a table in Pixeltable and add a computed column that calls Mistral AI
t = pxt.create_table('mistralai_demo/chat', {'input': pxt.String})
messages = [{'role': 'user', 'content': t.input}]
t.add_computed_column(
output=chat_completions(
messages=messages,
model='mistral-small-latest',
model_kwargs={
# Optional dict with parameters for the Mistral API
'max_tokens': 300,
'top_p': 0.9,
'temperature': 0.7,
},
)
)

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103