from transformers import pipeline class QuestionAnswering: def __init__(self, qa_pipeline: pipeline): self.qa_pipeline = qa_pipeline def answer_question(self, question: str, context: str) -> str: result = self.qa_pipeline(question=question, context=context) return result["answer"]