Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
docs(rag): add XPU to OpenCLIP provider device options (#7923)
Melanie Hart Buehler140bfcb89a0e
diff --git a/docs/edge/ar/tools/ai-ml/ragtool.mdx b/docs/edge/ar/tools/ai-ml/ragtool.mdxindex a92d50c82..de1241149 100644--- a/docs/edge/ar/tools/ai-ml/ragtool.mdx+++ b/docs/edge/ar/tools/ai-ml/ragtool.mdx@@ -530,7 +530,7 @@ rag_tool = RagTool(config=config, summarize=True)**خيارات الإعداد:**- `model_name` (str): بنية نموذج OpenCLIP. القيمة الافتراضية: `ViT-B-32`. الخيارات: `ViT-B-32`، `ViT-B-16`، `ViT-L-14`- `checkpoint` (str): اسم نقطة التحقق المُدرّبة مسبقاً. القيمة الافتراضية: `laion2b_s34b_b79k`. الخيارات: `laion2b_s34b_b79k`، `laion400m_e32`، `openai`- - `device` (str): الجهاز للتشغيل. القيمة الافتراضية: `cpu`. الخيارات: `cpu`، `cuda`+ - `device` (str): الجهاز للتشغيل. القيمة الافتراضية: `cpu`. الخيارات: `cpu`، `cuda`، `mps`، `xpu`**متغيرات البيئة:**- `EMBEDDINGS_OPENCLIP_MODEL_NAME`: `model_name`diff --git a/docs/edge/en/tools/ai-ml/ragtool.mdx b/docs/edge/en/tools/ai-ml/ragtool.mdxindex b9d66769f..6bedc82fb 100644--- a/docs/edge/en/tools/ai-ml/ragtool.mdx+++ b/docs/edge/en/tools/ai-ml/ragtool.mdx@@ -530,7 +530,7 @@ The `embedding_model` parameter accepts a `crewai.rag.embeddings.types.ProviderS**Config Options:**- `model_name` (str): OpenCLIP model architecture. Default: `ViT-B-32`. Options: `ViT-B-32`, `ViT-B-16`, `ViT-L-14`- `checkpoint` (str): Pretrained checkpoint name. Default: `laion2b_s34b_b79k`. Options: `laion2b_s34b_b79k`, `laion400m_e32`, `openai`- - `device` (str): Device to run on. Default: `cpu`. Options: `cpu`, `cuda`+ - `device` (str): Device to run on. Default: `cpu`. Options: `cpu`, `cuda`, `mps`, `xpu`**Environment Variables:**- `EMBEDDINGS_OPENCLIP_MODEL_NAME`: `model_name`diff --git a/docs/edge/ko/tools/ai-ml/ragtool.mdx b/docs/edge/ko/tools/ai-ml/ragtool.mdxindex 5bcadccd6..cb3cc5275 100644--- a/docs/edge/ko/tools/ai-ml/ragtool.mdx+++ b/docs/edge/ko/tools/ai-ml/ragtool.mdx@@ -530,7 +530,7 @@ rag_tool = RagTool(config=config, summarize=True)**구성 옵션:**- `model_name` (str): OpenCLIP 모델 아키텍처. 기본값: `ViT-B-32`. 옵션: `ViT-B-32`, `ViT-B-16`, `ViT-L-14`- `checkpoint` (str): 사전 학습된 체크포인트 이름. 기본값: `laion2b_s34b_b79k`. 옵션: `laion2b_s34b_b79k`, `laion400m_e32`, `openai`- - `device` (str): 실행할 장치. 기본값: `cpu`. 옵션: `cpu`, `cuda`+ - `device` (str): 실행할 장치. 기본값: `cpu`. 옵션: `cpu`, `cuda`, `mps`, `xpu`**환경 변수:**- `EMBEDDINGS_OPENCLIP_MODEL_NAME`: `model_name`diff --git a/docs/edge/pt-BR/tools/ai-ml/ragtool.mdx b/docs/edge/pt-BR/tools/ai-ml/ragtool.mdxindex 61bfe986c..657ace26e 100644--- a/docs/edge/pt-BR/tools/ai-ml/ragtool.mdx+++ b/docs/edge/pt-BR/tools/ai-ml/ragtool.mdx@@ -530,7 +530,7 @@ O parâmetro `embedding_model` aceita um dicionário `crewai.rag.embeddings.type**Opções de Configuração:**- `model_name` (str): Arquitetura do modelo OpenCLIP. Padrão: `ViT-B-32`. Opções: `ViT-B-32`, `ViT-B-16`, `ViT-L-14`- `checkpoint` (str): Nome do checkpoint pré-treinado. Padrão: `laion2b_s34b_b79k`. Opções: `laion2b_s34b_b79k`, `laion400m_e32`, `openai`- - `device` (str): Dispositivo no qual executar. Padrão: `cpu`. Opções: `cpu`, `cuda`+ - `device` (str): Dispositivo no qual executar. Padrão: `cpu`. Opções: `cpu`, `cuda`, `mps`, `xpu`**Variáveis de Ambiente:**- `EMBEDDINGS_OPENCLIP_MODEL_NAME`: `model_name`diff --git a/lib/crewai/src/crewai/rag/embeddings/providers/openclip/openclip_provider.py b/lib/crewai/src/crewai/rag/embeddings/providers/openclip/openclip_provider.pyindex b790ce897..f52a7b6c0 100644--- a/lib/crewai/src/crewai/rag/embeddings/providers/openclip/openclip_provider.py+++ b/lib/crewai/src/crewai/rag/embeddings/providers/openclip/openclip_provider.py@@ -33,6 +33,6 @@ class OpenCLIPProvider(BaseEmbeddingsProvider[OpenCLIPEmbeddingFunction]):)device: str | None = Field(default="cpu",- description="Device to run model on",+ description="Device to run model on (e.g., cpu, cuda, mps, xpu)",validation_alias=AliasChoices("EMBEDDINGS_OPENCLIP_DEVICE", "OPENCLIP_DEVICE"),)diff --git a/lib/crewai/tests/rag/embeddings/test_backward_compatibility.py b/lib/crewai/tests/rag/embeddings/test_backward_compatibility.pyindex 8cfb8f301..7c78efc40 100644--- a/lib/crewai/tests/rag/embeddings/test_backward_compatibility.py+++ b/lib/crewai/tests/rag/embeddings/test_backward_compatibility.py@@ -359,6 +359,18 @@ class TestDocumentationCodeSnippets:)assert provider.model_name == "jina-embeddings-v3"+ @pytest.mark.parametrize("device", ["cpu", "cuda", "mps", "xpu"])+ def test_ragtool_openclip_config(self, device: str):+ """Test documented OpenCLIP device strings are preserved."""+ provider = OpenCLIPProvider(+ model_name="ViT-B-32",+ checkpoint="laion2b_s34b_b79k",+ device=device,+ )+ assert provider.model_name == "ViT-B-32"+ assert provider.checkpoint == "laion2b_s34b_b79k"+ assert provider.device == device+@pytest.mark.parametrize("device", ["cpu", "cuda", "mps", "xpu"])def test_ragtool_sentence_transformer_config(self, device: str):"""Test RagTool SentenceTransformer config from ragtool.mdx.