-
Notifications
You must be signed in to change notification settings - Fork 124
adding aws-simple-rag sample app #1806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces a new sample application demonstrating Retrieval Augmented Generation (RAG) using AWS Bedrock-hosted LLM models integrated with Vespa. The application showcases how to leverage AWS Bedrock's OpenAI-compatible chat completions API for generation while using Vespa's hybrid search capabilities (combining BM25 text search and vector similarity) for retrieval.
Key Changes:
- New sample application
aws-simple-ragwith configuration for AWS Bedrock LLM integration - Hybrid search implementation combining text search (BM25) and vector similarity search using E5 embeddings
- Comprehensive documentation covering AWS Bedrock setup, Vespa deployment, and structured output generation
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| aws-simple-rag/services.xml | Configures Vespa services including E5 embedder component, AWS Bedrock OpenAI client with secret management, and RAGSearcher for generation |
| aws-simple-rag/schemas/passage.sd | Defines the passage document schema with text indexing, vector embeddings, and hybrid ranking profile |
| aws-simple-rag/README.md | Provides comprehensive setup instructions for AWS Bedrock configuration, Vespa deployment, and query examples including structured output |
| aws-simple-rag/.vespaignore | Specifies files to exclude from the Vespa application package |
| aws-simple-rag/ext/edit-app-access.png | Screenshot illustrating the secret access configuration in Vespa Cloud console |
| README.md | Adds reference to the new AWS Bedrock RAG sample application in the main repository index |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expression: 2 * closeness(field, embedding) + bm25(text) / 11 | ||
| } | ||
| match-features: bm25(text) closeness(field, embedding) |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The closeness(field, embedding) function appears to be using incorrect syntax. The closeness function typically takes the field name as a string or just the field name directly, not the literal word "field". This should likely be closeness(embedding) or the correct field reference.
| expression: 2 * closeness(field, embedding) + bm25(text) / 11 | |
| } | |
| match-features: bm25(text) closeness(field, embedding) | |
| expression: 2 * closeness(embedding) + bm25(text) / 11 | |
| } | |
| match-features: bm25(text) closeness(embedding) |
|
|
||
| document passage { | ||
|
|
||
| field id type string { |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: the field id block uses irregular spacing with 1 space before field while the field text block uses proper indentation. The opening brace is also on a different line than expected for the id field.
| field id type string { | |
| field id type string { |
| <component id="e5_small" type="hugging-face-embedder"> | ||
| <transformer-model url="https://github.com/vespa-engine/sample-apps/raw/master/examples/model-exporting/model/e5-small-v2-int8.onnx"/> | ||
| <tokenizer-model url="https://raw.githubusercontent.com/vespa-engine/sample-apps/master/examples/model-exporting/model/tokenizer.json"/> | ||
| <prepend> <!-- E5 prompt instructions --> | ||
| <query>query:</query> | ||
| <document>passage:</document> | ||
| </prepend> | ||
| </component> |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: the component definition uses 5 spaces while the rest of the file uses standard 2-space indentation. The component should align with other elements at the same level.
| <component id="e5_small" type="hugging-face-embedder"> | |
| <transformer-model url="https://github.com/vespa-engine/sample-apps/raw/master/examples/model-exporting/model/e5-small-v2-int8.onnx"/> | |
| <tokenizer-model url="https://raw.githubusercontent.com/vespa-engine/sample-apps/master/examples/model-exporting/model/tokenizer.json"/> | |
| <prepend> <!-- E5 prompt instructions --> | |
| <query>query:</query> | |
| <document>passage:</document> | |
| </prepend> | |
| </component> | |
| <component id="e5_small" type="hugging-face-embedder"> | |
| <transformer-model url="https://github.com/vespa-engine/sample-apps/raw/master/examples/model-exporting/model/e5-small-v2-int8.onnx"/> | |
| <tokenizer-model url="https://raw.githubusercontent.com/vespa-engine/sample-apps/master/examples/model-exporting/model/tokenizer.json"/> | |
| <prepend> <!-- E5 prompt instructions --> | |
| <query>query:</query> | |
| <document>passage:</document> | |
| </prepend> | |
| </component> |
| # Retrieval Augmented Generation (RAG) in Vespa using AWS BedRock models | ||
|
|
||
| This sample application demonstrates an end-to-end Retrieval Augmented | ||
| Generation application in Vespa, leveraging [AWS BedRock](https://aws.amazon.com/bedrock/) hosted models. |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect capitalization: "BedRock" should be "Bedrock" (lowercase 'r'). The official AWS product name is "Amazon Bedrock" not "BedRock".
| # Retrieval Augmented Generation (RAG) in Vespa using AWS BedRock models | |
| This sample application demonstrates an end-to-end Retrieval Augmented | |
| Generation application in Vespa, leveraging [AWS BedRock](https://aws.amazon.com/bedrock/) hosted models. | |
| # Retrieval Augmented Generation (RAG) in Vespa using AWS Bedrock models | |
| This sample application demonstrates an end-to-end Retrieval Augmented | |
| Generation application in Vespa, leveraging [AWS Bedrock](https://aws.amazon.com/bedrock/) hosted models. |
| # Retrieval Augmented Generation (RAG) in Vespa using AWS BedRock models | ||
|
|
||
| This sample application demonstrates an end-to-end Retrieval Augmented | ||
| Generation application in Vespa, leveraging [AWS BedRock](https://aws.amazon.com/bedrock/) hosted models. |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect capitalization: "BedRock" should be "Bedrock" (lowercase 'r'). The official AWS product name is "Amazon Bedrock" not "BedRock".
| # Retrieval Augmented Generation (RAG) in Vespa using AWS BedRock models | |
| This sample application demonstrates an end-to-end Retrieval Augmented | |
| Generation application in Vespa, leveraging [AWS BedRock](https://aws.amazon.com/bedrock/) hosted models. | |
| # Retrieval Augmented Generation (RAG) in Vespa using AWS Bedrock models | |
| This sample application demonstrates an end-to-end Retrieval Augmented | |
| Generation application in Vespa, leveraging [AWS Bedrock](https://aws.amazon.com/bedrock/) hosted models. |
|
|
||
| ```xml | ||
| <secrets> | ||
| <bedrock-api-key vault=">my-vault-name>" name="<my-secret-name>"/> |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing opening angle bracket in the vault attribute. The value should be vault="<my-vault-name>" instead of vault=">my-vault-name>" to match the pattern used for <my-secret-name>.
| <bedrock-api-key vault=">my-vault-name>" name="<my-secret-name>"/> | |
| <bedrock-api-key vault="<my-vault-name>" name="<my-secret-name>"/> |
| indexing: input text | embed e5_small | attribute | index | ||
| attribute { | ||
| distance-metric: angular | ||
| } | ||
| index { | ||
| hnsw { | ||
| max-links-per-node: 32 | ||
| neighbors-to-explore-at-insert: 100 | ||
| } | ||
| } |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation in the embedding field definition. The field content uses excessive indentation (12 spaces) instead of the standard 2 or 4 spaces used elsewhere in the schema.
| indexing: input text | embed e5_small | attribute | index | |
| attribute { | |
| distance-metric: angular | |
| } | |
| index { | |
| hnsw { | |
| max-links-per-node: 32 | |
| neighbors-to-explore-at-insert: 100 | |
| } | |
| } | |
| indexing: input text | embed e5_small | attribute | index | |
| attribute { | |
| distance-metric: angular | |
| } | |
| index { | |
| hnsw { | |
| max-links-per-node: 32 | |
| neighbors-to-explore-at-insert: 100 | |
| } | |
| } |
| inputs { | ||
| query(e) tensor<bfloat16>(x[384]) | ||
| } | ||
| first-phase { | ||
| expression: 2 * closeness(field, embedding) + bm25(text) / 11 | ||
| } | ||
| match-features: bm25(text) closeness(field, embedding) | ||
| } |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation in the rank-profile definition. Lines use 8 spaces for indentation instead of the standard 2 or 4 spaces used in the document field definitions.
| inputs { | |
| query(e) tensor<bfloat16>(x[384]) | |
| } | |
| first-phase { | |
| expression: 2 * closeness(field, embedding) + bm25(text) / 11 | |
| } | |
| match-features: bm25(text) closeness(field, embedding) | |
| } | |
| inputs { | |
| query(e) tensor<bfloat16>(x[384]) | |
| } | |
| first-phase { | |
| expression: 2 * closeness(field, embedding) + bm25(text) / 11 | |
| } | |
| match-features: bm25(text) closeness(field, embedding) | |
| } |
|
|
||
| <!-- Setup the client to Bedrock --> | ||
| <component id="openai" class="ai.vespa.llm.clients.OpenAI"> | ||
| <config name = "ai.vespa.llm.clients.llm-client"> |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space in the config name attribute. Should be name="ai.vespa.llm.clients.llm-client" instead of name = "ai.vespa.llm.clients.llm-client" to follow standard XML formatting conventions.
| <config name = "ai.vespa.llm.clients.llm-client"> | |
| <config name="ai.vespa.llm.clients.llm-client"> |
|
|
||
| ### Set-up an AWS Bedrock API Key | ||
|
|
||
| Create an [AWS BedRock API key](https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys.html). |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect capitalization: "BedRock" should be "Bedrock" (lowercase 'r'). The official AWS product name is "Amazon Bedrock" not "BedRock".
I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.