{"id":45157429,"url":"https://github.com/couchbase-examples/rag-streamlit-aws-bedrock","last_synced_at":"2026-02-20T05:02:44.950Z","repository":{"id":250128187,"uuid":"821287177","full_name":"couchbase-examples/rag-streamlit-aws-bedrock","owner":"couchbase-examples","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-12T07:20:50.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-08-12T08:42:20.053Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/couchbase-examples.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":"2024-06-28T07:55:39.000Z","updated_at":"2024-08-12T07:20:53.000Z","dependencies_parsed_at":"2024-07-25T11:08:36.261Z","dependency_job_id":null,"html_url":"https://github.com/couchbase-examples/rag-streamlit-aws-bedrock","commit_stats":null,"previous_names":["couchbase-examples/rag-streamlit-aws-bedrock"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/couchbase-examples/rag-streamlit-aws-bedrock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Frag-streamlit-aws-bedrock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Frag-streamlit-aws-bedrock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Frag-streamlit-aws-bedrock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Frag-streamlit-aws-bedrock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/couchbase-examples","download_url":"https://codeload.github.com/couchbase-examples/rag-streamlit-aws-bedrock/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Frag-streamlit-aws-bedrock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29641929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T03:21:14.183Z","status":"ssl_error","status_checked_at":"2026-02-20T03:18:24.455Z","response_time":59,"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":[],"created_at":"2026-02-20T05:02:39.315Z","updated_at":"2026-02-20T05:02:44.934Z","avatar_url":"https://github.com/couchbase-examples.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## RAG Demo using Couchbase, Streamlit, Langchain, and Gemini Pro\n\nThis is a demo app built to chat with your custom PDFs using the vector search capabilities of Couchbase to augment the Gemini Pro results in a Retrieval-Augmented-Generation (RAG) model.\n\n### How does it work?\n\nYou can upload your PDFs with custom data \u0026 ask questions about the data in the chat box.\n\nFor each question, you will get two answers:\n\n- one using RAG (Couchbase logo)\n- one using pure LLM - Gemini Pro (🤖).\n\nFor RAG, we are using Langchain, Couchbase Vector Search \u0026 Gemini Pro. We fetch parts of the PDF relevant to the question using Vector search \u0026 add it as the context to the LLM. The LLM is instructed to answer based on the context from the Vector Store.\n\n### How to Run\n\n- #### Install dependencies\n\n  `pip install -r requirements.txt`\n\n- #### Set the environment secrets\n\n  Copy the `secrets.example.toml` file in `.streamlit` folder and rename it to `secrets.toml` and replace the placeholders with the actual values for your environment\n\n  ```\n  GOOGLE_API_KEY = \"\u003cgoogle_api_key\u003e\"\n  DB_CONN_STR = \"\u003cconnection_string_for_couchbase_cluster\u003e\"\n  DB_USERNAME = \"\u003cusername_for_couchbase_cluster\u003e\"\n  DB_PASSWORD = \"\u003cpassword_for_couchbase_cluster\u003e\"\n  DB_BUCKET = \"\u003cname_of_bucket_to_store_documents\u003e\"\n  DB_SCOPE = \"\u003cname_of_scope_to_store_documents\u003e\"\n  DB_COLLECTION = \"\u003cname_of_collection_to_store_documents\u003e\"\n  INDEX_NAME = \"\u003cname_of_fts_index_with_vector_support\u003e\"\n  LOGIN_PASSWORD = \"\u003cpassword to access the streamlit app\u003e\"\n  ```\n\n- #### Create the Search Index on Full Text Service\n\n  We need to create the Search Index on the Full Text Service in Couchbase. For this demo, you can import the following index using the instructions.\n\n  - [Couchbase Capella](https://docs.couchbase.com/cloud/search/import-search-index.html)\n\n    - Copy the index definition to a new file index.json\n    - Import the file in Capella using the instructions in the documentation.\n    - Click on Create Index to create the index.\n\n  - [Couchbase Server](https://docs.couchbase.com/server/current/search/import-search-index.html)\n\n    - Click on Search -\u003e Add Index -\u003e Import\n    - Copy the following Index definition in the Import screen\n    - Click on Create Index to create the index.\n\n  #### Index Definition\n\n  Here, we are creating the index `pdf_search` on the documents in the `docs` collection within the `shared` scope in the bucket `pdf-docs`. The Vector field is set to `embeddings` with 768 dimensions and the text field set to `text`. We are also indexing and storing all the fields under `metadata` in the document as a dynamic mapping to account for varying document structures. The similarity metric is set to `dot_product`. If there is a change in these parameters, please adapt the index accordingly.\n\n  ```\n  {\n    \"name\": \"pdf_search\",\n    \"type\": \"fulltext-index\",\n    \"params\": {\n        \"doc_config\": {\n            \"docid_prefix_delim\": \"\",\n            \"docid_regexp\": \"\",\n            \"mode\": \"scope.collection.type_field\",\n            \"type_field\": \"type\"\n        },\n        \"mapping\": {\n            \"default_analyzer\": \"standard\",\n            \"default_datetime_parser\": \"dateTimeOptional\",\n            \"default_field\": \"_all\",\n            \"default_mapping\": {\n                \"dynamic\": true,\n                \"enabled\": false\n            },\n            \"default_type\": \"_default\",\n            \"docvalues_dynamic\": false,\n            \"index_dynamic\": true,\n            \"store_dynamic\": false,\n            \"type_field\": \"_type\",\n            \"types\": {\n                \"shared.docs\": {\n                    \"dynamic\": true,\n                    \"enabled\": true,\n                    \"properties\": {\n                        \"embedding\": {\n                            \"enabled\": true,\n                            \"dynamic\": false,\n                            \"fields\": [\n                                {\n                                    \"dims\": 768,\n                                    \"index\": true,\n                                    \"name\": \"embedding\",\n                                    \"similarity\": \"dot_product\",\n                                    \"type\": \"vector\",\n                                    \"vector_index_optimized_for\": \"recall\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"enabled\": true,\n                            \"dynamic\": false,\n                            \"fields\": [\n                                {\n                                    \"index\": true,\n                                    \"name\": \"text\",\n                                    \"store\": true,\n                                    \"type\": \"text\"\n                                }\n                            ]\n                        }\n                    }\n                }\n            }\n        },\n        \"store\": {\n            \"indexType\": \"scorch\",\n            \"segmentVersion\": 16\n        }\n    },\n    \"sourceType\": \"gocbcore\",\n    \"sourceName\": \"pdf-docs\",\n    \"sourceParams\": {},\n    \"planParams\": {\n        \"maxPartitionsPerPIndex\": 64,\n        \"indexPartitions\": 16,\n        \"numReplicas\": 0\n    }\n  }\n  ```\n\n- #### Run the application\n\n  `streamlit run chat_with_pdf.py`\n\n\nEnsure Line 25 is based on whatever scope \u0026 collection that i created. in this case, _default _default.\n\nEnsure line 35, is based on 1024 dimensions for AWS Titan\n\nEnsure that line 65 has the bucket name stated, in my case, awsbedrock is the bucket name\n\nEnsure that i am using Titan Text Embeddings V2, amazon.titan-embed-text-v2:0 \u003c- Model Name on line 124\n\nEnsure that i am using US-East-1 on line 122\n\nEnsure that i use Titan Text G1 as its LLM, model name is amazon.titan-text-express-v1 on Line 150\n\nLine 167 - Ensure that the correct LLM models are used, in our case, AWS -  Bedrock(client=bedrock_client, model_id=aws_model_id)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase-examples%2Frag-streamlit-aws-bedrock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcouchbase-examples%2Frag-streamlit-aws-bedrock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase-examples%2Frag-streamlit-aws-bedrock/lists"}