Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add question generator with llamaindex #193

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

chziakas
Copy link

@chziakas chziakas commented Oct 9, 2023

Description

This PR introduces the QuestionGenerator class that leverages the llama_index library to automatically generate questions from a given document. This enhancement aims to streamline the question generation process by utilizing the capabilities of the llama_index and providing an easy-to-use interface for generating questions, including custom 'bad' questions if needed.

Changes

QuestionGenerator Class:

  • Initializing the Llama Index model.
  • Reading documents from a given directory path.
  • Generating questions based on the document content.
  • Combining generated questions with user-provided 'bad' questions.

Issue Addressed:
This PR addresses issue #191

@vercel
Copy link

vercel bot commented Oct 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
evals-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2023 0:47am

Args:
num_questions (int): The number of questions to be generated.
directory_path (str): The path to the directory containing the document.
bad_questions (list, optional): A list of custom 'bad' questions to be appended to the generated questions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

For bad_questions, I feel like could be renamed to 'additional_questions' as I can see users supplying additional specific good or bad questions unless there's a a plan for generator subclasses to use 'bad_questions' in the future.

Copy link
Contributor

@ColabDog ColabDog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please rename it to a generator class.

from deepeval.generator import QuestionGenerator

Can you also run black?

@@ -0,0 +1,68 @@
import os
from llama_index import SimpleDirectoryReader, ServiceContext
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To manage complex external dependencies, can you please move these inside the QuestionGenerator abstraction?

@ColabDog
Copy link
Contributor

Following up - this PR is good to merge in! On my side, I will need to restructure the tests to make them all pass and fix the infrastructure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants