-
Notifications
You must be signed in to change notification settings - Fork 124
define sample apps in sample app json to be used by the console #1670
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e81a6d7
define sample apps in sample app json to be used by the console
lperry25 b91e5ff
replace document examples with jsonl to standarize applications that …
lperry25 6060ca4
update console-sample-apps.json
lperry25 4239aea
feat: add deployment workflow to deploy sample apps to Vespa Cloud
esolitos 0d09669
chore: update colbert sample app to follow the new standard
esolitos bfc5aae
chore: Update README with the information about the new Sample App st…
esolitos 94988de
fix: use the correct options and store the console-sample-apps.json
esolitos f19b8ff
fix: extract console-json from apps
esolitos f01335f
chore: use different env name for different branches
esolitos 1da1ae3
feat: validate jsonl on deploy
esolitos 5b99f17
revert news app to master
esolitos 20fd36f
fix: validate documents.jsonl lines
esolitos 4245d36
fix(text-search): update build to output jsonl instead of json
esolitos 3070ee6
chore: rename workflow and set job names
esolitos 2fbfe8f
fix(colbert): update documentation
esolitos 3a3c66b
chore(colbert): remove duplicate jsonl dataset
esolitos efad8d1
cleanup: reset news to origin/master
esolitos 0a91bbd
remove zippath from sample apps json
lperry25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| name: Update on Vespa Cloud | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - master | ||
|
|
||
| defaults: | ||
| run: | ||
| # Specify to ensure "pipefail and errexit" are set. | ||
| # Ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell | ||
| shell: bash | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write # Required for OIDC authentication | ||
| deployments: write | ||
|
|
||
| jobs: | ||
| setup: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| outputs: | ||
| app-list-json: ${{ steps.read-json.outputs.APP_LIST }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Read JSON | ||
| id: read-json | ||
| run: | | ||
| delimiter="$(openssl rand -hex 8)" | ||
| { | ||
| echo "APP_LIST<<${delimiter}" | ||
| sed -e '$a\' console-sample-apps.json # Ensures that an empty line is always present. | ||
| echo "${delimiter}" | ||
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Upload artifact JSON | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: console-json | ||
| path: console-sample-apps.json | ||
|
|
||
| create-and-validate: | ||
| name: Create Zip and Validate JSON | ||
| runs-on: ubuntu-latest | ||
|
|
||
| needs: | ||
| - setup | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| app: ${{ fromJSON(needs.setup.outputs.app-list-json) }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Create artifact | ||
| env: | ||
| DEBUG: ${{ runner.debug }} # Automatically set by GitHub Actions when running in debug mode. | ||
| run: | | ||
| ./scripts/build-sample-app.sh "${{ matrix.app.name }}" | ||
|
|
||
| # Ensure that both application.zip and documents.jsonl are created. | ||
| if [ ! -f "${{ matrix.app.name }}/dist/application.zip" ] || | ||
| [ ! -f "${{ matrix.app.name }}/dist/documents.jsonl" ]; then | ||
| echo "::error:: Build failure: application.zip or documents.jsonl not found in ${GITHUB_WORKSPACE}/${{ matrix.app.name }}/dist/" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Validate documents.jsonl | ||
| env: | ||
| DOCUMENTS_JSONL: ${{ matrix.app.name }}/dist/documents.jsonl | ||
| run: | | ||
| # Validate each line as a standalone JSON object/array | ||
| LINE_NUM=0 | ||
| while IFS= read -r line || [ -n "$line" ]; do | ||
| LINE_NUM=$((LINE_NUM + 1)) | ||
| echo "$line" | jq empty || ( | ||
| echo "::error:: Invalid JSON on line $LINE_NUM: $line" | ||
| exit 1 | ||
| ) | ||
| done < "$DOCUMENTS_JSONL" | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.app.shortname }} | ||
| path: ${{ matrix.app.name }}/dist/ | ||
|
|
||
| push: | ||
| name: Push to Vespa Cloud | ||
| runs-on: ubuntu-latest | ||
|
|
||
| environment: | ||
| # Append "CD" to the environment name if not on "push" event on default branch. | ||
| name: ${{ (github.event_name != 'push' || github.ref_name != 'master' ) && 'Vespa Cloud CD' || 'Vespa Cloud' }} | ||
| url: https://cloud.vespa.ai | ||
|
|
||
| needs: | ||
| - create-and-validate | ||
|
|
||
| env: | ||
| AWS_DEFAULT_REGION: us-east-1 | ||
| AWS_ROLE_SAMPLE_APP_DEPLOY: ${{ vars.AWS_ROLE_SAMPLE_APP_DEPLOY }} | ||
| AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ vars.AWS_CLOUDFRONT_DISTRIBUTION_ID }} | ||
| AWS_S3_BUCKET_NAME: ${{ vars.AWS_S3_BUCKET_NAME }} | ||
| S3_UPLOAD_PREFIX: console/one-click-sample-apps | ||
|
|
||
| steps: | ||
| - name: Download All Packages | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: apps | ||
|
|
||
| - name: List Downloaded | ||
| if: ${{ runner.debug }} | ||
| run: | | ||
| ls -lr apps | ||
|
|
||
| - name: Setup AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: ${{ env.AWS_DEFAULT_REGION }} | ||
| role-to-assume: ${{ env.AWS_ROLE_SAMPLE_APP_DEPLOY }} | ||
|
|
||
| - name: Push Zip and JSON to S3 | ||
| env: | ||
| # Add `--dryrun` if not on "push" event on default branch. | ||
| AWS_S3_OPTIONS: --color=on --no-progress ${{ (github.event_name == 'push' && github.ref_name == 'master' ) && '' || ' --dryrun' }} | ||
| run: | | ||
| # Not an app, but artifact from the setup job. | ||
| mv ./apps/console-json ./console-json | ||
|
|
||
| aws s3 sync ${{ env.AWS_S3_OPTIONS }} ./apps/ "s3://${AWS_S3_BUCKET_NAME}/${S3_UPLOAD_PREFIX}/" | ||
| aws s3 cp ${{ env.AWS_S3_OPTIONS }} ./console-json/console-sample-apps.json "s3://${S3_BUCKET}/${S3_UPLOAD_PREFIX}/" | ||
|
|
||
| - name: Invalidate Cloudfront Cache | ||
| env: | ||
| ECHO: ${{ (github.event_name == 'push' && github.ref_name == 'master') && '' || 'echo' }} | ||
| run: | | ||
| $ECHO aws cloudfront create-invalidation --distribution-id "${AWS_CLOUDFRONT_DISTRIBUTION_ID}" --paths "${S3_UPLOAD_PREFIX}/*" --output text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| src/main/application/security/ | ||
| .idea/ | ||
| dist/* |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| [ | ||
| { | ||
| "name": "album-recommendation", | ||
| "shortname": "album-recommendation", | ||
| "title": "Album Recommendation", | ||
| "description": "This application ranks music albums using a user profile: Albums with scores for a set of categories are matched with a user's preference.", | ||
| "features": [ | ||
| "Search", | ||
| "Recommendation" | ||
| ], | ||
| "category": "Getting Started", | ||
| "repository": "https://github.com/vespa-engine/sample-apps/tree/master/album-recommendation#readme", | ||
| "exampleQuery": { | ||
| "yql": "select * from music where true", | ||
| "ranking": { | ||
| "profile": "rank_albums", | ||
| "features": { | ||
| "query(user_profile)": "{{cat:pop}:0.8,{cat:rock}:0.2,{cat:jazz}:0.1}" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "text-search", | ||
| "shortname": "text-search", | ||
| "title": "Text Search", | ||
| "description": "The Text Search Tutorial demonstrates traditional text search using BM25/Vespa nativeRank, and is a good start to using the MS Marco dataset.", | ||
| "features": [ | ||
| "BM25", | ||
| "nativeRank", | ||
| "MS Marco" | ||
| ], | ||
| "category": "Getting Started", | ||
| "repository": "https://github.com/vespa-engine/sample-apps/tree/master/text-search#readme", | ||
| "exampleQuery": { | ||
| "yql": "select title,url,id from msmarco where userQuery()", | ||
| "query": "what is dad bod" | ||
| } | ||
| }, | ||
| { | ||
| "name": "colbert", | ||
| "shortname": "colbert", | ||
| "title": "Simple hybrid search with ColBERT", | ||
| "description": "This application uses a single vector embedding model for retrieval and ColBERT (multi-token vector representation) for re-ranking. This semantic search application demonstrates the colbert-embedder and the tensor expressions for ColBERT MaxSim.", | ||
| "features": [ | ||
| "ColBERT", | ||
| "Re-ranking" | ||
| ], | ||
| "category": "Ranking", | ||
| "repository": "https://github.com/vespa-engine/sample-apps/tree/master/colbert#readme", | ||
| "exampleQuery": { | ||
| "query": "shipping stuff over the sea", | ||
| "yql": "select * from doc where userQuery() or ({targetHits: 100}nearestNeighbor(embedding, q))", | ||
| "input": { | ||
| "query(q)": "embed(e5, @query)", | ||
| "query(qt)": "embed(colbert, @query)" | ||
| } | ||
| } | ||
| } | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What does
[!xx]syntax mean?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.
I am pretty sure this is special for Github: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
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.
Neat. I ask because I tried to open it from the commit tree, but it didn't render at all https://github.com/vespa-engine/sample-apps/blob/efad8d1dcc1179182c01d654d1a34b388cdeb4a7/README.md
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.
After further investigation it seems that GH does NOT support this in markdown documents, but only in their own makrdown fields (issues, prs, ...)