LangChain v0.1.0 Launch: Observability

LangChain · Beginner ·📰 AI News & Updates ·2y ago

Key Takeaways

The video discusses the importance of observability in LangChain, a framework for building language model applications, and demonstrates various methods for achieving observability, including verbose and debug logging, as well as using LangSmith, a tool for logging and visualizing events.

Full Transcript

observability is a key part of Lang chain and we've put a lot of focus into making L chain have the best observability as possible as you're building complex applications with language models whether it be really long sequences of chains or whether it be more agentic Behavior being able to understand exactly what's going on inside your application becomes really really important and even if you're working with simpler chains often times the prompts you construct come from many different sources and so being able to see exactly what the inputs to the language model are exactly what the outputs are and all the steps along the way is really really important to being able to iterate and improve your application and we've designed Lang chain to have a bunch of different options to make it incredibly observable and have a high level of observability into exactly what is going on so walking through a few of these different options let's take a look at what it looks like if we're using an agent without loging we'll go over agents in other sections of this tutorial but here we can construct it rather quickly and then we can invoke it and we'll see that it takes a little bit to respond under the hood and and we'll see this later on it's making a few different LM calls it's calling out to a search engine and so there's quite a bit of of uh API calls that are being made and so we get back a final output but we don't exactly know what happen happened inside and so that makes it tough to iterate on the prompts there's you know we're using an agent prompt here um there's uh the llm that we're using there's the output parser that we have and all of those can be tuned according to what we want to accomplish but in order to do that we have to understand exactly what's happening so the first method that we have we added this really early on in Lang chain and it's been around ever since it's it's it was inspired by offer press's self- askk paper and it just prints out um the steps that happen um at at a highest level so we're not getting all the details but we're getting the high level of what's happening so if we set verose equals true here um and then recreate the agent and then we call it again we can see here that we have some nice printing of what exactly is going on so we're calling this tool with this search query we're getting back this response and then we're getting back this final answer and so again we're not seen all the information but we're seeing high level what steps are occurring so this is a good first pass we've added another method since then called debug equals true and this logs way more information and so it might be Overkill sometimes but other times it can be really helpful to see exactly what's going on so here we'll set verbose equals false we'll set debug equals true we'll recreate the agent and then we'll call it again and here we start getting lots of logs of everything that's going on and so this is really useful when you want to dig into what exactly is happening input output level of every step along the way so here we can see that we have so this is the exact prompt that's being used we've got a system message and a human message and again when you have really complex prompts in this case it's kind of simple but when you have really complex prompts it's really useful to be able to see what's going on we can see the formatted prompt we can see the exact Return of the chat gener um we can see the token counts there and then you know we we keep on getting this for the rest of the agent this is great if you're in a a repple environment like this uh uh Jupiter notebook but when you're maybe not in this or when you want to persist these logs more or if you just want to explore these logs in a more intuitive way right this is this is a little bit of a dump of everything um then you're probably going to want a more uh full-fledged tool and and that's why we built Lang Smith um Lang Smith isn't the focus of uh this video or the uh uh launch of Lang chain 0.1 in general um but it's absolutely worth highlighting because Lang chain is built to be the most observable framework but we've also built tools along the side to make that a reality so with Lang Smith what we can do is we can go into lsmith we can go to our project we can just set these three environment variables um and so we can do that here and I'm going to pause the video and put in my API key so you don't see it I've done that now we can now set debug equals false just to get rid of this noise and then we can run it and what's going to happen is in the background it's going to log everything to this Trace section here and then I can click into it and I can see the exact steps that occurred I can see so so here we're highlighting so as you notied with the Json there's a lot of events that are happening there's a lot of different formatting of prompts that are happening parsing that's happening um and so we have one view where you can see all of that you can click into the ones you can see uh uh what exactly the inputs are what exactly the outputs are um you can go into a playground experience and and edit it and play around with it there's a bunch of other functionality that's part of Lang Smith that I won't go into here but then we also have this most relevant run where we just show you the important events like API calls to llms retrieval calls tool calls things like that and so this is a really good way to see exactly what's going on inside your chains agents even just L calls if you're making if you're doing a lot of uh uh complex prompting there and and uh again this isn't the purpose of Lang chain 0.1 but I think this really shows how we've instrumented the whole Lang chain ecosystem around this really important idea of observability um which we've found to be incredibly crucial for building llm applications that actually work

