Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/edge/ar/tools/ai-ml/ragtool.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ rag_tool = RagTool(config=config, summarize=True)

**خيارات الإعداد:**
- `model_name` (str): معرّف نموذج HuggingFace. القيمة الافتراضية: `hkunlp/instructor-base`. الخيارات: `hkunlp/instructor-xl`، `hkunlp/instructor-large`، `hkunlp/instructor-base`
- `device` (str): الجهاز للتشغيل. القيمة الافتراضية: `cpu`. الخيارات: `cpu`، `cuda`، `mps`
- `device` (str): الجهاز للتشغيل. القيمة الافتراضية: `cpu`. الخيارات: `cpu`، `cuda`، `mps`، `xpu`
- `instruction` (str): بادئة التعليمات للتضمينات

**متغيرات البيئة:**
Expand All @@ -485,7 +485,7 @@ rag_tool = RagTool(config=config, summarize=True)

**خيارات الإعداد:**
- `model_name` (str): اسم نموذج Sentence Transformers. القيمة الافتراضية: `all-MiniLM-L6-v2`. الخيارات: `all-mpnet-base-v2`، `all-MiniLM-L6-v2`، `paraphrase-multilingual-MiniLM-L12-v2`
- `device` (str): الجهاز للتشغيل. القيمة الافتراضية: `cpu`. الخيارات: `cpu`، `cuda`، `mps`
- `device` (str): الجهاز للتشغيل. القيمة الافتراضية: `cpu`. الخيارات: `cpu`، `cuda`، `mps`، `xpu`
- `normalize_embeddings` (bool): ما إذا كان يتم تطبيع التضمينات. القيمة الافتراضية: `False`

**متغيرات البيئة:**
Expand Down
4 changes: 2 additions & 2 deletions docs/edge/en/tools/ai-ml/ragtool.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ The `embedding_model` parameter accepts a `crewai.rag.embeddings.types.ProviderS

**Config Options:**
- `model_name` (str): HuggingFace model ID. Default: `hkunlp/instructor-base`. Options: `hkunlp/instructor-xl`, `hkunlp/instructor-large`, `hkunlp/instructor-base`
- `device` (str): Device to run on. Default: `cpu`. Options: `cpu`, `cuda`, `mps`
- `device` (str): Device to run on. Default: `cpu`. Options: `cpu`, `cuda`, `mps`, `xpu`
- `instruction` (str): Instruction prefix for embeddings

**Environment Variables:**
Expand All @@ -485,7 +485,7 @@ The `embedding_model` parameter accepts a `crewai.rag.embeddings.types.ProviderS

**Config Options:**
- `model_name` (str): Sentence Transformers model name. Default: `all-MiniLM-L6-v2`. Options: `all-mpnet-base-v2`, `all-MiniLM-L6-v2`, `paraphrase-multilingual-MiniLM-L12-v2`
- `device` (str): Device to run on. Default: `cpu`. Options: `cpu`, `cuda`, `mps`
- `device` (str): Device to run on. Default: `cpu`. Options: `cpu`, `cuda`, `mps`, `xpu`
- `normalize_embeddings` (bool): Whether to normalize embeddings. Default: `False`

**Environment Variables:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class InstructorProvider(BaseEmbeddingsProvider[InstructorEmbeddingFunction]):
)
device: str = Field(
default="cpu",
description="Device to run model on (cpu or cuda)",
description="Device to run model on (e.g., cpu, cuda, mps, xpu)",
validation_alias=AliasChoices(
"EMBEDDINGS_INSTRUCTOR_DEVICE", "INSTRUCTOR_DEVICE"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SentenceTransformerProvider(
)
device: str = Field(
default="cpu",
description="Device to run model on (cpu or cuda)",
description="Device to run model on (e.g., cpu, cuda, mps, xpu)",
validation_alias=AliasChoices(
"EMBEDDINGS_SENTENCE_TRANSFORMER_DEVICE", "SENTENCE_TRANSFORMER_DEVICE"
),
Expand Down
14 changes: 10 additions & 4 deletions lib/crewai/tests/rag/embeddings/test_backward_compatibility.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Tests for backward compatibility of embedding provider configurations."""

import pytest

from crewai.rag.embeddings.factory import build_embedder, PROVIDER_PATHS
from crewai.rag.embeddings.providers.openai.openai_provider import OpenAIProvider
from crewai.rag.embeddings.providers.cohere.cohere_provider import CohereProvider
Expand Down Expand Up @@ -337,15 +339,19 @@ def test_ragtool_jina_config(self):
)
assert provider.model_name == "jina-embeddings-v3"

def test_ragtool_sentence_transformer_config(self):
"""Test RagTool SentenceTransformer config from ragtool.mdx."""
@pytest.mark.parametrize("device", ["cuda", "mps", "xpu"])
Comment thread
mhbuehler marked this conversation as resolved.
Outdated
def test_ragtool_sentence_transformer_config(self, device: str):
"""Test RagTool SentenceTransformer config from ragtool.mdx.

Parametrized over documented device strings to confirm each
value is preserved."""
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
provider = SentenceTransformerProvider(
model_name="all-mpnet-base-v2",
device="cuda",
device=device,
normalize_embeddings=True,
)
assert provider.model_name == "all-mpnet-base-v2"
assert provider.device == "cuda"
assert provider.device == device
assert provider.normalize_embeddings is True


Expand Down