What is Autonomous RAG
mainsearch_knowledge_base, read_chat_history, and search_the_web—and is allowed to decide which tools to invoke to retrieve the information necessary to answer a user's question.repository·main·Indexed 43 days ago
https://github.com/agno-agi/phidataA framework for building multi-modal agents equipped with memory, knowledge, tools, and reasoning capabilities. Agno supports multi-agent orchestration, Agentic RAG, and provides a UI for interacting with agents. It integrates with vector databases like PgVector and Pinecone for knowledge bases and long-term storage.
search_knowledge_base, read_chat_history, and search_the_web—and is allowed to decide which tools to invoke to retrieve the information necessary to answer a user's question.The LLM OS is a conceptual architecture where the LLM serves as the kernel process. Instead of just generating text, the LLM coordinates various resources to solve problems:
In this specific implementation, the LLM can read/generate text, browse the internet, use software tools, and communicate with other LLMs.
When building Assistants with Phidata, it is important to distinguish between these two components:
PgVector) to perform semantic searches over unstructured data, such as PDFs.The LLM OS design treats the LLM as a kernel process that coordinates various resources. The current implementation includes the following capabilities:
Infrastructure Components:
The Mixture of Agents (MoA) approach uses multiple specialized agents to collaboratively complete a complex task. In this implementation, the workflow follows these stages:
MLB Researcher, MLB Batting Statistician, MLB Pitching Statistician) use tools to fetch raw game data.MLB Writer agents, each powered by a different language model (such as llama3-8b-8192, gemma2-9b-it, or mixtral-8x7b-32768), independently generate draft articles based on the collected data.MLB Editor agent reviews all drafts and synthesizes the best elements into a single, polished final output.This pattern allows for higher quality outputs by leveraging the diverse strengths of different LLMs.
Once the Personalized Agentic RAG application is running, you can interact with the agent to test memory and RAG capabilities:
Ask complex questions that require tool usage, such as:
To use Phidata with LM Studio, you must have LM Studio installed and its Local Inference Server running. This setup allows you to use local LLMs via the OpenAI-compatible API provided by LM Studio.
Follow these steps to prepare your environment:
phidata and openai.Note: Since LM Studio provides an OpenAI-compatible endpoint, you will typically configure the OpenAI model class in Phidata to point to your local LM Studio server URL (usually http://localhost:1234/v1).
# 1. Create a virtual environment
python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate
# 2. Install libraries
pip install -U phidata openaiInstall the required libraries for the Pinecone integration, including pinecone for vector database operations, pypdf for PDF processing, openai for LLM capabilities, and phidata for the agent framework.
pip install -U pinecone pypdf openai phidataTo run the Autonomous RAG example, follow these steps to set up your environment:
Create a virtual environment:
python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activateSet your API Key: Export your OpenAI API key as an environment variable:
export OPENAI_API_KEY=***Install dependencies: Install the required libraries using the provided requirements file:
pip install -r cookbook/examples/auto_rag/requirements.txtpython3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate
export OPENAI_API_KEY=***
pip install -r cookbook/examples/auto_rag/requirements.txtTo use Ollama with Phidata, you must first install Ollama and pull the necessary models for embeddings and chat.
ollama pull nomic-embed-text to prepare the embedding capabilities.ollama run openhermes to download and run the chat model.Note: You can exit the chat model by typing /bye.
# Pull the embedding model
ollama pull nomic-embed-text
# Run the chat model
ollama run openhermesTo use Anthropic Claude with Phidata, follow these steps to set up your environment and install the necessary dependencies.
Create and activate a virtual environment:
python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activateSet your API Key: Export your Anthropic API key as an environment variable:
export ANTHROPIC_API_KEY=xxxInstall required libraries:
Install phidata along with the Anthropic client and various tool providers:
pip install -U anthropic duckduckgo-search duckdb yfinance exa_py phidatapython3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate
export ANTHROPIC_API_KEY=xxx
pip install -U anthropic duckduckgo-search duckdb yfinance exa_py phidataExecute the Lancedb Agent script using the following command:
python cookbook/integrations/lancedb/agent.py