Original Description

In this video we will walk through how we've ensured that LangChain 0.1 has best-in-class observability. Jupyter Notebook (to follow along): https://github.com/hwchase17/langchain-0.1-guides/blob/master/observability.ipynb JavaScript Notebook: https://github.com/bracesproul/langchainjs-0.1-guides/blob/main/observability.ipynb Other links: LangChain Debugging Guide: https://python.langchain.com/docs/guides/debugging LangSmith: https://smith.langchain.com/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from LangChain · LangChain · 38 of 60

1 Chat With Your Documents Using LangChain + JavaScript
Chat With Your Documents Using LangChain + JavaScript
LangChain
2 LangChain SQL Webinar
LangChain SQL Webinar
LangChain
3 LangChain "OpenAI functions" Webinar
LangChain "OpenAI functions" Webinar
LangChain
4 LangSmith Launch
LangSmith Launch
LangChain
5 LangChain x Pinecone: Supercharging Llama-2 with RAG
LangChain x Pinecone: Supercharging Llama-2 with RAG
LangChain
6 LangChain Expression Language
LangChain Expression Language
LangChain
7 Building LLM applications with LangChain with Lance
Building LLM applications with LangChain with Lance
LangChain
8 Benchmarking Question/Answering Over CSV Data
Benchmarking Question/Answering Over CSV Data
LangChain
9 LangChain "RAG Evaluation" Webinar
LangChain "RAG Evaluation" Webinar
LangChain
10 Fine-tuning in Your Voice Webinar
Fine-tuning in Your Voice Webinar
LangChain
11 Tabular Data Retrieval
Tabular Data Retrieval
LangChain
12 Building an LLM Application with Audio by AssemblyAI
Building an LLM Application with Audio by AssemblyAI
LangChain
13 Superagent Deepdive Webinar
Superagent Deepdive Webinar
LangChain
14 Lessons from Deploying LLMs with LangSmith
Lessons from Deploying LLMs with LangSmith
LangChain
15 Shortwave Assistant Deepdive Webinar
Shortwave Assistant Deepdive Webinar
LangChain
16 Cognitive Architectures for Language Agents
Cognitive Architectures for Language Agents
LangChain
17 Effectively Building with LLMs in the Browser with Jacob
Effectively Building with LLMs in the Browser with Jacob
LangChain
18 Data Privacy for LLMs
Data Privacy for LLMs
LangChain
19 "Theory of Mind" Webinar with Plastic Labs
"Theory of Mind" Webinar with Plastic Labs
LangChain
20 LangChain Templates
LangChain Templates
LangChain
21 Using Natural Language to Query Postgres with Jacob
Using Natural Language to Query Postgres with Jacob
LangChain
22 Building a Research Assistant from Scratch
Building a Research Assistant from Scratch
LangChain
23 Benchmarking RAG over LangChain Docs
Benchmarking RAG over LangChain Docs
LangChain
24 Skeleton-of-Thought: Building a New Template from Scratch
Skeleton-of-Thought: Building a New Template from Scratch
LangChain
25 Benchmarking Methods for Semi-Structured RAG
Benchmarking Methods for Semi-Structured RAG
LangChain
26 LangSmith Highlights: Getting Started
LangSmith Highlights: Getting Started
LangChain
27 LangSmith Highlights: Debugging
LangSmith Highlights: Debugging
LangChain
28 LangSmith Highlights: Datasets
LangSmith Highlights: Datasets
LangChain
29 LangSmith Highlights: Evaluation
LangSmith Highlights: Evaluation
LangChain
30 LangSmith Highlights: Human Annotation
LangSmith Highlights: Human Annotation
LangChain
31 LangSmith Highlights: Monitoring
LangSmith Highlights: Monitoring
LangChain
32 LangSmith Highlights: Hub
LangSmith Highlights: Hub
LangChain
33 SQL Research Assistant
SQL Research Assistant
LangChain
34 Getting Started with Multi-Modal LLMs
Getting Started with Multi-Modal LLMs
LangChain
35 Build a Full Stack RAG App With TypeScript
Build a Full Stack RAG App With TypeScript
LangChain
36 Auto-Prompt Builder (with Hosted LangServe)
Auto-Prompt Builder (with Hosted LangServe)
LangChain
37 LangChain v0.1.0 Launch: Introduction
LangChain v0.1.0 Launch: Introduction
LangChain
LangChain v0.1.0 Launch: Observability
LangChain v0.1.0 Launch: Observability
LangChain
39 LangChain v0.1.0 Launch: Integrations
LangChain v0.1.0 Launch: Integrations
LangChain
40 LangChain v0.1.0 Launch: Composability
LangChain v0.1.0 Launch: Composability
LangChain
41 LangChain v0.1.0 Launch: Streaming
LangChain v0.1.0 Launch: Streaming
LangChain
42 LangChain v0.1.0 Launch: Output Parsing
LangChain v0.1.0 Launch: Output Parsing
LangChain
43 LangChain v0.1.0 Launch: Retrieval
LangChain v0.1.0 Launch: Retrieval
LangChain
44 LangChain v0.1.0 Launch: Agents
LangChain v0.1.0 Launch: Agents
LangChain
45 Build and Deploy a RAG app with Pinecone Serverless
Build and Deploy a RAG app with Pinecone Serverless
LangChain
46 Hosted LangServe + LangChain Templates
Hosted LangServe + LangChain Templates
LangChain
47 LangGraph: Intro
LangGraph: Intro
LangChain
48 LangGraph: Agent Executor
LangGraph: Agent Executor
LangChain
49 LangGraph: Chat Agent Executor
LangGraph: Chat Agent Executor
LangChain
50 LangGraph: Human-in-the-Loop
LangGraph: Human-in-the-Loop
LangChain
51 LangGraph: Dynamically Returning a Tool Output Directly
LangGraph: Dynamically Returning a Tool Output Directly
LangChain
52 LangGraph: Respond in a Specific Format
LangGraph: Respond in a Specific Format
LangChain
53 LangGraph: Managing Agent Steps
LangGraph: Managing Agent Steps
LangChain
54 LangGraph: Force-Calling a Tool
LangGraph: Force-Calling a Tool
LangChain
55 LangGraph: Multi-Agent Workflows
LangGraph: Multi-Agent Workflows
LangChain
56 Streaming Events: Introducing a new `stream_events` method
Streaming Events: Introducing a new `stream_events` method
LangChain
57 Building a web RAG chatbot: using LangChain, Exa (prev. Metaphor), LangSmith, and Hosted Langserve
Building a web RAG chatbot: using LangChain, Exa (prev. Metaphor), LangSmith, and Hosted Langserve
LangChain
58 OpenGPTs
OpenGPTs
LangChain
59 Open Source RAG with Nomic's New Embedding Model (and ChromaDB and Ollama)
Open Source RAG with Nomic's New Embedding Model (and ChromaDB and Ollama)
LangChain
60 LangGraph: Persistence
LangGraph: Persistence
LangChain

The video teaches the importance of observability in LangChain and demonstrates various methods for achieving it, including logging and visualization tools. Observability is crucial for building effective LLM applications. By following along with the provided Jupyter Notebook or JavaScript Notebook, viewers can learn how to implement these methods in their own projects.

Key Takeaways
  1. Set up LangChain and create an agent
  2. Use verbose logging to print high-level steps
  3. Use debug logging to log detailed information
  4. Use LangSmith to log and visualize events
  5. Explore the LangSmith interface to view and edit events
💡 Observability is a key aspect of building effective LLM applications, and LangChain provides various methods for achieving it, including logging and visualization tools.

Related AI Lessons

Up next
Man dies after horror Gold Coast house fire; high-speed Sydney motorway pursuit | 9 News Australia
9 News Australia
Watch →