Files
crewAI/src/crewai/knowledge/storage/base_knowledge_storage.py
2025-05-12 13:30:50 +00:00

27 lines
705 B
Python

from abc import ABC, abstractmethod
from typing import Any
class BaseKnowledgeStorage(ABC):
"""Abstract base class for knowledge storage implementations."""
@abstractmethod
def search(
self,
query: list[str],
limit: int = 3,
filter: dict | None = None,
score_threshold: float = 0.35,
) -> list[dict[str, Any]]:
"""Search for documents in the knowledge base."""
@abstractmethod
def save(
self, documents: list[str], metadata: dict[str, Any] | list[dict[str, Any]],
) -> None:
"""Save documents to the knowledge base."""
@abstractmethod
def reset(self) -> None:
"""Reset the knowledge base."""