Download this file

37 lines (26 with data), 924 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
34
35
36
"""
Enrichments interface
"""
from abc import ABC, abstractmethod
class Enrichments(ABC):
"""Interface for enrichment models.
This is an interface meant for implementing text enrichment models.
Enrichment models are used to enrich node or relation features in a given knowledge graph.
"""
@abstractmethod
def enrich_documents(self, texts: list[str]) -> list[list[str]]:
"""Enrich documents.
Args:
texts: List of documents to enrich.
Returns:
List of enriched documents.
"""
@abstractmethod
def enrich_documents_with_rag(self, texts: list[str], docs: list[str]) -> list[str]:
"""Enrich documents with RAG.
Args:
texts: List of documents to enrich.
docs: List of reference documents to enrich the input texts.
Returns:
List of enriched documents with RAG.
"""