Model class.
Weave supports the Mistral v1.0 SDK. For details on upgrading, see the migration guide.
Traces
It’s important to store traces of LLM applications in a central database, both during development and in production. You use these traces for debugging, and as a dataset that helps you improve your application. Weave automatically captures traces for mistralai. To use the library as usual, start by callingweave.init():
Wrap calls with your own ops
Once basic tracing works, you can wrap your MistralAI calls in Weave Ops to make them reproducible across experiments. Weave ops make results reproducible by automatically versioning code as you experiment, and they capture their inputs and outputs. Create a function decorated with@weave.op() that calls into mistralai.client.MistralClient.chat(), and Weave tracks the inputs and outputs for you. The following example shows how to do this for a cheese recommender:
Create a Model for easier experimentation
Organizing experimentation is difficult with many moving pieces. By using the Model class, you can capture and organize the experimental details of your app like your system prompt or the model you’re using. This helps organize and compare different iterations of your app.
Besides versioning code and capturing inputs and outputs, Models capture structured parameters that control your application’s behavior, making it easy to find what parameters worked best. You can also use Weave Models with serve, and Evaluations.
In the following example, you can experiment with model and country. Every time you change one of these, you get a new version of CheeseRecommender.
