Functions, Calls, and Agents Short Course
Functions, Calls, and Agents Short Course
Agents with
LangChain
Function Calling
Function Calling
LangChain Expression
Language (LCEL)
LangChain Expression Language
(LCEL)
LangChain composes chains of components
LCEL and the runnable protocol define:
Means of modifying
parameters at
runtime
bind,…
● Runnables support:
○ Async, Batch and Streaming Support
○ Fallbacks
○ Parallelism
○ Logging is built in
Functions, Tools and
Agents with
LangChain
OpenAI functions in
LangChain
Pydantic
class User:
def __init__(self, name: str, age: int, email: str):
self.name = name
self.age = age
self.email = email
class User(BaseModel):
name: str
age: int
email: EmailStr
Functions, Tools and
Agents with
LangChain
LLM { …
sentiment: positive,
language: Spanish
structure … }
description
Extraction
[{ …
first name: Lang,
LLM
last name: Chain,
language: Python
… },
structure …
description ]
Functions, Tools and
Agents with
LangChain
Conversational Agent
Agent Basics
● Agents
○ are a combination of LLMs and code
○ LLMs reason about what steps to take and call
for actions.
● Agent loop
○ Choose a tool to use
○ Observe the output of the tool
○ Repeat until a stopping condition is met
● Stopping conditions can be:
○ LLM determined
○ Hardcoded rules