Skip to content

Base query engine

BaseQueryEngine

Bases: ABC

Source code in griptape/engines/query/base_query_engine.py
@define
class BaseQueryEngine(ABC):
    @abstractmethod
    def query(
        self,
        query: str,
        namespace: Optional[str] = None,
        *,
        rulesets: Optional[list[Ruleset]] = None,
        top_n: Optional[int] = None,
        filter: Optional[dict] = None,
    ) -> TextArtifact: ...

    @abstractmethod
    def load_artifacts(self, namespace: str) -> ListArtifact: ...

    @abstractmethod
    def upsert_text_artifact(self, artifact: TextArtifact, namespace: Optional[str] = None) -> str: ...

    @abstractmethod
    def upsert_text_artifacts(self, artifacts: list[TextArtifact], namespace: str) -> None: ...

load_artifacts(namespace) abstractmethod

Source code in griptape/engines/query/base_query_engine.py
@abstractmethod
def load_artifacts(self, namespace: str) -> ListArtifact: ...

query(query, namespace=None, *, rulesets=None, top_n=None, filter=None) abstractmethod

Source code in griptape/engines/query/base_query_engine.py
@abstractmethod
def query(
    self,
    query: str,
    namespace: Optional[str] = None,
    *,
    rulesets: Optional[list[Ruleset]] = None,
    top_n: Optional[int] = None,
    filter: Optional[dict] = None,
) -> TextArtifact: ...

upsert_text_artifact(artifact, namespace=None) abstractmethod

Source code in griptape/engines/query/base_query_engine.py
@abstractmethod
def upsert_text_artifact(self, artifact: TextArtifact, namespace: Optional[str] = None) -> str: ...

upsert_text_artifacts(artifacts, namespace) abstractmethod

Source code in griptape/engines/query/base_query_engine.py
@abstractmethod
def upsert_text_artifacts(self, artifacts: list[TextArtifact], namespace: str) -> None: ...