From 28aad6ec8363836b61d612c4cb4a012fa0279753 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Mon, 25 Nov 2024 10:21:08 +0000 Subject: [PATCH 1/6] add validation overrides (for people using docker/podman) --- .../101/ch1/ecommerce/validation-overrides.xml | 4 ++++ .../101/ch2/ecommerce/validation-overrides.xml | 5 +++-- .../101/ch3/part-purchase/validation-overrides.xml | 4 ++++ .../101/ch5/embedder_rrf_rag/validation-overrides.xml | 4 ++++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 examples/training-artifacts/101/ch1/ecommerce/validation-overrides.xml create mode 100644 examples/training-artifacts/101/ch3/part-purchase/validation-overrides.xml create mode 100644 examples/training-artifacts/101/ch5/embedder_rrf_rag/validation-overrides.xml diff --git a/examples/training-artifacts/101/ch1/ecommerce/validation-overrides.xml b/examples/training-artifacts/101/ch1/ecommerce/validation-overrides.xml new file mode 100644 index 000000000..1de0d5319 --- /dev/null +++ b/examples/training-artifacts/101/ch1/ecommerce/validation-overrides.xml @@ -0,0 +1,4 @@ + + indexing-change + schema-removal + diff --git a/examples/training-artifacts/101/ch2/ecommerce/validation-overrides.xml b/examples/training-artifacts/101/ch2/ecommerce/validation-overrides.xml index 4d4cb9f23..1de0d5319 100644 --- a/examples/training-artifacts/101/ch2/ecommerce/validation-overrides.xml +++ b/examples/training-artifacts/101/ch2/ecommerce/validation-overrides.xml @@ -1,3 +1,4 @@ - - \ No newline at end of file + indexing-change + schema-removal + diff --git a/examples/training-artifacts/101/ch3/part-purchase/validation-overrides.xml b/examples/training-artifacts/101/ch3/part-purchase/validation-overrides.xml new file mode 100644 index 000000000..1de0d5319 --- /dev/null +++ b/examples/training-artifacts/101/ch3/part-purchase/validation-overrides.xml @@ -0,0 +1,4 @@ + + indexing-change + schema-removal + diff --git a/examples/training-artifacts/101/ch5/embedder_rrf_rag/validation-overrides.xml b/examples/training-artifacts/101/ch5/embedder_rrf_rag/validation-overrides.xml new file mode 100644 index 000000000..1de0d5319 --- /dev/null +++ b/examples/training-artifacts/101/ch5/embedder_rrf_rag/validation-overrides.xml @@ -0,0 +1,4 @@ + + indexing-change + schema-removal + From 23ce0d5863d46e30d65c92c70893574c4ad86781 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Mon, 25 Nov 2024 10:21:43 +0000 Subject: [PATCH 2/6] add some actions for people to do at the start --- .../training-artifacts/101/ch1/actions.txt | 43 +++++++++++++++++++ .../training-artifacts/101/ch1/f1f2-doc.json | 1 + 2 files changed, 44 insertions(+) create mode 100644 examples/training-artifacts/101/ch1/actions.txt create mode 100644 examples/training-artifacts/101/ch1/f1f2-doc.json diff --git a/examples/training-artifacts/101/ch1/actions.txt b/examples/training-artifacts/101/ch1/actions.txt new file mode 100644 index 000000000..402f0bdaa --- /dev/null +++ b/examples/training-artifacts/101/ch1/actions.txt @@ -0,0 +1,43 @@ +actions to take at the start of training: + +- ensure you're able to login using a google + or github account on https://console.vespa-cloud.com/ + +- You do not need to create your own "tenant" + (the organization / billing entity in vespa cloud); + if you contact Radu he will give you access to the + "training1" tenant. + +- we'll assume you have installed standard developer tools: + * git + * curl +- also recommended: + * jq + +- ensure you have the "vespa" CLI tool installed + +vespa auth login +vespa auth show +vespa config set target cloud +# replace "myusername" with your user name +vespa config set application training1.myusername-test1 + +git clone https://github.com/vespa-engine/sample-apps.git +cd sample-apps/examples/training-artifacts/101/ch1 +# you are "here" +cd ecommerce +vespa auth cert +vespa deploy --wait 900 +cd .. +vespa document put f1f2-doc.json +vespa document get id:ecommerce:product::1 +vespa visit +vespa query "yql=select * from product where true" +vespa query "yql=select * from product where true" | jq ".root.children" +vespa document remove id:ecommerce:product::1 + +- if you want to see usage of the underlying REST api, try these: +vespa document -v put f1f2-doc.json +vespa document -v get id:ecommerce:product::1 +vespa query -v "yql=select field1 from product where true" +vespa document -v remove id:ecommerce:product::1 diff --git a/examples/training-artifacts/101/ch1/f1f2-doc.json b/examples/training-artifacts/101/ch1/f1f2-doc.json new file mode 100644 index 000000000..35c6546e2 --- /dev/null +++ b/examples/training-artifacts/101/ch1/f1f2-doc.json @@ -0,0 +1 @@ +{"id": "id:ecommerce:product::1", "fields": {"field1": "foo", "field2": "and bar"}} From d99670b937af619939df6b60d443d82754f5bc63 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Mon, 25 Nov 2024 10:24:08 +0000 Subject: [PATCH 3/6] add using vespa CLI for queries --- .../training-artifacts/101/ch3/queries.cli | 70 +++++++++++++++++++ .../training-artifacts/101/ch3/queries.http | 9 +-- 2 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 examples/training-artifacts/101/ch3/queries.cli diff --git a/examples/training-artifacts/101/ch3/queries.cli b/examples/training-artifacts/101/ch3/queries.cli new file mode 100644 index 000000000..6996fabde --- /dev/null +++ b/examples/training-artifacts/101/ch3/queries.cli @@ -0,0 +1,70 @@ +### group by item. Show first 3 +vespa query "yql=select * from purchase where true | all( + group(item) + max(3) + each( + output(count()) + ) + )" + +vespa query "yql=select * from purchase where true limit 0 | all( + group(item) + order(-count()) + max(3) + each( + output(count() as(count_per_item)) + ) + )" + +### use total $$$ instead of count. But output count as well +vesap query "yql=select * from purchase where true limit 0 | all( + group(item) + order(-sum(price)) + each( + output(sum(price) as(revenue)) + output(count()) + ) + )" + +### sales by day +vespa query "yql=select * from purchase where true limit 0 | all( + group( + time.date(date) + ) + each( + output(sum(price) as(revenue_per_day)) + output(count()) + ) + )" | jq ".root.children[].children[].children[]" + +### sales by day, by item +vespa query "yql=select * from purchase where true limit 0 | all( + group(time.date(date)) + each( + output(-sum(price) as(revenue_per_day)) + output(count()) + all( + group(item) + order(-sum(price)) + each( + output(sum(price) as(revenue_per_item_per_day) + output(count()) + ) + ) + ) + )" | jq ".root.children[].children[].children[]" + + +### top items, but also show 3 sample orders +vespa query "yql=select * from purchase where true limit 0 | all( + group(item) + order(-sum(price)) + each( + output(sum(price) as(revenue)) + output(count()) + max(3) + each( + output(summary()) + ) + ) + )" diff --git a/examples/training-artifacts/101/ch3/queries.http b/examples/training-artifacts/101/ch3/queries.http index dd592a195..ee331ffd3 100644 --- a/examples/training-artifacts/101/ch3/queries.http +++ b/examples/training-artifacts/101/ch3/queries.http @@ -45,7 +45,7 @@ curl -H "Content-Type:application/json" https://ebe5e25b.d78af55d.z.vespa-app.cl time.date(date) ) each( - output(sum(price)) + output(sum(price) as(revenue)) output(count()) ) )" @@ -56,7 +56,7 @@ curl -H "Content-Type:application/json" https://ebe5e25b.d78af55d.z.vespa-app.cl "yql": "select * from purchase where true | all( group(time.date(date)) each( - output(-sum(price)) + output(sum(price)) output(count()) # within each bucket, take all orders @@ -67,7 +67,7 @@ curl -H "Content-Type:application/json" https://ebe5e25b.d78af55d.z.vespa-app.cl # order by revenue descending, like we did before order(-sum(price)) each( - output(sum(price)) + output(sum(price) as(revenue_per_item_per_day)) output(count()) ) ) @@ -102,5 +102,6 @@ curl -H "Content-Type:application/json" https://ebe5e25b.d78af55d.z.vespa-app.cl "yql": "select * from purchase where true | all( group(item) output(count()) + output(max(price)) )" -}' \ No newline at end of file +}' From 9ab40f5e2544afe55fcc6e8a545751f480eff0a5 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Mon, 25 Nov 2024 10:35:33 +0000 Subject: [PATCH 4/6] fix typos --- examples/training-artifacts/101/ch3/queries.cli | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/training-artifacts/101/ch3/queries.cli b/examples/training-artifacts/101/ch3/queries.cli index 6996fabde..794e50451 100644 --- a/examples/training-artifacts/101/ch3/queries.cli +++ b/examples/training-artifacts/101/ch3/queries.cli @@ -17,7 +17,7 @@ vespa query "yql=select * from purchase where true limit 0 | all( )" ### use total $$$ instead of count. But output count as well -vesap query "yql=select * from purchase where true limit 0 | all( +vespa query "yql=select * from purchase where true limit 0 | all( group(item) order(-sum(price)) each( @@ -41,13 +41,13 @@ vespa query "yql=select * from purchase where true limit 0 | all( vespa query "yql=select * from purchase where true limit 0 | all( group(time.date(date)) each( - output(-sum(price) as(revenue_per_day)) + output(sum(price) as(revenue_per_day)) output(count()) all( group(item) order(-sum(price)) each( - output(sum(price) as(revenue_per_item_per_day) + output(sum(price) as(revenue_per_item_per_day)) output(count()) ) ) From 8fe94853206900159ca6149f350e20cda787f41b Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Tue, 26 Nov 2024 13:03:22 +0000 Subject: [PATCH 5/6] add JSON-format query template --- .../101/ch4/query-template.json | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 examples/training-artifacts/101/ch4/query-template.json diff --git a/examples/training-artifacts/101/ch4/query-template.json b/examples/training-artifacts/101/ch4/query-template.json new file mode 100644 index 000000000..5915f0225 --- /dev/null +++ b/examples/training-artifacts/101/ch4/query-template.json @@ -0,0 +1,56 @@ +{ + "yql": "select * from product where —--->WHERE QUERY CLAUSE GOES HERE <—-----", + "presentation.summary": "medium", + "ranking.profile": "closeness", + "approximate_query_string": "Face Painting Stencil - QuickEZ/Gears #34", + "input.query(q_embedding)": [ + 0.015, 0.024, 0.046, -0.019, -0.036, -0.023, -0.027, -0.093, + -0.053, 0.055, -0.012, 0.082, 0.024, 0.023, 0.024, -0.038, + 0.037, -0.048, -0.1, -0.037, -0.045, 0.033, 0.023, -0.002, + -0.024, -0.035, -0.021, -0.032, -0.097, -0.187, -0.003, + 0.044, -0.019, -0.021, 0.022, -0.026, 0.002, 0.048, 0.006, + -0.041, 0.007, 0.062, -0.045, 0.019, 0.057, -0.027, 0.036, + 0.0, 0.052, 0.027, 0.0, -0.006, -0.007, -0.032, -0.064, 0.12, + -0.036, -0.004, 0.026, 0.054, -0.037, 0.062, -0.339, -0.007, + 0.05, 0.024, 0.015, -0.009, -0.082, 0.018, 0.038, -0.019, + -0.077, 0.028, 0.06, -0.016, 0.015, -0.02, 0.003, -0.087, + -0.045, 0.052, -0.023, -0.017, -0.019, 0.033, -0.041, -0.056, + 0.006, -0.011, -0.028, -0.02, -0.023, -0.009, -0.054, 0.054, + -0.014, 0.004, 0.062, 0.283, 0.035, 0.038, 0.09, -0.042, + 0.035, 0.012, -0.02, 0.036, -0.023, -0.011, -0.037, 0.008, + -0.072, 0.044, 0.056, 0.029, -0.035, -0.045, 0.026, 0.079, + -0.056, 0.022, -0.052, 0.007, -0.02, -0.013, -0.059, 0.059, + -0.001, 0.02, 0.016, 0.058, -0.053, 0.003, -0.025, -0.002, + 0.052, -0.036, -0.017, 0.019, -0.007, -0.046, 0.154, -0.011, + 0.054, 0.046, 0.025, -0.0, -0.035, -0.059, 0.017, -0.002, + 0.036, 0.059, 0.073, -0.02, -0.05, -0.034, -0.029, 0.001, + 0.042, -0.024, 0.074, 0.149, 0.033, 0.004, 0.064, 0.011, + 0.072, -0.004, -0.028, 0.001, 0.037, 0.018, -0.025, 0.029, + -0.015, 0.015, 0.035, -0.043, 0.018, 0.039, -0.05, -0.031, + -0.025, 0.039, -0.058, 0.015, 0.018, 0.104, -0.025, 0.099, + -0.097, 0.021, 0.036, 0.055, 0.04, 0.02, 0.008, -0.014, + -0.011, -0.033, 0.046, -0.05, 0.004, -0.014, 0.007, 0.026, + -0.024, -0.036, 0.011, -0.042, 0.044, 0.029, 0.032, 0.036, + 0.071, 0.017, 0.053, 0.061, 0.024, 0.006, -0.104, -0.065, + 0.03, 0.02, -0.015, -0.013, -0.014, -0.034, 0.073, 0.029, + 0.016, 0.033, 0.047, -0.009, -0.045, 0.011, -0.011, -0.034, + 0.053, 0.007, -0.058, 0.017, 0.029, -0.07, 0.0, -0.059, + -0.008, 0.121, -0.004, -0.03, 0.078, 0.04, -0.048, -0.005, + -0.147, 0.0, -0.058, 0.092, -0.051, -0.028, 0.007, -0.015, + -0.046, -0.06, -0.06, -0.007, -0.066, -0.001, 0.039, 0.049, + 0.044, 0.012, 0.046, 0.007, 0.008, 0.039, -0.093, 0.01, + -0.002, -0.025, -0.01, 0.055, -0.032, 0.013, -0.049, 0.01, + 0.02, -0.038, -0.016, -0.06, 0.036, -0.0, 0.114, -0.011, + 0.045, 0.028, -0.023, 0.004, -0.057, 0.019, -0.016, -0.002, + -0.103, -0.027, -0.017, 0.026, -0.028, 0.004, -0.005, -0.004, + 0.018, 0.052, 0.029, -0.061, 0.01, 0.069, 0.008, -0.158, + -0.055, 0.075, 0.01, -0.013, -0.042, 0.081, -0.053, 0.024, + -0.033, 0.088, 0.044, 0.014, 0.015, 0.014, 0.047, 0.008, + 0.037, -0.02, -0.108, 0.001, 0.01, 0.11, -0.014, 0.03, 0.0, + -0.016, -0.08, -0.073, 0.006, 0.01, -0.039, 0.064, -0.024, + 0.002, 0.127, 0.029, -0.05, 0.031, -0.01, 0.082, 0.004, + 0.015, -0.029, 0.017, -0.005, -0.007, 0.022, -0.043, -0.004, + 0.041, -0.004, -0.018, 0.018, -0.0, -0.012, 0.035, 0.001, + -0.053, 0.064, -0.019, 0.011, -0.02, -0.097, -0.032 + ] +} From 95f0052984293c6058fa9008b18780a3f8815bf6 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Wed, 27 Nov 2024 08:57:41 +0000 Subject: [PATCH 6/6] add link to vespa CLI release --- examples/training-artifacts/101/ch1/actions.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/training-artifacts/101/ch1/actions.txt b/examples/training-artifacts/101/ch1/actions.txt index 402f0bdaa..f29abe08d 100644 --- a/examples/training-artifacts/101/ch1/actions.txt +++ b/examples/training-artifacts/101/ch1/actions.txt @@ -14,7 +14,8 @@ actions to take at the start of training: - also recommended: * jq -- ensure you have the "vespa" CLI tool installed +- ensure you have the "vespa" CLI tool installed: + https://github.com/vespa-engine/vespa/releases/tag/v8.447.14 vespa auth login vespa auth show