mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-30 02:28:13 +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():
|
def test_agent_invalid_embedder_config():
|
||||||
"""Test that an invalid embedder configuration raises a ValueError."""
|
"""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"):
|
with pytest.raises(ValueError, match="embedder_config must contain 'provider' key"):
|
||||||
Agent(
|
Agent(
|
||||||
role="test role",
|
role="test role",
|
||||||
@@ -57,6 +66,15 @@ def test_agent_invalid_embedder_config():
|
|||||||
embedder_config={"provider": "custom"}
|
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):
|
def test_agent_knowledge_with_custom_embedder(mock_vector_db):
|
||||||
agent = Agent(
|
agent = Agent(
|
||||||
role="test role",
|
role="test role",
|
||||||
|
|||||||
Reference in New Issue
Block a user