Find answers from the community

Home
Members
mcmancsu
m
mcmancsu
Offline, last seen 3 months ago
Joined September 25, 2024
Are there some general rules / guidelines to ensure a more consistent response from the the API when making a query in terms of the formatting of the response? I am using some TOKEN_START and END and asking it fill in the middle as part of the QA_TEMPLATE and such, but the response format is not always 100%. I am currently trying to catch these edge cases and build code around them, but maybe I am making it too hard on myself so I figured I ask here!
7 comments
L
m
I feel a bit dumb here, but my RefinePrompt doesn't appear to be working.. The prompt doesn't seem to take any context into consideration (for example, it doesn't lead with "I am a ROBOT".

Here is what I have:
Plain Text
DEFAULT_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 and using the best of your knowledge, improve the existing answer. "
    "If you can't improve the existing answer, just repeat it again. Lastly, prefix all responses "
    "with 'I am a ROBOT!'"
)

    index = GPTSimpleVectorIndex.load_from_disk(output_file_html)

    chat_refine_prompt = RefinePrompt(DEFAULT_REFINE_PROMPT_TMPL)
    response = index.query(query_str=question,
                           response_mode="compact",
                           refine_template=chat_refine_prompt,
                           similarity_top_k=3)
17 comments
L
m