Spaces:
Sleeping
Sleeping
File size: 545 Bytes
283e483 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from abc import ABC, abstractmethod
from typing import Any
from graphgen.bases.base_llm_wrapper import BaseLLMWrapper
class BaseExtractor(ABC):
"""
Extract information from given text.
"""
def __init__(self, llm_client: BaseLLMWrapper):
self.llm_client = llm_client
@abstractmethod
async def extract(self, chunk: dict) -> Any:
"""Extract information from the given text"""
@abstractmethod
def build_prompt(self, text: str) -> str:
"""Build prompt for LLM based on the given text"""
|