update docs to the new way we use knowledge and include clearing memory

This commit is contained in:
Brandon Hancock
2024-12-05 14:56:58 -05:00
parent 6cb40ea6e3
commit bf712cee1f

View File

@@ -73,9 +73,7 @@ crew = Crew(
tasks=[task], tasks=[task],
verbose=True, verbose=True,
process=Process.sequential, process=Process.sequential,
knowledge={ knowledge_sources=[string_source], # Enable knowledge by adding the sources here. You can also add more sources to the sources list.
"sources": [string_source],
}, # Enable knowledge by adding the sources here. You can also add more sources to the sources list.
) )
result = crew.kickoff(inputs={"question": "What city does John live in and how old is he?"}) result = crew.kickoff(inputs={"question": "What city does John live in and how old is he?"})
@@ -106,16 +104,25 @@ string_source = StringKnowledgeSource(
) )
crew = Crew( crew = Crew(
... ...
knowledge={ knowledge_sources=[string_source],
"sources": [string_source], embedder={
"embedder_config": { "provider": "openai",
"provider": "openai", # Default embedder provider; can be "ollama", "gemini", e.t.c. "config": {"model": "text-embedding-3-small"},
"config": {"model": "text-embedding-3-small"} # Default embedder model; can be "mxbai-embed-large", "nomic-embed-tex", e.t.c.
},
}, },
) )
``` ```
## Clearing Knowledge
If you need to clear the knowledge stored in CrewAI, you can use the `crewai reset-memories` command with the `--knowledge` option.
```bash Command
crewai reset-memories --knowledge
```
This is useful when you've updated your knowledge sources and want to ensure that the agents are using the most recent information.
## Custom Knowledge Sources ## Custom Knowledge Sources
CrewAI allows you to create custom knowledge sources for any type of data by extending the `BaseKnowledgeSource` class. Let's create a practical example that fetches and processes space news articles. CrewAI allows you to create custom knowledge sources for any type of data by extending the `BaseKnowledgeSource` class. Let's create a practical example that fetches and processes space news articles.