forked from Archives/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
700 B
Python
26 lines
700 B
Python
"""Interface to access to place that stores documents."""
|
|
from abc import ABC, abstractmethod
|
|
from typing import Dict, Union
|
|
|
|
from langchain.docstore.document import Document
|
|
|
|
|
|
class Docstore(ABC):
|
|
"""Interface to access to place that stores documents."""
|
|
|
|
@abstractmethod
|
|
def search(self, search: str) -> Union[str, Document]:
|
|
"""Search for document.
|
|
|
|
If page exists, return the page summary, and a Document object.
|
|
If page does not exist, return similar entries.
|
|
"""
|
|
|
|
|
|
class AddableMixin(ABC):
|
|
"""Mixin class that supports adding texts."""
|
|
|
|
@abstractmethod
|
|
def add(self, texts: Dict[str, Document]) -> None:
|
|
"""Add more documents."""
|