Mlflow
mlflow
MlflowCallback
MlflowCallback(step=None, nested=False)
Bases: Callback
LLMeter callback to log test run parameters and metrics to an MLFlow tracking server.
This callback integrates with MLflow to track and log parameters and metrics from LLMeter test runs. It can operate either in the current MLflow run context or create nested runs for each test.
Example
import mlflow
from llmeter.callbacks import MlflowCallback
with mlflow.start_run():
runner = Runner(
endpoint=endpoint,
callbacks=[MlflowCallback()]
)
results = await runner.run()
Attributes:
| Name | Type | Description |
|---|---|---|
step |
int | None
|
Step number for MLflow metrics logging |
nested |
bool
|
Whether to create nested runs for each test |
parameters_names |
list
|
List of parameter names to log to MLflow |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int | None
|
Passed through to |
None
|
nested
|
bool
|
By default ( |
False
|
Raises:
| Type | Description |
|---|---|
ImportError
|
If MLflow is not installed |
Source code in llmeter/callbacks/mlflow.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
after_run
async
after_run(result)
Callback method executed after an LLMeter test run completes.
Logs parameters and metrics to MLflow, either in the current run context
or in a new nested run depending on the nested setting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
Result
|
LLMeter test run result containing parameters and metrics to log |
required |
Source code in llmeter/callbacks/mlflow.py
117 118 119 120 121 122 123 124 125 126 127 128 129 | |