mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 09:08:31 +00:00
* added knowledge to agent level * linted * added doc * added from suggestions * added test * fixes from discussion * fix docs * fix test * rm cassette for knowledge_sources test as its a mock and update agent doc string * fix test * rm unused * linted
13 lines
421 B
Python
13 lines
421 B
Python
from typing import Any, Dict, List
|
|
|
|
|
|
def extract_knowledge_context(knowledge_snippets: List[Dict[str, Any]]) -> str:
|
|
"""Extract knowledge from the task prompt."""
|
|
valid_snippets = [
|
|
result["context"]
|
|
for result in knowledge_snippets
|
|
if result and result.get("context")
|
|
]
|
|
snippet = "\n".join(valid_snippets)
|
|
return f"Additional Information: {snippet}" if valid_snippets else ""
|