Flyte is an open-source orchestrator that facilitates building production-grade data and ML pipelines. It is built for scalability and reproducibility, leveraging Kubernetes as its underlying platform.The purpose of this notebook is to demonstrate the integration of a
FlyteCallback
into your Flyte task, enabling you to effectively monitor and track your LangChain experiments.
Installation & Setup
- Install the Flytekit library by running the command
pip install flytekit
. - Install the Flytekit-Envd plugin by running the command
pip install flytekitplugins-envd
. - Install LangChain by running the command
pip install langchain
. - Install Docker on your system.
Flyte Tasks
A Flyte task serves as the foundational building block of Flyte. To execute LangChain experiments, you need to write Flyte tasks that define the specific steps and operations involved. NOTE: The getting started guide offers detailed, step-by-step instructions on installing Flyte locally and running your initial Flyte pipeline. First, import the necessary dependencies to support your LangChain experiments.<your_openai_api_key>
and <your_serp_api_key>
with your respective API keys obtained from OpenAI and Serp API.
To guarantee reproducibility of your pipelines, Flyte tasks are containerized.
Each Flyte task must be associated with an image, which can either be shared across the entire Flyte workflow or provided separately for each task.
To streamline the process of supplying the required dependencies for each Flyte task, you can initialize an ImageSpec
object.
This approach automatically triggers a Docker build, alleviating the need for users to manually create a Docker image.
LLM
Chain
Agent
Execute the Flyte Tasks on Kubernetes
To execute the Flyte tasks on the configured Flyte backend, use the following command:langchain_llm
task on the Flyte backend. You can trigger the remaining two tasks in a similar manner.
The metrics will be displayed on the Flyte UI as follows:
