{"id":18398657,"url":"https://github.com/mongodb-developer/quickstart-rag-python","last_synced_at":"2025-07-16T11:39:04.018Z","repository":{"id":220102977,"uuid":"728659967","full_name":"mongodb-developer/quickstart-rag-python","owner":"mongodb-developer","description":"This Python project demonstrates semantic search using MongoDB and two different LLM frameworks: LangChain and LlamaIndex. The goal is to load documents from MongoDB, generate embeddings for the text data, and perform semantic searches using both LangChain and LlamaIndex frameworks.","archived":false,"fork":false,"pushed_at":"2024-06-10T12:36:14.000Z","size":22,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T05:35:37.302Z","etag":null,"topics":["langchain-python","llamaindex","mongodb-atlas","vector-database"],"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/mongodb-developer.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":"2023-12-07T12:20:48.000Z","updated_at":"2025-03-27T19:26:49.000Z","dependencies_parsed_at":"2024-06-06T12:33:28.170Z","dependency_job_id":"82b884ed-c804-4285-8fa9-029109a792a1","html_url":"https://github.com/mongodb-developer/quickstart-rag-python","commit_stats":null,"previous_names":["mongodb-developer/langchain-python-new","mongodb-developer/quickstart-rag-python"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mongodb-developer/quickstart-rag-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2Fquickstart-rag-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2Fquickstart-rag-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2Fquickstart-rag-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2Fquickstart-rag-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongodb-developer","download_url":"https://codeload.github.com/mongodb-developer/quickstart-rag-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2Fquickstart-rag-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265506476,"owners_count":23778748,"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":["langchain-python","llamaindex","mongodb-atlas","vector-database"],"created_at":"2024-11-06T02:23:45.724Z","updated_at":"2025-07-16T11:39:03.987Z","avatar_url":"https://github.com/mongodb-developer.png","language":"Jupyter Notebook","readme":"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/path-to-notebook)\n\n# Semantic Search with MongoDB and LLM Frameworks\n\n[**Article Link**](https://www.mongodb.com/developer/products/atlas/guide-to-rag-application/)\n\n## Introduction\n\nThis Python project demonstrates semantic search using MongoDB and two different LLM frameworks: **LangChain** and **LlamaIndex**. The goal is to load documents from MongoDB, generate embeddings for the text data, and perform semantic searches using both **LangChain** and **LlamaIndex** frameworks.\n\n## Environment Variables\n\nTo run this project, you need to set the following environment variables in a `.env` file:\n\n```dotenv\nOPENAI_API_KEY=YOUR_OPENAI_API_KEY\nMONGODB_URI=YOUR_MONGODB_CONNECTION_URI\nMONGODB_COLL=YOUR_MONGODB_COLLECTION\nMONGODB_VECTOR_INDEX=YOUR_MONGODB_VECTOR_INDEX\nMONGODB_VECTOR_COLL_LANGCHAIN=YOUR_MONGODB_VECTOR_COLLECTION_LANGCHAIN\nMONGODB_VECTOR_COLL_LLAMAINDEX=YOUR_MONGODB_VECTOR_COLLECTION_LLAMAINDEX\n```\n\nMake sure to replace the placeholder values with your actual API keys and connection details.\n\n## Setup\n\nInstall dependencies:\n\n```\npip install -r requirements.txt\n```\n\n## Project Overview\n### 1. Loading Documents\n\nThe project loads documents from the specified MongoDB collection (`MONGODB_COLL`). Ensure that your MongoDB collection contains the text data you want to perform a semantic search on.\n\n### 2. Generating Embeddings\nThe application generates embeddings for the loaded text data using the LangChain and LlamaIndex frameworks. The embeddings are stored in separate MongoDB collections (`MONGODB_VECTOR_COLL_LANGCHAIN` and `MONGODB_VECTOR_COLL_LLAMAINDEX`).\n\n### 3. Semantic Search\nThe semantic search is performed using both LangChain and LlamaIndex frameworks. The process involves querying the embeddings collection and retrieving relevant documents based on the semantic similarity of the prompt.\n\n## Additional Information\nThe `OPENAI_API_KEY` is required for embedding generation using external language models (e.g., OpenAI's GPT).\nMake sure to configure MongoDB connection details and collections appropriately.\nCheck the official documentation for LangChain and LlamaIndex for any additional configuration or usage details.\n\n## Reference\n- Atlas Vector Search : [Link to MongoDB Atlas Vector Search](https://www.mongodb.com/products/platform/atlas-vector-search)\n- LangChain: [Link to LangChain Documentation](https://python.langchain.com/docs/get_started/introduction)\n- LlamaIndex: [Link to LlamaIndex Documentation](https://docs.llamaindex.ai/en/stable/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb-developer%2Fquickstart-rag-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongodb-developer%2Fquickstart-rag-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb-developer%2Fquickstart-rag-python/lists"}