From c50a88fd409d395d015ebd40e56ff63c7309a3a0 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 15:32:28 +0000 Subject: [PATCH] test: Add comprehensive validation tests for embedder_config Co-Authored-By: Joe Moura --- tests/test_agent_knowledge.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_agent_knowledge.py b/tests/test_agent_knowledge.py index 4f6622380..aeecfd33e 100644 --- a/tests/test_agent_knowledge.py +++ b/tests/test_agent_knowledge.py @@ -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",