VOOZH about

URL: https://www.geeksforgeeks.org/artificial-intelligence/crewai-embeddings/

โ‡ฑ CrewAI Embeddings - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CrewAI Embeddings

Last Updated : 1 May, 2026

Embeddings represent text as vectors in a high dimensional space, placing similar meanings closer together. In CrewAI, they enable memory, helping agents retain context and recall past interactions.

  • Convert text into high dimensional vector representations.
  • Capture semantic similarity (e.g., โ€œcatโ€ and โ€œkittenโ€ are close).
  • Enable agents to store and retrieve context through memory.
  • Help connect past interactions with current tasks for better responses.

Role of Embeddings in CrewAI

Embeddings play a key role in enabling intelligent memory and information handling in CrewAI systems.

  • Support contextual memory by helping agents recall relevant past information.
  • Enable information retrieval through similarity based search.
  • Allow cross session recall by storing embeddings in databases like ChromaDB.
  • Ensure continuity, preventing agents from treating each interaction independently.

Implementation

This example shows how embeddings in CrewAI enable agents to store, retrieve and share context, with memory=True ensuring continuity across tasks.

  • Agent: Defines the role, goal and backstory of an AI agent.
  • Task: Specifies the task description, assigned agent and expected output.
  • Context: Connects tasks so outputs from one task can be used in another.

1. Using OpenAI Embeddings

OpenAI embeddings can be used for memory, offering strong semantic similarity performance. Models like text-embedding-3-small are efficient, while larger variants provide higher accuracy.

  • memory=True: Enables memory for the crew.
  • embedder: Specifies the embedding provider and model.

Output:

๐Ÿ‘ openAI
Using OpenAI Embeddings

2. Using Google Embeddings

Google embeddings are suitable for multilingual tasks and large-scale data. Models such as models/embedding-001 provide strong cross-lingual support.

  • provider="google" tells CrewAI to use Google embeddings.
  • api_key is required to authenticate with Googleโ€™s API.

Output:

๐Ÿ‘ googleAPI
Using Google Embeddings

3. Using Hugging Face Embeddings

Hugging Face embeddings give access to a wide range of open-source models. Options like sentence-transformers/all-MiniLM-L6-v2 are lightweight and effective for semantic search and retrieval.

Output:

๐Ÿ‘ huggingfaceAPI
Using Hugging Face Embeddings

4. Using Cohere Embeddings

Cohere embeddings are designed for English text and high-performance retrieval tasks. Models like embed-english-v2.0 perform well in semantic similarity and large-scale search.

Output:

๐Ÿ‘ cohereAPI
Using Cohere Embeddings

Comparison of Embedding Providers in CrewAI

This table outlines the main embedding providers available in CrewAI, showing how they differ in models, strengths and use cases.

ProviderTypical ModelsStrengthsBest For
OpenAItext-embedding-3-small, text-embedding-3-largeHigh-quality semantic similarity, reliable performanceGeneral-purpose apps, balanced cost and quality
Googlemodels/embedding-001Strong multilingual support, trained on large datasetsMultilingual tasks, global content, Google ecosystem
Hugging Facesentence-transformers/all-MiniLM-L6-v2 (and others)Open-source, flexible, customizable, cost-friendlyResearch, experimentation, self-hosted setups
Cohereembed-english-v2.0Optimized for English, high performance in semantic searchEnglish focused applications, production retrieval
Comment

Explore