Files
crewAI/src/crewai/knowledge/storage/base_knowledge_storage.py
Greyson LaLonde f28e78c5ba
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
refactor: unify rag storage with instance-specific client support (#3455)
- 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
2025-09-17 14:46:54 -04:00

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."""