From d48211f7f8c714d4f63cc6cd87fa71e3ee89335d Mon Sep 17 00:00:00 2001 From: Lorenze Jay Date: Fri, 7 Feb 2025 12:48:17 -0800 Subject: [PATCH] added docs --- docs/concepts/memory.mdx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/concepts/memory.mdx b/docs/concepts/memory.mdx index a725c41e7..33df47b82 100644 --- a/docs/concepts/memory.mdx +++ b/docs/concepts/memory.mdx @@ -368,6 +368,33 @@ my_crew = Crew( ) ``` +### Adding Custom Embedding Function + +```python Code +from crewai import Crew, Agent, Task, Process +from chromadb import Documents, EmbeddingFunction, Embeddings + +# Create a custom embedding function +class CustomEmbedder(EmbeddingFunction): + def __call__(self, input: Documents) -> Embeddings: + # generate embeddings + return [1, 2, 3] # this is a dummy embedding + +my_crew = Crew( + agents=[...], + tasks=[...], + process=Process.sequential, + memory=True, + verbose=True, + embedder={ + "provider": "custom", + "config": { + "embedder": CustomEmbedder() + } + } +) +``` + ### Resetting Memory ```shell