Agentic RAG Embedding Gemma
This Streamlit app demonstrates an agentic Retrieval-Augmented Generation (RAG) Agent using Google's EmbeddingGemma for embeddings and Llama 3.2 as th…
- Llama
- local
RAG and Knowledge ·Intermediate
This Streamlit app answers questions from uploaded PDFs or a documentation URL. Every response is a validated Answer object with exact source quotes, chunk IDs, a confidence score, and an answered decision. If retrieval is too weak, the app refuses before calling the language model.
ANTHROPIC_API_KEYOPENAI_API_KEYLicense Apache-2.0 · content curated and maintained by Doutor AI.
This Streamlit app answers questions from uploaded PDFs or a documentation URL.
Every response is a validated Answer object with exact source quotes, chunk IDs,
a confidence score, and an answered decision. If retrieval is too weak, the app
refuses before calling the language model.

Agent, RunContext, and dependency injectionretrieve tool with source metadata and cosine scoresrag.py extracts PDF or web text, splits it into overlapping chunks, embedsthe chunks, and stores normalized vectors in memory.
agent.py injects the vector store through RagDependencies. The Pydantic AI agent must call the typed retrieve tool before producing an Answer.
Low scores return answered=False without an LLM request.
and verbatim quoted span. An invalid or missing citation becomes a refusal.
app.py renders the answer, confidence, citations, or refusal state.When OPENAI_API_KEY is available, Auto mode uses Pydantic AI's OpenAI
Embedder with text-embedding-3-small. With only ANTHROPIC_API_KEY, Auto mode
uses the local hashing backend because Anthropic has no embeddings API. The local
backend is best for keyword-oriented demos. Select OpenAI embeddings for semantic
retrieval across paraphrases.
From the repository root:
cd rag_tutorials/agentic_typed_rag_pydanticai
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
Add one key to .env:
OPENAI_API_KEY=your-key
or:
ANTHROPIC_API_KEY=your-key
The default answer models are openai:gpt-5.2 and
anthropic:claude-sonnet-4-6. Change the model field in the sidebar or set
RAG_MODEL to another Pydantic AI model string.
From rag_tutorials/agentic_typed_rag_pydanticai:
streamlit run app.py
Upload one or more PDFs, optionally add a docs URL, and select **Build knowledge
base**. Ask an in-corpus question to see a cited answer. Then ask about an
unrelated topic to see the refusal state.
The deterministic suite uses Pydantic AI's TestModel, so it makes no provider
requests:
python3 test_typed_rag.py
agentic_typed_rag_pydanticai/
├── app.py
├── agent.py
├── rag.py
├── test_typed_rag.py
├── requirements.txt
├── .env.example
└── assets/screenshot-placeholder.svg
Licensed under Apache-2.0 as part of awesome-llm-apps.
This Streamlit app demonstrates an agentic Retrieval-Augmented Generation (RAG) Agent using Google's EmbeddingGemma for embeddings and Llama 3.2 as th…
An agentic RAG application built with the Agno framework, featuring GPT-5 and LanceDB for efficient knowledge retrieval and question answering.
Architecture Flow <img width="465" alt="Screenshot 2025-05-04 at 3 45 58 PM" src="" /
Need a tailor-made solution?
Not sure where to start with AI in your business? Get a free assessment and a tailored plan - no commitment.
Doutor AI gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further.