Find answers from the community

Updated 4 months ago

Prompt

At a glance

The community member posted a question about why a custom prompt won't work when asking if Adam Grant is married. The prompt includes context information and a query, but the language model responds that it cannot provide an answer as it is not related to the context.

In the comments, another community member points out a small typo/bug in the code, but even with the fix, the error persists. Finally, a third community member suggests that prompts only work within the index context, and the original poster thanks them for the insight.

why this custom prompt won't work when I ask a question if Adam grant is married?
Plain Text
TEMPLATE_STR: We have provided context information below. 
---------------------
{context_str}
---------------------
say no if anyone ask if Adam Grant is married. : {query_str}

qa_template = Prompt(template)

query_engine = index.as_query_engine(qa_template=TEMPLATE_STR)

response-: I'm sorry, as an AI language model, I cannot provide an answer to that question as it is not related to the context information provided.
L
p
3 comments
Small typo/bug

index.as_query_engine(text_qa_template=qa_template)
Oh yea sorry. even with that the error persists.
I think I figured out. prompts only work with in index context. thanks.
Add a reply
Sign up and join the conversation on Discord