From 6ca6e25a1e6b4f6c30873af324ac4c41f377195d Mon Sep 17 00:00:00 2001 From: Niklas Koehnecke Date: Wed, 24 Jan 2024 10:02:55 +0100 Subject: [PATCH] IL-167 add documentation and expose new classes --- src/intelligence_layer/use_cases/__init__.py | 2 ++ .../use_cases/qa/retriever_based_qa.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/intelligence_layer/use_cases/__init__.py b/src/intelligence_layer/use_cases/__init__.py index 5cebae524..c244132bb 100644 --- a/src/intelligence_layer/use_cases/__init__.py +++ b/src/intelligence_layer/use_cases/__init__.py @@ -37,8 +37,10 @@ from .qa.long_context_qa import LongContextQaInput as LongContextQaInput from .qa.multiple_chunk_qa import MultipleChunkQa as MultipleChunkQa from .qa.multiple_chunk_qa import MultipleChunkQaInput as MultipleChunkQaInput +from .qa.retriever_based_qa import EnrichedSubanswer as EnrichedSubanswer from .qa.retriever_based_qa import RetrieverBasedQa as RetrieverBasedQa from .qa.retriever_based_qa import RetrieverBasedQaInput as RetrieverBasedQaInput +from .qa.retriever_based_qa import RetrieverBasedQaOutput as RetrieverBasedQaOutput from .qa.single_chunk_qa import SingleChunkQa as SingleChunkQa from .qa.single_chunk_qa import SingleChunkQaInput as SingleChunkQaInput from .qa.single_chunk_qa import SingleChunkQaOutput as SingleChunkQaOutput diff --git a/src/intelligence_layer/use_cases/qa/retriever_based_qa.py b/src/intelligence_layer/use_cases/qa/retriever_based_qa.py index 9ba16ac6e..c3a9cb135 100644 --- a/src/intelligence_layer/use_cases/qa/retriever_based_qa.py +++ b/src/intelligence_layer/use_cases/qa/retriever_based_qa.py @@ -32,6 +32,16 @@ class RetrieverBasedQaInput(BaseModel): class EnrichedSubanswer(Subanswer, Generic[ID]): + """Individual answer for a chunk that also contains the origin of the chunk. + + Attributes: + answer: The answer generated by the task. Can be a string or None (if no answer was found). + chunk: Piece of the original text that answer is based on. + highlights: The specific sentences that explain the answer the most. + These are generated by the `TextHighlight` Task. + id: The id of the document where the chunk came from. + """ + id: ID