100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.
updated local deepseek rag app
ShubhamSaboo7dc8d371a62d
diff --git a/rag_tutorials/deepseek_local_rag_agent/README.md b/rag_tutorials/deepseek_local_rag_agent/README.mdindex e5fa8dc2..a056a2c8 100644--- a/rag_tutorials/deepseek_local_rag_agent/README.md+++ b/rag_tutorials/deepseek_local_rag_agent/README.md@@ -6,7 +6,7 @@ A powerful reasoning agent that combines local Deepseek models with RAG capabili- **Dual Operation Modes**- Local Chat Mode: Direct interaction with Deepseek locally- - RAG Mode: Enhanced reasoning with document context and web search integration - llama3.1:8b+ - RAG Mode: Enhanced reasoning with document context and web search integration - llama3.2- **Document Processing** (RAG Mode)- PDF document upload and processing@@ -15,7 +15,6 @@ A powerful reasoning agent that combines local Deepseek models with RAG capabili- Vector storage in Qdrant cloud- **Intelligent Querying** (RAG Mode)- - Query rewriting using Gemini- RAG-based document retrieval- Similarity search with threshold filtering- Automatic fallback to web search@@ -50,14 +49,10 @@ ollama pull deepseek-r1:7bollama pull snowflake-arctic-embedollama run llama3.2+ollama pull llama3.2```-### 2. Google API Key (for RAG Mode)-1. Go to [Google AI Studio](https://aistudio.google.com/apikey)-2. Sign up or log in to your account-3. Create a new API key--### 3. Qdrant Cloud Setup (for RAG Mode)+### 2. Qdrant Cloud Setup (for RAG Mode)1. Visit [Qdrant Cloud](https://cloud.qdrant.io/)2. Create an account or sign in3. Create a new cluster@@ -65,7 +60,7 @@ ollama run llama3.2- Qdrant API Key: Found in API Keys section- Qdrant URL: Your cluster URL (format: `https://xxx-xxx.cloud.qdrant.io`)-### 4. Exa AI API Key (Optional)+### 3. Exa AI API Key (Optional)1. Visit [Exa AI](https://exa.ai)2. Sign up for an account3. Generate an API key for web search capabilitiesdiff --git a/rag_tutorials/deepseek_local_rag_agent/deepseek_rag_agent.py b/rag_tutorials/deepseek_local_rag_agent/deepseek_rag_agent.pyindex bef094f4..a630c26f 100644--- a/rag_tutorials/deepseek_local_rag_agent/deepseek_rag_agent.py+++ b/rag_tutorials/deepseek_local_rag_agent/deepseek_rag_agent.py@@ -3,10 +3,8 @@ import tempfilefrom datetime import datetimefrom typing import Listimport streamlit as st-import google.generativeai as genaiimport bs4from agno.agent import Agent-from agno.models.google import Geminifrom agno.models.ollama import Ollamafrom langchain_community.document_loaders import PyPDFLoader, WebBaseLoaderfrom langchain.text_splitter import RecursiveCharacterTextSplitter@@ -18,8 +16,14 @@ from agno.tools.exa import ExaToolsfrom agno.embedder.ollama import OllamaEmbedder-class OllamaEmbedderr(Embeddings):+class OllamaEmbedder(Embeddings):def __init__(self, model_name="snowflake-arctic-embed"):+ """+ Initialize the OllamaEmbedderr with a specific model.++ Args:+ model_name (str): The name of the model to use for embedding.+ """self.embedder = OllamaEmbedder(id=model_name, dimensions=1024)def embed_documents(self, texts: List[str]) -> List[List[float]]:@@ -139,8 +143,13 @@ if st.session_state.use_web_search:# Utility Functions-def init_qdrant():- """Initialize Qdrant client with configured settings."""+def init_qdrant() -> QdrantClient | None:+ """Initialize Qdrant client with configured settings.++ Returns:+ QdrantClient: The initialized Qdrant client if successful.+ None: If the initialization fails.+ """if not all([st.session_state.qdrant_api_key, st.session_state.qdrant_url]):return Nonetry:@@ -234,7 +243,7 @@ def create_vector_store(client, texts):vector_store = QdrantVectorStore(client=client,collection_name=COLLECTION_NAME,- embedding=OllamaEmbedderr()+ embedding=OllamaEmbedder())# Add documents