mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
- introduce baseembeddingsprovider and helper for embedding functions - add core embedding types and migrate providers, factory, and storage modules - remove unused type aliases and fix pydantic schema error - update providers with env var support and related fixes
23 lines
733 B
Python
23 lines
733 B
Python
"""Custom embedding function base implementation."""
|
|
|
|
from crewai.rag.core.base_embeddings_callable import EmbeddingFunction
|
|
from crewai.rag.core.types import Documents, Embeddings
|
|
|
|
|
|
class CustomEmbeddingFunction(EmbeddingFunction[Documents]):
|
|
"""Base class for custom embedding functions.
|
|
|
|
This provides a concrete implementation that can be subclassed for custom embeddings.
|
|
"""
|
|
|
|
def __call__(self, input: Documents) -> Embeddings:
|
|
"""Convert input documents to embeddings.
|
|
|
|
Args:
|
|
input: List of documents to embed.
|
|
|
|
Returns:
|
|
List of numpy arrays representing the embeddings.
|
|
"""
|
|
raise NotImplementedError("Subclasses must implement __call__ method")
|