Compare commits

...

1 Commits

Author SHA1 Message Date
Devin AI
6508d6db92 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>
2025-08-25 21:48:19 +00:00
4 changed files with 3329 additions and 3613 deletions

View File

@@ -23,7 +23,7 @@ dependencies = [
# Data Handling
"chromadb>=0.5.23",
"tokenizers>=0.20.3",
"onnxruntime==1.22.0",
"onnxruntime>=1.22.1",
"openpyxl>=3.1.5",
"pyvis>=0.3.2",
# Authentication and Security

View 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

View File

@@ -13,3 +13,12 @@ def test_crew_output_import():
from crewai import CrewOutput
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")

6892
uv.lock generated

File diff suppressed because it is too large Load Diff