mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 16:48:30 +00:00
- Replace Dict, List, Set, Tuple with dict, list, set, tuple throughout codebase - Add missing type annotations to crew_events.py methods - Add proper type annotations to test_crew_cancellation.py - Use type: ignore[method-assign] comments for mock assignments - Maintain backward compatibility while modernizing type hints This resolves lint and type-checker failures in CI while preserving the cancellation functionality. Co-Authored-By: João <joao@crewai.com>
30 lines
756 B
Python
30 lines
756 B
Python
from abc import ABC, abstractmethod
|
|
from typing import Any, 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
|