{"id":18028459,"url":"https://github.com/interactivetech/rag-pdf","last_synced_at":"2025-04-04T20:45:08.811Z","repository":{"id":236087384,"uuid":"791883555","full_name":"interactivetech/rag-pdf","owner":"interactivetech","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-03T20:02:14.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T05:24:55.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/interactivetech.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":"2024-04-25T14:57:04.000Z","updated_at":"2024-05-03T20:02:17.000Z","dependencies_parsed_at":"2024-05-03T21:24:32.698Z","dependency_job_id":null,"html_url":"https://github.com/interactivetech/rag-pdf","commit_stats":null,"previous_names":["interactivetech/rag-pdf"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactivetech%2Frag-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactivetech%2Frag-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactivetech%2Frag-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactivetech%2Frag-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interactivetech","download_url":"https://codeload.github.com/interactivetech/rag-pdf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249600,"owners_count":20908211,"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-10-30T08:42:14.121Z","updated_at":"2025-04-04T20:45:08.790Z","avatar_url":"https://github.com/interactivetech.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"img src=\"https://raw.githubusercontent.com/hpe-design/logos/master/Requirements/color-logo.png\" alt=\"HPE Logo\" height=\"100\"/\u003e\n\n# RAG demo (Chat with HPE Press Release version)\n\n\u003cb\u003eAuthor:\u003c/b\u003e Andrew Mendez \u003c/br\u003e\n\u003cb\u003eDate:\u003c/b\u003e 05/01/2024\u003c/br\u003e\n\u003cb\u003eRevision:\u003c/b\u003e 0.1\u003c/br\u003e\n\nThis demonstration was built to showcase Retrieval Augmented Generation (RAG) on HPE press release documents\n.\nIt shows how RAG can be used to assist customers with keeping up with recent HPE news articles.\nThe information to answer the questions is sourced from the owners manuals which are publicly available.\n\nTo replicate this demo, you will need:\n\n - A functioning Kubernetes cluster with loadbalancers for external facing services configured\n     - cluster having shared mounted folder `/nvmefs1/tyler.britten`\n - Pachyderm/HPE MLDM 2.9.2 installed on the cluster and fully functional\n - At least 1x NVIDIA A100 80GB GPUs\n - Determined.AI/HPE MLDE environment for finetuning models (not included in the base code here)\n - \n\n\u003cb\u003eNOTE:\u003c/b\u003e You might be able to replicate this demo with other GPUs (for example L40s) as well, but you need to consider the memory footprint of other GPUs and make adjustments accordingly.\n\n\n## Recorded demos of RAG demo\n\n[ToDo]\n\n## Implementation Overview\nThe below chart gives a logical overview of the application flow of Mercedes Me Chat. \u003c/br\u003e\n\u003cimg src=\"./documentation_images/implementation_overview.png\" alt=\"Implementation Overview\"/\u003e\n\n- Step 1: Connect to deployed MLDM application\n- Step 2: Create MLDM project named `rag-demo-hpe`\n- Step 3: Set new project as current context\n- Step 4: Create repo `documents` to hold xml documents\n- Step 5: Upload xml documents\n- Step 6: Pipeline step to parse documents\n- Step 7: Pipeline step to chunk documents\n- Step 8: Pipeline step to embed documents using embedding model `bge-large-en-v1.5`\n- Step 9: Pipeline step to deploy gui application\n- Step 10: Interact with gui application\n- Step 11: Add new documents to repo `documents` to improve RAG App\n- Step 12: (Optional Step) Pipeline step to develop dataset for finetuning embeddings: qna pipeline\n- Step 13: (Optional Step) Pipeline step to fientune embeddings\n- Step 14: Delete pipelines\n\n\n\u003cb\u003eRAG demo includes solution components from:\u003c/b\u003e\n- [Pachyderm / HPE MLDM](https://www.hpe.com/us/en/hpe-machine-learning-data-management-software.html)\n- [ChromaDB](https://www.trychroma.com/)\n- [Streamlit frontend](https://streamlit.io)\n\n# Steps to run the demo\n\n## Step 1: Connect to deployed MLDM application\n\n`pachctl connect pachd-peer.pachyderm.svc.cluster.local:30653`\n\n## Step 2: Create MLDM project named `rag-demo-hpe`\n\n`pachctl create project rag-demo-hpe`\n\n## Step 3: Set new project as current context\n\n`pachctl config update context --project rag-demo-hpe`\n\n### Pipeline will be available at the url:\n\n`http://mldm-pachyderm.us.rdlabs.hpecorp.net/lineage/pdf-rag-andrew`\n\n## Step 4: Create repo `documents` to hold xml documents\n\n`pachctl create repo documents`\n\n## Step 5: Upload xml documents\n\n`pachctl put file documents@master: -f data/antonio-neri.xml`\n`pachctl put file documents@master: -f data/aruba_wifi_7_press.xml`\n`pachctl put file documents@master: -f data/e2e_ai_platform_press_release.xml`\n\n## Step 6: Pipeline step to parse documents\n\nThis pipeline takes the raw xml documents, and parses them into json format.\n\n`pachctl create pipeline -f pipelines/parsing.pipeline.json`\n\n## Step 7: Pipeline step to chunk documents\n\nThis pipeline takes the parsed documents, and applies chunking to create chunked documents.\n\n`pachctl create pipeline -f pipelines/chunking.pipeline.json`\n\n## Step 8: Pipeline step to embed documents using embedding model `bge-large-en-v1.5`\n\nThis pipeline takes the chunked documents, and creates vector embeddings using the vector embedding `bge-large-en-v1.5`\n\n`pachctl create pipeline -f pipelines/embedding.pipeline.json`\n\n\n## Step 9: Pipeline step to deploy gui application\n\nThis pipeline will deploy a streamlit application for user to interact with the GUI\n\n`pachctl create pipeline -f pipelines/gui.pipeline.json`\n\n## Step 10: Interact with gui application\n\nNote: There is an issue with the houston cluster where there are not enough IP addresses for service pipeline.\n\n### run command to ssh into node:\n\n`ssh andrew@mlds-mgmt.us.rdlabs.hpecorp.net -L 8080:localhost:8080`\n\n### run command to port forward gui to local computer:\n\n`kubectl port-forward -n pachyderm svc/pdf-rag-andrew-gui-v1-user 8080:80`\n\n### Open web browswer and go to url `localhost:8080`\n\n####  Ask in the UI:\n\n`Who is Antonio Neri?`\n\n\n#### Now ask, the app wont answer it correctly:\n\n`Who is Neil MacDonald?`\n\n## Step 11: Add new documents to repo `documents` to improve RAG App\n\nWe will show the key value proposition with a data driven pipeline, add more documents, the RAG app will automatically be updated. \n\n### In the terminal, add new document:\n\n`pachctl put file documents@master: -f neil-macdonald.xml`\n\nWhen pipeline is done, refresh webpage and ask:\n`Who is Neil MacDonald?`\n\n\n# Optional Steps\n\n## Step 12: (Optional Step) Pipeline step to develop dataset for finetuning embeddings: qna pipelinee\n\n`pachctl create pipeline -f pipelines/qna.pipeline.json`\n\n## Step 13: (Optional Step) Pipeline step to fientune embeddings\n\nNote, what is hardcoded is the following in `fientune/experiment/const.yaml`:\n\n```\nname: arctic-embed-fine-tune\nworkspace: Tyler\nproject: doc_embeds\n```\n\nAlso the bind_mounts are hardcoded. This assumes you are running on a cluster (i.e. the houston cluster) where you have a mounted shared folder called `/nvmefs1`\n\n```\nbind_mounts:\n  - container_path: /nvmefs1/\n    host_path: /nvmefs1/\n    propagation: rprivate\n    read_only: false\n  - container_path: /determined_shared_fs\n    host_path: /nvmefs1/determined/checkpoints\n    propagation: rprivate\n    read_only: false\n```\n\n### Step to trigger fientune pipeline: \n\n`pachctl create pipeline -f pipelines/finetune.pipeline.json`\n\n\n## Delete pipelines\n\n`pachctl delete pipeline gui`\n`pachctl delete pipeline finetune-embedding`\n`pachctl delete pipeline generate-qna`\n`pachctl delete pipeline embed-docs`\n`pachctl delete pipeline chunk-doc`\n`pachctl delete pipeline parse-docs`\n`pachctl delete repo documents`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteractivetech%2Frag-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finteractivetech%2Frag-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteractivetech%2Frag-pdf/lists"}