mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
* sort imports * update --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> Co-authored-by: Eduardo Chiarotti <dudumelgaco@hotmail.com>
30 lines
768 B
Python
30 lines
768 B
Python
from abc import ABC, abstractmethod
|
|
from typing import Any, Dict, List, Optional
|
|
|
|
|
|
class BaseKnowledgeStorage(ABC):
|
|
"""Abstract base class for knowledge storage implementations."""
|
|
|
|
@abstractmethod
|
|
def search(
|
|
self,
|
|
query: List[str],
|
|
limit: int = 3,
|
|
filter: Optional[dict] = None,
|
|
score_threshold: float = 0.35,
|
|
) -> List[Dict[str, Any]]:
|
|
"""Search for documents in the knowledge base."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def save(
|
|
self, documents: List[str], metadata: Dict[str, Any] | List[Dict[str, Any]]
|
|
) -> None:
|
|
"""Save documents to the knowledge base."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def reset(self) -> None:
|
|
"""Reset the knowledge base."""
|
|
pass
|