-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsummarizer.py
More file actions
33 lines (24 loc) · 966 Bytes
/
summarizer.py
File metadata and controls
33 lines (24 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Module for the summarizer baseclass."""
from abc import ABC, abstractmethod
from typing import Optional
from langchain_core.runnables import RunnableConfig
from rag_core_lib.runnables.async_runnable import AsyncRunnable
SummarizerInput = str
SummarizerOutput = str
class Summarizer(AsyncRunnable[SummarizerInput, SummarizerOutput], ABC):
"""Baseclass for summarizers."""
@abstractmethod
async def ainvoke(self, query: SummarizerInput, config: Optional[RunnableConfig] = None) -> SummarizerOutput:
"""
Asynchronously invoke the summarizer with the given query and configuration.
Parameters
----------
query : SummarizerInput
The input query for the summarizer.
config : Optional[RunnableConfig], optional
The configuration for the summarizer, by default None.
Returns
-------
SummarizerOutput
The output of the summarizer.
"""