March 27, 2024, 1:16 p.m. | NJOKU SAMSON EBERE

DEV Community dev.to

When trying to run your first agent (https://js.langchain.com/docs/integrations/tools/tavily_search#usage) in Langchain, you will probably run into the following error:



The problem is that Hub Pull returns false. That is this part of the code:



const prompt = await pull<ChatPromptTemplate>(
"hwchase17/openai-functions-agent"
);


To solve the problem, remove the code above and define a different prompt with a MessagesPlaceholder of "agent_scratchpad" like so:



 const prompt = ChatPromptTemplate.fromMessages([
new MessagesPlaceholder("agent_scratchpad"),
["user", "{input}"],
["user", "Answer the question in detail and state your source."], …

agent ai beginners code false functions hub langchain openai part prompt question returns solve state tutorial

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

Software Engineer, Data Tools - Full Stack

@ DoorDash | Pune, India

Senior Data Analyst

@ Artsy | New York City