Enhance set_knowledge implementation with better validation and documentation

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-03-17 04:55:07 +00:00
parent e73cf7b00f
commit ffa386e302
3 changed files with 64 additions and 14 deletions

View File

@@ -1632,7 +1632,8 @@ def test_base_agent_set_knowledge():
assert agent.knowledge_sources == [string_source]
assert agent.knowledge is not None
assert MockKnowledge.called
assert MockKnowledge.call_args[1]["collection_name"] == "Test_Agent"
# Check that collection name starts with the agent role (now includes unique ID)
assert MockKnowledge.call_args[1]["collection_name"].startswith("Test_Agent_")
# Test with embedder config
embedder_config = {