Zack Saadioui
8/26/2024
1 2 3 4
from llama_index.core.evaluation import DatasetGenerator # Initialize DatasetGenerator generator = DatasetGenerator(nodes=my_docs, llm=my_language_model, num_questions_per_chunk=10)
1
nodes
1
llm
1
num_questions_per_chunk
1
2
python
questions = generator.generate_questions_from_nodes(num=10) # Adjust number as needed
1
2
python
full_dataset = generator.generate_dataset_from_nodes(num=10) # getting both questions & answers
1
2
3
4
python
async def generate_in_background():
dataset = await generator.agenerate_dataset_from_nodes(num=10)
return dataset
1
num_questions_per_chunk
1
text_question_template
Copyright © Arsturn 2024