mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
Some checks failed
Notify Downstream / notify-downstream (push) Has been cancelled
Update Test Durations / update-durations (3.10) (push) Has been cancelled
Update Test Durations / update-durations (3.11) (push) Has been cancelled
Update Test Durations / update-durations (3.12) (push) Has been cancelled
Update Test Durations / update-durations (3.13) (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
- ignore line length errors globally - migrate knowledge/memory and crew query_knowledge to `SearchResult` - remove legacy chromadb utils; fix empty metadata handling - restore openai as default embedding provider; support instance-specific clients - update and fix tests for `SearchResult` migration and rag changes
27 lines
701 B
Python
27 lines
701 B
Python
from abc import ABC, abstractmethod
|
|
from typing import Any
|
|
|
|
from crewai.rag.types import SearchResult
|
|
|
|
|
|
class BaseKnowledgeStorage(ABC):
|
|
"""Abstract base class for knowledge storage implementations."""
|
|
|
|
@abstractmethod
|
|
def search(
|
|
self,
|
|
query: list[str],
|
|
limit: int = 3,
|
|
metadata_filter: dict[str, Any] | None = None,
|
|
score_threshold: float = 0.35,
|
|
) -> list[SearchResult]:
|
|
"""Search for documents in the knowledge base."""
|
|
|
|
@abstractmethod
|
|
def save(self, documents: list[str]) -> None:
|
|
"""Save documents to the knowledge base."""
|
|
|
|
@abstractmethod
|
|
def reset(self) -> None:
|
|
"""Reset the knowledge base."""
|