mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-15 11:08:33 +00:00
test: Add comprehensive validation tests for embedder_config
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -39,6 +39,15 @@ def mock_vector_db():
|
||||
|
||||
def test_agent_invalid_embedder_config():
|
||||
"""Test that an invalid embedder configuration raises a ValueError."""
|
||||
with pytest.raises(ValueError, match="embedder_config must be a dictionary"):
|
||||
Agent(
|
||||
role="test role",
|
||||
goal="test goal",
|
||||
backstory="test backstory",
|
||||
knowledge_sources=[StringKnowledgeSource(content="test content")],
|
||||
embedder_config="invalid"
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="embedder_config must contain 'provider' key"):
|
||||
Agent(
|
||||
role="test role",
|
||||
@@ -57,6 +66,15 @@ def test_agent_invalid_embedder_config():
|
||||
embedder_config={"provider": "custom"}
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="Unsupported embedding provider"):
|
||||
Agent(
|
||||
role="test role",
|
||||
goal="test goal",
|
||||
backstory="test backstory",
|
||||
knowledge_sources=[StringKnowledgeSource(content="test content")],
|
||||
embedder_config={"provider": "invalid", "config": {}}
|
||||
)
|
||||
|
||||
def test_agent_knowledge_with_custom_embedder(mock_vector_db):
|
||||
agent = Agent(
|
||||
role="test role",
|
||||
|
||||
Reference in New Issue
Block a user