mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
Fix failing tests: update expectations for new URL-as-is behavior
- Update test inputs to provide complete URLs with /api/embeddings endpoint - Remove tests for automatic URL construction that no longer exists - Tests now reflect the requirement for users to provide complete URLs - Addresses CI failures after removing _construct_embeddings_url helper Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -31,7 +31,7 @@ class TestOllamaEmbeddingConfigurator:
|
||||
model_name="llama2"
|
||||
)
|
||||
|
||||
@patch.dict(os.environ, {"API_BASE": "http://env-ollama:8080"}, clear=True)
|
||||
@patch.dict(os.environ, {"API_BASE": "http://env-ollama:8080/api/embeddings"}, clear=True)
|
||||
def test_ollama_config_url_overrides_env_var(self):
|
||||
config = {
|
||||
"provider": "ollama",
|
||||
@@ -84,7 +84,7 @@ class TestOllamaEmbeddingConfigurator:
|
||||
)
|
||||
|
||||
@patch.dict(os.environ, {"API_BASE": "http://localhost:11434/api/embeddings"}, clear=True)
|
||||
def test_ollama_handles_full_url_in_api_base(self):
|
||||
def test_ollama_uses_provided_url_as_is(self):
|
||||
config = {"provider": "ollama", "config": {"model": "llama2"}}
|
||||
|
||||
with patch("chromadb.utils.embedding_functions.ollama_embedding_function.OllamaEmbeddingFunction") as mock_ollama:
|
||||
@@ -94,14 +94,15 @@ class TestOllamaEmbeddingConfigurator:
|
||||
model_name="llama2"
|
||||
)
|
||||
|
||||
@patch.dict(os.environ, {"API_BASE": "http://localhost:11434/api/embeddings"}, clear=True)
|
||||
def test_ollama_uses_provided_url_as_is(self):
|
||||
@patch.dict(os.environ, {"API_BASE": "http://custom-base:9000"}, clear=True)
|
||||
def test_ollama_requires_complete_url_in_api_base(self):
|
||||
"""Test that demonstrates users must provide complete URLs including endpoint."""
|
||||
config = {"provider": "ollama", "config": {"model": "llama2"}}
|
||||
|
||||
with patch("chromadb.utils.embedding_functions.ollama_embedding_function.OllamaEmbeddingFunction") as mock_ollama:
|
||||
self.configurator.configure_embedder(config)
|
||||
mock_ollama.assert_called_once_with(
|
||||
url="http://localhost:11434/api/embeddings",
|
||||
url="http://custom-base:9000",
|
||||
model_name="llama2"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user