Ask or search…

LangChain 🦜🔗

A framework for developing applications powered by Large Language Models (LLMs).


LangChain is a cutting-edge framework that facilitates the development of powerful applications driven by large language models. It follows two key principles: agenticity and data awareness. LangChain provides a wide range of modules that enable language models to connect with diverse data sources and interact seamlessly with their surroundings.
Use Arize and LangChain together to effectively monitor the performance of your LLM agents, identify areas that require improvement, and make prompt engineering decisions about your LLM applications. With Arize and LangChain together, data scientists and machine learning engineers can ensure that their LLM applications are running at peak efficiency, enabling them to deliver improved results and drive greater value for their organizations.

Import Libraries

To enable LangChain integration, first import both libraries.
!pip3 install langchain
!pip3 install arize
!pip3 install 'arize[AutoEmbeddings]'

Log Data To Arize

Pass in ArizeCallBackHandler within your LangChain application to log prompt response pairs to Arize.
from langchain.callbacks import StdOutCallbackHandler
from langchain.callbacks.arize_callback import ArizeCallbackHandler
from langchain.callbacks.base import CallbackManager
from langchain.llms import OpenAI
# Define callback handler for Arize
arize_callback = ArizeCallbackHandler(
manager = CallbackManager([StdOutCallbackHandler(), arize_callback])
llm = OpenAI(temperature=0, callback_manager=manager, verbose=True)
Last modified 10mo ago