{"id":19329771,"url":"https://github.com/outerbounds/rag-demo","last_synced_at":"2025-07-27T19:37:34.440Z","repository":{"id":271197288,"uuid":"682806940","full_name":"outerbounds/rag-demo","owner":"outerbounds","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-12T23:54:42.000Z","size":961,"stargazers_count":20,"open_issues_count":0,"forks_count":7,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-22T15:09:24.792Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/outerbounds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-25T00:20:39.000Z","updated_at":"2024-10-02T15:40:04.000Z","dependencies_parsed_at":"2025-01-06T08:27:56.305Z","dependency_job_id":null,"html_url":"https://github.com/outerbounds/rag-demo","commit_stats":null,"previous_names":["outerbounds/rag-demo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbounds%2Frag-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbounds%2Frag-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbounds%2Frag-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbounds%2Frag-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outerbounds","download_url":"https://codeload.github.com/outerbounds/rag-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250264909,"owners_count":21402004,"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":[],"created_at":"2024-11-10T02:29:53.019Z","updated_at":"2025-04-22T15:09:30.767Z","avatar_url":"https://github.com/outerbounds.png","language":"Jupyter Notebook","funding_links":[],"categories":["Examples \u0026 Tutorials"],"sub_categories":[],"readme":"# Read this blog post for context: [Retrieval-Augmented Generation: How to Use Your Data to Guide LLMs](https://outerbounds.com/blog/retrieval-augmented-generation/) \n\n\u003ca href=\"https://outerbounds.com/blog/retrieval-augmented-generation/\"\u003e\n\u003cimg style=\"display: block; float: left; max-width: 20%; height: auto; margin: auto; float: none!important;\" src=\"images/cover.png\"/\u003e\n\u003c/a\u003e\n\n\n# 📦  Setup\n\n## With Conda, Mamba, or Micromamba\n```\nconda env create -f environment.yaml\n```\n\n## Without Conda\n```\npip install -r requirements.txt\n```\n\n# 🔀🔁 Data collection workflows\n\n## Chunk Markdown files in GitHub repositories\n\nRun the repository extraction and Markdown chunking flow.\nLooks in `/flows/config/repo_params.py` to specify new configurations; be mindful of repository licensing!\n```\npython flows/markdown_chunker.py run\n```\n\n## Post-process the results\n\nPost-process the results of the `MarkdownChunker` flow. \n```\npython flows/data_table_processor.py run\n```\n\n## Analyze what just happened\nLet's inspect the results of these workflows in a notebook.\n\n\u003e If you are in a Conda environment, you need to install the kernel like so before opening the notebooks:\n\u003e ```\n\u003e pip install ipykernel\n\u003e python -m ipykernel install --user --name rag-demo --display-name \"RAG demo\"\n\u003e ```\n\nOpen `notebooks/analyze_chunks.ipynb` to use the Metaflow Client API to explore the results of the flow runs:\n```\njupyter notebook notebooks/analyze_chunks.ipynb\n```\n\n# 🦙🧠 RAG time\n\n## LlamaIndex\nNow that we have indexed a bunch of source objects, let's index them and use them to modify an LLM context window.\n\nYou can either use a Llama 2 model, or OpenAI APIs. \nLetting LlamaIndex use Llama 2 runs locally, so it doesn't require an API key but takes a lot longer.\nUsing OpenAI APIs is faster and cheap. You can create/find your API key [here](https://platform.openai.com/account/api-keys).\n\nOpen `notebooks/llama_index_exploration.ipynb`\n```\njupyter notebook notebooks/llama_index_exploration.ipynb\n```\n\n### ▶️ Run a demo in Streamlit\n\n#### 🔑 Get an OpenAI API Key\nGo [here](https://platform.openai.com/account/api-keys), copy your key value, and set the following environment variable:\n```\nexport OPENAI_API_KEY=\u003cYOUR KEY\u003e\n```\n\n#### 🤖 Run the app\n```\nstreamlit run chat_app.py\n```\n\n## Setup for indexing workflows\nThere are two indexing workflows in the `/flows` folder, one indexes into Pinecone for a VectorDB and another that uses the open-source LanceDB.\n \n### 🔑 Get a Pinecone API Key\nGo [here](https://app.pinecone.io/), create a Pinecone account if you have to, copy your API key, and set the following environment variable:\n```\nexport PINECONE_API_KEY=\u003cYOUR KEY\u003e\n```\n\nSet the following environment variable too:\n```\nexport GCP_ENVIRONMENT=us-central1-gcp\n```\n\n### ▶️ Run the flows\n```\npython flows/pinecone_index.py run\npython flows/lancedb_index.py run\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouterbounds%2Frag-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fouterbounds%2Frag-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouterbounds%2Frag-demo/lists"}