mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
22 lines
779 B
Python
22 lines
779 B
Python
# Initialize a ChatOpenAI model
|
|
llm = ChatOpenAI(model="gpt-4o", temperature=0)
|
|
|
|
from langgraph.prebuilt import create_react_agent
|
|
from langgraph.checkpoint.memory import MemorySaver
|
|
|
|
# Create the agent with LangGraph
|
|
memory = MemorySaver()
|
|
agent_executor = create_react_agent(
|
|
llm,
|
|
tools,
|
|
checkpointer=memory
|
|
)
|
|
|
|
# Pass the LangGraph agent to the adapter
|
|
wrapped_agent = LangChainAgentAdapter(
|
|
langchain_agent=agent_executor,
|
|
tools=tools,
|
|
role="San Francisco Travel Advisor",
|
|
goal="Curate a detailed list of the best neighborhoods to live in, restaurants to dine at, and attractions to visit in San Francisco.",
|
|
backstory="An expert travel advisor with insider knowledge of San Francisco's vibrant culture, culinary delights, and hidden gems.",
|
|
) |