mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-23 23:28:15 +00:00
fix test
This commit is contained in:
@@ -1599,6 +1599,7 @@ def test_agent_with_knowledge_sources():
|
||||
goal="Provide information based on knowledge sources",
|
||||
backstory="You have access to specific knowledge sources.",
|
||||
llm=LLM(model="gpt-4o-mini"),
|
||||
knowledge_sources=[string_source],
|
||||
)
|
||||
|
||||
# Create a task that requires the agent to use the knowledge
|
||||
@@ -1613,20 +1614,3 @@ def test_agent_with_knowledge_sources():
|
||||
|
||||
# Assert that the agent provides the correct information
|
||||
assert "blue" in result.raw.lower()
|
||||
|
||||
|
||||
def test_agent_with_knowledge_sources_context():
|
||||
content = "Brandon's favorite color is blue and he likes Mexican food."
|
||||
string_source = StringKnowledgeSource(
|
||||
content=content, metadata={"preference": "personal"}
|
||||
)
|
||||
agent = Agent(
|
||||
role="Information Agent",
|
||||
goal="Provide information based on knowledge sources",
|
||||
backstory="You have access to specific knowledge sources.",
|
||||
knowledge_sources=[string_source],
|
||||
)
|
||||
assert isinstance(agent.knowledge_sources, list)
|
||||
assert len(agent.knowledge_sources) == 1
|
||||
assert isinstance(agent.knowledge_sources[0], BaseKnowledgeSource)
|
||||
assert agent.knowledge_sources[0].metadata == {"preference": "personal"}
|
||||
|
||||
Reference in New Issue
Block a user