Documentation Index
Fetch the complete documentation index at: https://docs.agentops.ai/llms.txt
Use this file to discover all available pages before exploring further.
Mistral publishes open-weight AI models that can be used for a variety of tasks. To develop with Mistral, visit their developer docs here.
Steps to Integrate Mistral with AgentOps
Initialize AgentOps and develop with Mistral
Make sure to call agentops.init before calling any openai, cohere, crew, etc models.
from mistralai import Mistral
import agentops
agentops.init(<INSERT YOUR API KEY HERE>)
client = Mistral(api_key="your_api_key")
# Your code here...
agentops.end_session('Success')
Set your API key as an .env variable for easy access.
AGENTOPS_API_KEY=<YOUR API KEY>
MISTRAL_API_KEY=<YOUR MISTRAL API KEY>
Run your Agent
Execute your program and visit app.agentops.ai/drilldown to observe your Agent! 🕵️After your run, AgentOps prints a clickable url to console linking directly to your session in the Dashboard
Full Examples
A notebook demonstrating how to use AgentOps with Mistral can be found here.
from mistralai import Mistral
import agentops
agentops.init(<INSERT YOUR API KEY HERE>)
client = Mistral(api_key="your_api_key")
response = client.chat.complete(
model="mistral-small-latest",
messages=[
{
"role": "user",
"content": "Explain the history of the French Revolution."
}
],
)
print(response.choices[0].message.content)
agentops.end_session('Success')
Streaming Examples
from mistralai import Mistral
import agentops
agentops.init(<INSERT YOUR API KEY HERE>)
client = Mistral(api_key="your_api_key")
complete_response = ""
response = client.chat.stream(
model="mistral-small-latest",
messages=[
{
"role": "user",
"content": "Who was Joan of Arc?"
}
],
)
for chunk in response:
if chunk.data.choices[0].finish_reason == "stop":
print(complete_response)
else:
complete_response += chunk.data.choices[0].delta.content
agentops.end_session('Success')