hello-world-chain(Python)

Loading...

"Hello world" application notebook

This notebook creates a simple "Hello World" chain using Mosaic AI Agent Framework.

Install package

3

    Important The code in the following cell is required when you work in this notebook for development and testing. When you run this notebook from the driver notebook, you must comment out the line in the following cell.

    5

    Imports

    7

    Enable MLflow Tracing

    Enabling MLflow Tracing is required to:

    • View the trace visualization in this notebook
    • Capture the trace in production via Inference Tables
    • Evaluate the application
    9

      Helper functions

      Your chain must accept an array of OpenAI-formatted messages as a messages parameter.
      Schema: AWS | Azure

      11

      Create chain

      13

      Test the chain locally

      15

      Tell MLflow logging where to find your chain

      mlflow.models.set_model(model=...) function specifies the LangChain chain to use for evaluation and deployment. This is required to log this chain to MLflow with mlflow.langchain.log_model(...).

      17