data_generator.generate_questions_from_nodes()
Context information is below. --------------------- {context_str} --------------------- Given the context information and not prior knowledge. generate only questions based on the below query. {query_str}
from llama_index.prompts import PromptTemplate text_question_template_str = ( "Les informations contextuelles sont ci-dessous.\n" "-----------------------------------------------\n" "{context_str}\n" "-----------------------------------------------\n" "Compte tenu des informations contextuelles et non des connaissances prĂ©alables.\n" "GĂ©nĂ©rer uniquement des questions basĂ©es sur la requĂȘte ci-dessous.\n" "{query_str}" ) text_question_template = PromptTemplate(text_question_template_str) data_generator.update_prompts({"text_question_template": text_question_template})
query_str
is always in English.query_str: "You are a Teacher/Professor. Your task is to setup 10 questions for an upcoming quiz/examination. The questions should be diverse in nature across the document. Restrict the questions to the context information provided."
query_str
to French?from llama_index.prompts import PromptTemplate from llama_index.evaluation import DatasetGenerator # https://github.com/run-llama/llama_index/blob/main/llama_index/evaluation/dataset_generation.py#L97 data_generator = DatasetGenerator.from_documents( documents, num_questions_per_chunk = 10, text_question_template = PromptTemplate(( "Les informations contextuelles sont ci-dessous.\n" "-----------------------------------------------\n" "{context_str}\n" "-----------------------------------------------\n" "Compte tenu des informations contextuelles et non des connaissances prĂ©alables.\n" "GĂ©nĂ©rer uniquement des questions basĂ©es sur la requĂȘte ci-dessous.\n" "{query_str}" )), text_qa_template = PromptTemplate(( "Les informations contextuelles sont ci-dessous.\n" "-----------------------------------------------\n" "{context_str}\n" "-----------------------------------------------\n" "Compte tenu des informations contextuelles et non des connaissances prĂ©alables, rĂ©ponder Ă la requĂȘte.\n" "RequĂȘte: {query_str}\n" "RĂ©ponse:" )), question_gen_query = ( "Vous ĂȘtes un enseignant/professeur." "Votre tĂąche consiste Ă crĂ©er {num_questions_per_chunk} questions pour un quiz/examen Ă venir." "Les questions doivent ĂȘtre de nature diverse dans tout le document." "Limiter les questions aux informations contextuelles fournies." ) )