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

Software Engineer for AI Training Data (School Specific)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Python)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Tier 2)

@ G2i Inc | Remote

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US