{"id":25448901,"url":"https://github.com/bebijayeeni/marvel-mongo","last_synced_at":"2026-05-01T04:37:41.748Z","repository":{"id":277808102,"uuid":"933551744","full_name":"beBijayeeni/marvel-mongo","owner":"beBijayeeni","description":"This project appears to be a RAG (Retrieval-Augmented Generation) chatbot built using LangChain, Google Generative AI, and MongoDB Atlas.","archived":false,"fork":false,"pushed_at":"2025-02-16T12:19:31.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-16T08:09:28.637Z","etag":null,"topics":["chatbot","gemini-api","mongodb"],"latest_commit_sha":null,"homepage":"","language":"Python","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/beBijayeeni.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}},"created_at":"2025-02-16T08:33:55.000Z","updated_at":"2025-02-16T12:19:33.000Z","dependencies_parsed_at":"2025-02-16T09:35:34.962Z","dependency_job_id":"294208cd-8654-4f0c-bc6c-7e6f68e98dba","html_url":"https://github.com/beBijayeeni/marvel-mongo","commit_stats":null,"previous_names":["bebijayeeni/marvel-oracle","bebijayeeni/marvel-mongo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beBijayeeni%2Fmarvel-mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beBijayeeni%2Fmarvel-mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beBijayeeni%2Fmarvel-mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beBijayeeni%2Fmarvel-mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beBijayeeni","download_url":"https://codeload.github.com/beBijayeeni/marvel-mongo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493382,"owners_count":22080127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["chatbot","gemini-api","mongodb"],"created_at":"2025-02-17T20:15:40.595Z","updated_at":"2026-05-01T04:37:41.682Z","avatar_url":"https://github.com/beBijayeeni.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RAG Chatbot\n\nThis project is a Retrieval-Augmented Generation (RAG) chatbot built with LangChain, Google Generative AI, and MongoDB Atlas. It loads documents from specified URLs, chunks the text, generates embeddings, stores them in a MongoDB Atlas vector search collection, and then uses a retrieval chain (via LangChain) to answer user queries.\n\n\u003e **Warning:** \n\u003e \n\u003e Please do not expose sensitive information such as passwords, API keys, or any other confidential data in your code. \n\u003e \n\u003e Always use environment variables or secure vaults to manage sensitive information. \n\u003e \n\u003e Exposing such data can lead to security vulnerabilities and unauthorized access to your systems.\n\n## Table of Contents\n- [Overview](#overview) \n- [Features](#features) \n- [Architectures](#architectures) \n- [Prerequisties](#prerequisties)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [License](#license)\n\n## Overview\n\nThe chatbot answers questions by retrieving relevant text fragments from web pages stored in MongoDB Atlas. It uses LangChain chains and agents to integrate LLM-based summarization with a vector-based retrieval mechanism. The project includes functionality to:\n\n- Fetch documents from specified URLs. \n- Chunk the documents using a text splitter. \n- Generate embeddings using Google Generative AI. \n- Store embeddings in a MongoDB Atlas collection configured with a knnVector (vector search) index. \n- Answer user queries by retrieving the most relevant chunks and generating a natural language answer. \n\n## Features\n\n- RAG (Retrieval-Augmented Generation): Combines document retrieval with LLM generation to answer questions.\n- Document Chunking: Uses `RecursiveCharacterTextSplitter` to break documents into manageable pieces.\n- Vector Storage: Embeddings are stored in MongoDB Atlas with a vector search index.\n\n## Architecture\n- Document Loading \u0026 Processing: The Vectorize class (in `vector.py`) downloads documents from a list of URLs, splits the text into chunks, and generates embeddings.\n- Embedding Storage: Generated embeddings are stored in a MongoDB Atlas collection. A vector search index is created on the embedding field.\nQuery Handling: The Bot class (in `query.py`) sets up a retrieval chain using LangChain. When a user inputs a query, the retrieval chain searches MongoDB for the most similar document chunks and passes them as context to the LLM.\n- Response Generation: The LLM (Google Generative AI via LangChain) generates the final answer based solely on the retrieved context.\n\n## Prerequisites\n\n- Basic knowledge of Git \u0026 Github\n- MongoDB\n- Python\n- Pipenv\n- Langchain\n \n## Installation\n\n### Clone the Repository\n```sh\ngit clone https://github.com/beBijayeeni/marvel-mongo.git\n```\n\n### Imp Pipenv commands\n- **Install pipenv package**:\n\n    ```bash\n    pip install pipenv\n    ```\n\n\n- **Initialize a virtual environment**:\n\n    ```bash\n    pipenv install\n    ```\n\n- **Start the pipenv terminal**:\n\n    ```bash\n    pipenv shell\n    ```\n- **Install required in your venv**:\n\n    ```bash\n    pipenv install -r requirements.txt\n    ```\n\n## Configuration\n\n### Environment Variables\nCreate a `.env` file in the project root with the following (adjust values as needed):\n```bash\n# Google Generative AI API key\nGEMINI_API_KEY=your_google_gemini_api_key\n\n# MongoDB Atlas connection string and database info\nATLAS_CONNECTION_STRING=your_mongodb_atlas_connection_string\nDB_NAME=your_database_name\nCOLLECTION_NAME=your_collection_name\nVECTOR_INDEX=your_vector_index_name\n\n# (Optional) Custom user agent for HTTP requests\nUSER_AGENT=LLM_APP_DEMO/1.0\n```\n\n### MongoDB Atlas Setup\n- Cluster and Database: Log into MongoDB Atlas and create a new cluster if you don’t have one. Create (or use an existing) database that matches `DB_NAME`.\n\n- Collection: Create a collection with the name in `COLLECTION_NAME`. This is where your embeddings and documents will be stored.\n\n- Vector Search Index: In your collection’s “Search” tab, create a custom index using a definition similar to:\n```bash\n{\n  \"mappings\": {\n    \"dynamic\": true,\n    \"fields\": {\n      \"embedding\": {\n        \"type\": \"knnVector\",\n        \"dimensions\": 768,\n        \"similarity\": \"cosine\"\n      }\n    }\n  }\n}\n```\nSave the index; it may take a few minutes to build.\n\n## License\n\nThis project is licensed under the MIT License - see the `LICENSE` file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbebijayeeni%2Fmarvel-mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbebijayeeni%2Fmarvel-mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbebijayeeni%2Fmarvel-mongo/lists"}