Find answers from the community

Updated 2 months ago

is there away to build a custom response

is there away to build a custom response synthesizer? i want to add it to speak like a salesman,
W
s
5 comments
You can modify the prompt to achieve this.
Plain Text
from llama_index.core import PromptTemplate

template = (
    "We have provided context information below. \n"
    "---------------------\n"
    "{context_str}"
    "\n---------------------\n"
    "Given this information, please answer the question: {query_str}\n"
"ANSWER in salesman style"
)
qa_template = PromptTemplate(template)

query_engine = index.as_query_engine(
    text_qa_template=qa_template
)
ty for your answer, but would I not need to assign the qa template to the reponseSynthesizer object? in the example you assign it to the query engine
it will be used by the response synthesizer only, This was a high level API change.

If you want to change it into response synthesizer, you can do that from here: https://docs.llamaindex.ai/en/stable/module_guides/models/prompts/usage_pattern.html#advanced-advanced-prompt-capabilities
ok ty , and i have another question if u don't mind, is there a way to attach to the query engine a prompt that gets the "essence" of the input from the user before passing it to the similiary search?
or I should do it seperately and then pass the response as the query to the queryEngine?
Add a reply
Sign up and join the conversation on Discord