{"id":25231936,"url":"https://github.com/abdelrahman-amen/rag_agent","last_synced_at":"2026-04-07T08:32:36.941Z","repository":{"id":275790886,"uuid":"927206872","full_name":"Abdelrahman-Amen/RAG_Agent","owner":"Abdelrahman-Amen","description":"This project uses LangChain agents and Google Generative AI to build a RAG system, combining LLMs with tools like Wikipedia, Arxiv, and custom retrievers for accurate, real-time answers.","archived":false,"fork":false,"pushed_at":"2025-02-05T14:33:36.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-21T10:34:30.767Z","etag":null,"topics":["agents","api","arxiv-papers","dotenv","embeddings","faiss","langchain","prompt-engineering","python","retreival-augmented-generation","tools","vectorstore","webloader","wikipedia-api"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Abdelrahman-Amen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-04T15:27:08.000Z","updated_at":"2025-02-05T14:38:27.000Z","dependencies_parsed_at":"2025-07-21T10:16:46.005Z","dependency_job_id":"c0105d61-511d-4b01-bd44-672ea748c819","html_url":"https://github.com/Abdelrahman-Amen/RAG_Agent","commit_stats":null,"previous_names":["abdelrahman-amen/rag_agent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Abdelrahman-Amen/RAG_Agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdelrahman-Amen%2FRAG_Agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdelrahman-Amen%2FRAG_Agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdelrahman-Amen%2FRAG_Agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdelrahman-Amen%2FRAG_Agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Abdelrahman-Amen","download_url":"https://codeload.github.com/Abdelrahman-Amen/RAG_Agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdelrahman-Amen%2FRAG_Agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31506562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agents","api","arxiv-papers","dotenv","embeddings","faiss","langchain","prompt-engineering","python","retreival-augmented-generation","tools","vectorstore","webloader","wikipedia-api"],"created_at":"2025-02-11T12:39:26.092Z","updated_at":"2026-04-07T08:32:36.926Z","avatar_url":"https://github.com/Abdelrahman-Amen.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Retrieval-Augmented Generation (RAG) with Agents in LangChain and Google Generative AI 🌟\n\n![Image](https://github.com/user-attachments/assets/857e6cff-b1db-4a06-ae90-b88ef7cf63ef)\n\n# 📚 What is Retrieval-Augmented Generation (RAG)?\nRetrieval-Augmented Generation (RAG) enhances the capabilities of language models by combining them with retrieval mechanisms. Instead of depending solely on the pre-trained knowledge within a model, RAG retrieves real-time, relevant data from external sources such as APIs, web pages, or document databases. This approach ensures the generated responses are more accurate, contextually rich, and grounded in reliable information.\n\n\n\n# 🤖 What is an Agent in LangChain?\nAn Agent is a sophisticated system within LangChain that acts as a decision-making layer. It interprets user queries, determines which tools (retrievers, APIs, or external services) are required to process the query, and then synthesizes the retrieved information into a coherent response.\n\nIn this project, the agent plays a critical role in:\n\n• Binding the Google Generative AI LLM with tools such as Wikipedia and Arxiv APIs.\n\n• Orchestrating a seamless interaction between user inputs, external data sources, and the language model to provide informed and accurate outputs.\n\n• Utilizing LangChain’s ability to format responses and handle intermediate steps.\n\n\n\n\n# 🛠️ Project Workflow\n\n### 1.Environment Configuration:\n\n• The project uses google.generativeai and langchain_community modules to interact with Google Generative AI and external tools.\n\n• Environment variables (API keys) are loaded via dotenv to securely access external services.\n\n### 2.Document Loading and Splitting:\n\n• A WebBaseLoader is used to fetch documents from a specific URL.\n\n• The loaded documents are split into manageable chunks using RecursiveCharacterTextSplitter for effective retrieval and embedding.\n\n### 3.Embeddings and Vector Store:\n\n\n• Google Generative AI Embeddings are generated for the document chunks using the embedding-001 model.\n\n• A FAISS Vector Store is created to facilitate fast and accurate retrieval of relevant information.\n\n### 4.Tool Integration:\n\n• Wikipedia API Wrapper: Retrieves concise summaries from Wikipedia for user queries.\n\n• Arxiv API Wrapper: Fetches and summarizes scientific papers based on user input.\n\n• Custom Retriever Tool: Searches the loaded documents for information about LangSmith using the FAISS retriever.\n\n### 5.Prompt Design and LLM Binding:\n\n• A ChatPromptTemplate is defined to format user inputs and responses into structured prompts for the language model.\n\n• The Google Generative AI Chat model (gemini-pro) is initialized and bound to the defined tools.\n\n### 6.Agent Execution:\n\n• The agent uses the tools to handle queries such as:\n\n• Retrieving details about LangSmith from the custom document loader.\n\n• Fetching scientific paper summaries from Arxiv.\n\n• Providing general knowledge answers using Wikipedia.\n\n• Outputs are formatted using LangChain’s OpenAIFunctionsAgentOutputParser.\n\n\n\n# 🌟 Key Features of This Project\n\n• Combines Google Generative AI with retrieval-based tools for real-time, reliable information generation.\n\n• Implements multiple data sources (Wikipedia, Arxiv, and custom web documents) for diverse query handling.\n\n• Leverages LangChain’s Agent Framework to intelligently select tools and process user inputs.\n\n• Provides a reusable and extensible architecture for Retrieval-Augmented Generation tasks.\n\n\n#### This system demonstrates how agents can be used within RAG to build scalable, robust, and domain-specific AI solutions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdelrahman-amen%2Frag_agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdelrahman-amen%2Frag_agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdelrahman-amen%2Frag_agent/lists"}