mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
- Add configurable embedding providers (OpenAI, Ollama) - Fix type hints in base_tool and structured_tool - Add proper json property implementations - Update documentation for memory configuration - Add environment variables for embedding configuration - Fix type errors in task and crew output classes Co-Authored-By: Joe Moura <joao@crewai.com>
31 lines
974 B
Python
31 lines
974 B
Python
# conftest.py
|
|
import os
|
|
import pytest
|
|
from dotenv import load_dotenv
|
|
|
|
load_result = load_dotenv(override=True)
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def setup_test_env():
|
|
"""Configure test environment to use Ollama as the default embedding provider."""
|
|
# Store original environment variables
|
|
original_env = {
|
|
"CREWAI_EMBEDDING_PROVIDER": os.environ.get("CREWAI_EMBEDDING_PROVIDER"),
|
|
"CREWAI_EMBEDDING_MODEL": os.environ.get("CREWAI_EMBEDDING_MODEL"),
|
|
"CREWAI_OLLAMA_URL": os.environ.get("CREWAI_OLLAMA_URL"),
|
|
}
|
|
|
|
# Set test environment
|
|
os.environ["CREWAI_EMBEDDING_PROVIDER"] = "ollama"
|
|
os.environ["CREWAI_EMBEDDING_MODEL"] = "llama2"
|
|
os.environ["CREWAI_OLLAMA_URL"] = "http://localhost:11434/api/embeddings"
|
|
|
|
yield
|
|
|
|
# Restore original environment
|
|
for key, value in original_env.items():
|
|
if value is None:
|
|
os.environ.pop(key, None)
|
|
else:
|
|
os.environ[key] = value
|