mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
fix: Include agent context in knowledge queries
- Add agent role, goal, and backstory to knowledge queries - This helps retrieve more relevant knowledge based on agent context - Improves knowledge effectiveness in agent execution Part of #2269 Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -210,7 +210,13 @@ class Agent(BaseAgent):
|
||||
task_prompt += self.i18n.slice("memory").format(memory=memory)
|
||||
|
||||
if self.knowledge:
|
||||
agent_knowledge_snippets = self.knowledge.query([task.prompt()])
|
||||
query_context = [
|
||||
task.prompt(),
|
||||
f"Role: {self.role}",
|
||||
f"Goal: {self.goal}",
|
||||
f"Backstory: {self.backstory}"
|
||||
]
|
||||
agent_knowledge_snippets = self.knowledge.query(query_context)
|
||||
if agent_knowledge_snippets:
|
||||
agent_knowledge_context = extract_knowledge_context(
|
||||
agent_knowledge_snippets
|
||||
|
||||
Reference in New Issue
Block a user