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 generation for imagine la and bem dataset #144

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class QuestionAnswerAttributes(QuestionAnswerPair):
document_source: str
document_id: UUID
chunk_id: Optional[UUID]
dataset: str


class QuestionAnswerList(BaseModel):
Expand Down Expand Up @@ -69,7 +70,10 @@ def generate_question_answer_pairs(llm: str, message: str) -> QuestionAnswerList


def process_document_or_chunk(
document: Document | Chunk, num_of_chunks: int, llm: str
document: Document | Chunk,
num_of_chunks: int,
llm: str,
dataset: str,
) -> list[QuestionAnswerAttributes]:
generated_question_answers = generate_question_answer_pairs(
llm=llm,
Expand All @@ -88,6 +92,7 @@ def process_document_or_chunk(
question=generated_question_answer.question,
answer=generated_question_answer.answer,
chunk_id=None if is_document else document.id,
dataset=dataset,
)
question_answer_list.append(question_answer_item)

Expand Down
Loading