Fix #2694: Make chromadb an optional dependency to fix Windows installation issues

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-04-26 18:38:34 +00:00
parent 51eb5e9998
commit 8dd779371d
7 changed files with 319 additions and 159 deletions

View File

@@ -2,6 +2,12 @@ from unittest.mock import patch
import pytest
chromadb_not_installed = False
try:
import chromadb
except ImportError:
chromadb_not_installed = True
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.memory.short_term.short_term_memory import ShortTermMemory
@@ -28,6 +34,7 @@ def short_term_memory():
return ShortTermMemory(crew=Crew(agents=[agent], tasks=[task]))
@pytest.mark.skipif(chromadb_not_installed, reason="ChromaDB is not installed")
def test_save_and_search(short_term_memory):
memory = ShortTermMemoryItem(
data="""test value test value test value test value test value test value