fed8b2eed7
Backend release / release (push) Waiting to run
Bandit Security Scan / bandit_scan (push) Waiting to run
Build and push multi-arch DocsGPT Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Waiting to run
Build and push multi-arch DocsGPT Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Waiting to run
Build and push multi-arch DocsGPT Docker image / manifest (push) Blocked by required conditions
Build and push DocsGPT FE Docker image for development / build (linux/amd64, ubuntu-latest, amd64) (push) Waiting to run
Build and push DocsGPT FE Docker image for development / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Waiting to run
Build and push DocsGPT FE Docker image for development / manifest (push) Blocked by required conditions
Python linting / ruff (push) Waiting to run
Run python tests with pytest / Run tests and count coverage (3.12) (push) Waiting to run
React Widget Build / build (push) Waiting to run
20 lines
654 B
Python
20 lines
654 B
Python
"""Base reader class."""
|
|
from abc import abstractmethod
|
|
from typing import Any, List
|
|
|
|
from langchain_core.documents import Document as LCDocument
|
|
from application.parser.schema.base import Document
|
|
|
|
|
|
class BaseReader:
|
|
"""Utilities for loading data from a directory."""
|
|
|
|
@abstractmethod
|
|
def load_data(self, *args: Any, **load_kwargs: Any) -> List[Document]:
|
|
"""Load data from the input directory."""
|
|
|
|
def load_langchain_documents(self, **load_kwargs: Any) -> List[LCDocument]:
|
|
"""Load data in LangChain document format."""
|
|
docs = self.load_data(**load_kwargs)
|
|
return [d.to_langchain_format() for d in docs]
|