From bf712cee1ff57510638efd6e646e8c35e1bd077d Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Thu, 5 Dec 2024 14:56:58 -0500 Subject: [PATCH] update docs to the new way we use knowledge and include clearing memory --- docs/concepts/knowledge.mdx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/concepts/knowledge.mdx b/docs/concepts/knowledge.mdx index 7e826fd8c..96200b356 100644 --- a/docs/concepts/knowledge.mdx +++ b/docs/concepts/knowledge.mdx @@ -73,9 +73,7 @@ crew = Crew( tasks=[task], verbose=True, process=Process.sequential, - knowledge={ - "sources": [string_source], - }, # Enable knowledge by adding the sources here. You can also add more sources to the sources list. + knowledge_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?"}) @@ -106,16 +104,25 @@ string_source = StringKnowledgeSource( ) crew = Crew( ... - knowledge={ - "sources": [string_source], - "embedder_config": { - "provider": "openai", # Default embedder provider; can be "ollama", "gemini", e.t.c. - "config": {"model": "text-embedding-3-small"} # Default embedder model; can be "mxbai-embed-large", "nomic-embed-tex", e.t.c. - }, + knowledge_sources=[string_source], + embedder={ + "provider": "openai", + "config": {"model": "text-embedding-3-small"}, }, ) ``` +## 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 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.