shlogg · Early preview
Njoku Samson Ebere @eberetwit

Fixing Hub Pull Error In Langchain Agent Deployment

Fix Langchain agent error: remove `const prompt = await pull...` code & define new prompt with "agent_scratchpad" MessagesPlaceholder, e.g. ["user", "{input}"], ["user", "Answer in detail..."]

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",...