Skip to content

ValueError: Prompt missing required variables: {'agent_scratchpad'} #23163

Answered by dosubot bot
Ma-Zijing asked this question in Q&A
Discussion options

You must be logged in to vote

To resolve the ValueError: Prompt missing required variables: {'agent_scratchpad'} error, you need to ensure that your ChatPromptTemplate includes the agent_scratchpad key as a MessagesPlaceholder. Here is how you can modify your code:

from langchain.agents import AgentExecutor, create_tool_calling_agent, tool
from langchain_core.prompts import ChatPromptTemplate

retriever_tool = create_retriever_tool(
    retriever, 
    "similar_app_search",
    "Search for information about the given Android app. For any questions about the given Android app, you must use this tool!"
)
tools = [retriever_tool]
role_prompt = "Given app name to you, you need to search related information."

prompt = Ch…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Ma-Zijing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant