Find answers from the community

Updated 2 months ago

athenawisdoms 0581 Could you share your

Could you share your refine/qa prompt? Im doing something similar rn
a
n
L
20 comments
Plain Text
TEXT_QA_PROMPT_TMPL = (
    "Context information is below. \n"
    "---------------------\n"
    "{context_str}"
    "\n---------------------\n"
    "If the context is not relavent, ignore it completely. \n"
    "Given the context information and using the best of your prior knowledge, \n"
    "answer the question: {query_str}\n"
)
qa_prompt = QuestionAnswerPrompt(TEXT_QA_PROMPT_TMPL)
I'm trying to maintain the same style of response even after passing the index.query Tool into an agent
But cant πŸ™‚ Need some help there
How about the refine tmpl?
Plain Text
REFINE_PROMPT_TMPL = (
    "The original question is as follows: {query_str}\n"
    "We have provided an existing answer: {existing_answer}\n"
    "We have the opportunity to refine the existing answer "
    "(only if needed) with some more context below.\n"
    "------------\n"
    "{context_msg}\n"
    "------------\n"
    "Given the new context, respond in a comical style."
)
Lemme play around with some things on my side and get back to you!
I'm guessing theres additional prompts to use with initialize_agent, but cant find it
Thanks Logan! Can you tell me, it looks like we don't have to define the parmaeters query_str, existing_answer and context_msg. How are these being fetched?
Or am i misunderstanding, and we have to define those on our side?
Those variables are filled in automatically by llama index under the hood πŸ‘Œ if you are familiar with python, you can step through with a debugger into the source code and watch how they get filled in πŸ˜€
Wow thanks!! I tried adding agent_kwargs={"prefix": prefix, "suffix": suffix} and it appears to work!
Where can we find the default template for prefix and suffix?
Somewhere in the langchain code, it's different for every agent type... I'll find the link for one of them lol
Thats it! Was just going to send that link lol
Very helpful, thanks!!!
Add a reply
Sign up and join the conversation on Discord