MLflow is an open-source platform developed by Databricks to assist in building better Generative AI (GenAI) applications.
MLflow provides a tracing feature that enhances model observability in your GenAI applications by capturing detailed information about the requests you make to the models within your applications. Tracing provides a way to record the inputs, outputs, and metadata associated with each intermediate step of a request, enabling you to easily pinpoint the source of bugs and unexpected behaviors.
The MLflow integration with Groq includes the following features:
mlflow.groq.autolog()
mlflow.evaluate()
# The Groq integration is available in mlflow >= 2.20.0
pip install mlflow groq
export GROQ_API_KEY="your-api-key"
# This process is optional, but it is recommended to use MLflow tracking server for better visualization and additional features
mlflow server
Let's enable MLflow auto-tracing with the Groq SDK. For more configurations, refer to the documentation for mlflow.groq
.
import mlflow
import groq
# Optional: Set a tracking URI and an experiment name if you have a tracking server
mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("Groq")
# Turn on auto tracing for Groq by calling mlflow.groq.autolog()
mlflow.groq.autolog()
client = groq.Groq()
# Use the create method to create new message
message = client.chat.completions.create(
model="qwen-2.5-32b",
messages=[
{
"role": "user",
"content": "Explain the importance of low latency LLMs.",
}
],
)
print(message.choices[0].message.content)
Now traces for your Groq usage are captured by MLflow! Let's get insights into our application's activities by visiting the MLflow tracking server
we set in Step 4 above (mlflow.set_tracking_uri("http://localhost:5000")
), which we can do by opening http://localhost:5000 in our browser.
For more configuration and detailed resources for managing your Groq applications with MLflow, see: