mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
21 lines
676 B
Python
21 lines
676 B
Python
"""HuggingFace embeddings provider."""
|
|
|
|
from chromadb.utils.embedding_functions.huggingface_embedding_function import (
|
|
HuggingFaceEmbeddingServer,
|
|
)
|
|
from pydantic import Field
|
|
|
|
from crewai.rag.core.base_embeddings_provider import BaseEmbeddingsProvider
|
|
|
|
|
|
class HuggingFaceProvider(BaseEmbeddingsProvider[HuggingFaceEmbeddingServer]):
|
|
"""HuggingFace embeddings provider."""
|
|
|
|
embedding_callable: type[HuggingFaceEmbeddingServer] = Field(
|
|
default=HuggingFaceEmbeddingServer,
|
|
description="HuggingFace embedding function class",
|
|
)
|
|
url: str = Field(
|
|
description="HuggingFace API URL", validation_alias="EMBEDDINGS_HUGGINGFACE_URL"
|
|
)
|