mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 08:38:30 +00:00
fix: update onnxruntime dependency to >=1.22.1 for Windows Server 2019 compatibility
- Update onnxruntime constraint from ==1.22.0 to >=1.22.1 in pyproject.toml - Add test to verify onnxruntime version constraint in test_imports.py - Add comprehensive tests for ONNX embedding functionality - Fixes issue #3398 where onnxruntime 1.22.0 causes DLL load failures on Windows Server 2019 Resolves: #3398 Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -23,7 +23,7 @@ dependencies = [
|
|||||||
# Data Handling
|
# Data Handling
|
||||||
"chromadb>=0.5.23",
|
"chromadb>=0.5.23",
|
||||||
"tokenizers>=0.20.3",
|
"tokenizers>=0.20.3",
|
||||||
"onnxruntime==1.22.0",
|
"onnxruntime>=1.22.1",
|
||||||
"openpyxl>=3.1.5",
|
"openpyxl>=3.1.5",
|
||||||
"pyvis>=0.3.2",
|
"pyvis>=0.3.2",
|
||||||
# Authentication and Security
|
# Authentication and Security
|
||||||
|
|||||||
39
tests/rag/test_embeddings_factory.py
Normal file
39
tests/rag/test_embeddings_factory.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
"""Test the embeddings factory functionality, particularly ONNX provider."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
def test_onnx_embedding_function_creation():
|
||||||
|
"""Test that ONNX embedding function can be created."""
|
||||||
|
from crewai.rag.embeddings.factory import get_embedding_function
|
||||||
|
|
||||||
|
embedding_func = get_embedding_function({"provider": "onnx"})
|
||||||
|
assert embedding_func is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_onnx_embedding_function_basic_functionality():
|
||||||
|
"""Test that ONNX embedding function can process text."""
|
||||||
|
import numpy as np
|
||||||
|
from crewai.rag.embeddings.factory import get_embedding_function
|
||||||
|
|
||||||
|
embedding_func = get_embedding_function({"provider": "onnx"})
|
||||||
|
|
||||||
|
result = embedding_func(["test text"])
|
||||||
|
assert result is not None
|
||||||
|
assert len(result) > 0
|
||||||
|
assert isinstance(result[0], np.ndarray)
|
||||||
|
assert len(result[0]) > 0
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_embedding_function_onnx_provider_in_list():
|
||||||
|
"""Test that onnx provider is available in the factory."""
|
||||||
|
from crewai.rag.embeddings.factory import get_embedding_function
|
||||||
|
|
||||||
|
try:
|
||||||
|
embedding_func = get_embedding_function({"provider": "onnx"})
|
||||||
|
assert embedding_func is not None
|
||||||
|
except ValueError as e:
|
||||||
|
if "Unsupported provider" in str(e):
|
||||||
|
pytest.fail("ONNX provider should be supported")
|
||||||
|
else:
|
||||||
|
raise
|
||||||
@@ -13,3 +13,12 @@ def test_crew_output_import():
|
|||||||
from crewai import CrewOutput
|
from crewai import CrewOutput
|
||||||
|
|
||||||
assert CrewOutput is not None
|
assert CrewOutput is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_onnxruntime_import_and_version():
|
||||||
|
"""Test that onnxruntime can be imported and is version >= 1.22.1."""
|
||||||
|
import onnxruntime
|
||||||
|
from packaging import version
|
||||||
|
|
||||||
|
assert onnxruntime is not None
|
||||||
|
assert version.parse(onnxruntime.__version__) >= version.parse("1.22.1")
|
||||||
|
|||||||
Reference in New Issue
Block a user