QADataGenerator Class

Class for generating Question-Answer data from text.

Initialize QADataGenerator using Azure OpenAI details.

Inheritance
builtins.object
QADataGenerator

Constructor

QADataGenerator(model_config: Dict, **kwargs: Any)

Parameters

Name Description
model_config
Required

Methods

export_to_file

Writes results from QA gen to a jsonl file for Promptflow batch run results is either a list of questions and answers or list of list of questions and answers grouped by their chunk e.g. [("How are you?", "I am good.")] or [ [("How are you?", "I am good.")], [("What can I do?", "Tell me a joke.")]

generate
generate_async

export_to_file

Writes results from QA gen to a jsonl file for Promptflow batch run results is either a list of questions and answers or list of list of questions and answers grouped by their chunk e.g. [("How are you?", "I am good.")] or [ [("How are you?", "I am good.")], [("What can I do?", "Tell me a joke.")]

export_to_file(output_path: str, qa_type: QAType, results: List | List[List], output_format: OutputStructure = OutputStructure.PROMPTFLOW, field_mapping: Dict[str, str] = {'chat_history_key': 'chat_history', 'question_key': 'question'})

generate

generate(text: str, qa_type: QAType, num_questions: int | None = None) -> Dict

generate_async

generate_async(text: str, qa_type: QAType, num_questions: int | None = None) -> Dict