langchain_community.callbacks.mlflow_callback.MlflowLogger

class langchain_community.callbacks.mlflow_callback.MlflowLogger(**kwargs: Any)[source]

Callback Handler that logs metrics and artifacts to mlflow server.

Parameters
  • name (str) – Name of the run.

  • experiment (str) – Name of the experiment.

  • tags (dict) – Tags to be attached for the run.

  • tracking_uri (str) – MLflow tracking server uri.

This handler implements the helper functions to initialize, log metrics and artifacts to the mlflow server.

Methods

__init__(**kwargs)

artifact(path)

To upload the file from given path as artifact.

finish_run()

To finish the run.

html(html, filename)

To log the input html string as html file artifact.

jsonf(data, filename)

To log the input data as json file artifact.

langchain_artifact(chain)

metric(key, value)

To log metric to mlflow server.

metrics(data[, step])

To log all metrics in the input dict.

start_run(name, tags[, run_id])

If run_id is provided, it will reuse the run with the given run_id.

table(name, dataframe)

To log the input pandas dataframe as a html table

text(text, filename)

To log the input text as text file artifact.

__init__(**kwargs: Any)[source]
artifact(path: str) None[source]

To upload the file from given path as artifact.

finish_run() None[source]

To finish the run.

html(html: str, filename: str) None[source]

To log the input html string as html file artifact.

jsonf(data: Dict[str, Any], filename: str) None[source]

To log the input data as json file artifact.

langchain_artifact(chain: Any) None[source]
metric(key: str, value: float) None[source]

To log metric to mlflow server.

metrics(data: Union[Dict[str, float], Dict[str, int]], step: Optional[int] = 0) None[source]

To log all metrics in the input dict.

start_run(name: str, tags: Dict[str, str], run_id: Optional[str] = None) None[source]

If run_id is provided, it will reuse the run with the given run_id. Otherwise, it starts a new run, auto generates the random suffix for name.

table(name: str, dataframe) None[source]

To log the input pandas dataframe as a html table

text(text: str, filename: str) None[source]

To log the input text as text file artifact.