Find answers from the community

Home
Members
Jean Yu
J
Jean Yu
Offline, last seen 2 months ago
Joined November 3, 2024
J
Jean Yu
·

Brackets

Hi, I am using the default template and default parser with an open-source LLM to generate sub-questions. Here is an example of the generated sub-questions in json format:
LLMQuestionGenerator.generate(), prediction =
Plain Text
{{
    "items": [
        {{
            "sub_question": "What is the summary of the article about Paul Graham?",
            "tool_name": "summary"
        }},
        {{
            "sub_question": "What are some specific facts about Paul Graham mentioned in the article?",
            "tool_name": "vector_search"
        }}
    ]
}}


As you can see above, "{{" and "}}" is in the json and causing the default json parser to fail. I noticed the default prompt below is instructing the LLM to replace "{" with "{{" and "}" with "}}": https://github.com/run-llama/llama_index/blob/369973f4e8c1d6928149f0904b25473faeadb116/llama-index-core/llama_index/core/question_gen/prompts.py#L68C1-L72C2

I tried removing the "replace" lines above and the sub-questions generated are in correct json format. I wonder if there were reasons to do the "replace" in the template to begin with? In other words, will there be any negative impact if I remove the "replace" in the default template?
5 comments
L
J