Been stuck on trying to add variables to the prompt. template using this example from Langchain Docs as a starting point.
ValidationError: 1 validation error for ConversationChain __root__ Got unexpected prompt input variables. The prompt expects ['history', 'input', 'daily_context'], but got ['history'] as inputs from memory, and input as the normal input key. (type=value_error
Any suggestions here to get past the validation?
daily_context = "It is a Saturday, the office is open."
template = """You are Jane's Boss.
Here is some context about today: {daily_context}
Current conversation:
{history}
Jane: {input}
AI:"""
PROMPT = PromptTemplate(input_variables=[ "history", "input", "daily_context"], template=template)
llm = OpenAI(temperature=0.4, model="gpt-3.5-turbo-instruct")
conversation = ConversationChain(
prompt=PROMPT,
llm=llm,
verbose=True,
memory=ConversationBufferMemory(),
)
When the context is available at this point you can prepopulate the prompt like so:
PROMPT = PromptTemplate.from_template(template).partial(daily_context=daily_context)
from_template
is the recommended way to instantiate a prompt, which saves you from specifying input variables.