Learn how to use embedders with Agno to convert complex information into vector representations.
An Embedder converts complex information into vector representations, allowing it to be stored in a vector database. By transforming data into embeddings, the embedder enables efficient searching and retrieval of contextually relevant information. This process enhances the responses of language models by providing them with the necessary business context, ensuring they are context-aware. Agno uses the OpenAIEmbedder as the default embedder, but other embedders are supported as well. Here is an example:
Copy
Ask AI
from agno.agent import Agentfrom agno.knowledge.knowledge import Knowledgefrom agno.vectordb.pgvector import PgVectorfrom agno.embedder.openai import OpenAIEmbedder# Create knowledgeknowledge = Knowledge( vector_db=PgVector( db_url=db_url, table_name=embeddings_table, embedder=OpenAIEmbedder(), ), # 2 references are added to the prompt max_results=2,)# Add content to knowledgeknowledge.add_content( text_content="The sky is blue")# Add the knowledge to the Agentagent = Agent(knowledge=knowledge)