From a42c7cbada67f5392d5a92c8156d3dc0e24a3e9b Mon Sep 17 00:00:00 2001 From: davidmezzetti <561939+davidmezzetti@users.noreply.github.com> Date: Tue, 17 Aug 2021 19:21:50 -0400 Subject: [PATCH] Update examples --- examples/node/package.json | 2 +- examples/node/src/embeddings.js | 6 +++--- examples/node/src/extractor.js | 4 ++-- package.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/node/package.json b/examples/node/package.json index 949d6cc..b8bdc2e 100644 --- a/examples/node/package.json +++ b/examples/node/package.json @@ -2,7 +2,7 @@ "name": "txtai-node", "dependencies": { "sprintf-js": ">=1.1.2", - "txtai": ">=3.1.0" + "txtai": ">=3.2.0" }, "devDependencies": { "@babel/cli": ">=7.10.5", diff --git a/examples/node/src/embeddings.js b/examples/node/src/embeddings.js index eea5e78..a5a7816 100644 --- a/examples/node/src/embeddings.js +++ b/examples/node/src/embeddings.js @@ -21,7 +21,7 @@ const run = async () => { console.log(sprintf("%-20s %s", "Query", "Best Match")); console.log("-".repeat(50)); - for (let query of ["feel good story", "climate change", "health", "war", "wildlife", "asia", "north america", "dishonest junk"]) { + for (let query of ["feel good story", "climate change", "public health story", "war", "wildlife", "asia", "lucky", "dishonest junk"]) { let results = await embeddings.similarity(query, data); let uid = results[0].id; console.log(sprintf("%-20s %s", query, data[uid])) @@ -37,13 +37,13 @@ const run = async () => { console.log(sprintf("%-20s %s", "Query", "Best Match")); console.log("-".repeat(50)); - for (let query of ["feel good story", "climate change", "health", "war", "wildlife", "asia", "north america", "dishonest junk"]) { + for (let query of ["feel good story", "climate change", "public health story", "war", "wildlife", "asia", "lucky", "dishonest junk"]) { let results = await embeddings.search(query, 1); let uid = results[0].id; console.log(sprintf("%-20s %s", query, data[uid])); } - data[0] = "Feel good story: baby panda born" + data[0] = "See it: baby panda born" await embeddings.delete([5]); await embeddings.add([{id: 0, text: data[0]}]) diff --git a/examples/node/src/extractor.js b/examples/node/src/extractor.js index c585e8b..4435e47 100644 --- a/examples/node/src/extractor.js +++ b/examples/node/src/extractor.js @@ -12,13 +12,13 @@ const run = async () => { let data = ["Giants hit 3 HRs to down Dodgers", "Giants 5 Dodgers 4 final", "Dodgers drop Game 2 against the Giants, 5-4", - "Blue Jays 2 Red Sox 1 final", + "Blue Jays beat Red Sox final score 2-1", "Red Sox lost to the Blue Jays, 2-1", "Blue Jays at Red Sox is over. Score: 2-1", "Phillies win over the Braves, 5-0", "Phillies 5 Braves 0 final", "Final: Braves lose to the Phillies in the series opener, 5-0", - "Final score: Flyers 4 Lightning 1", + "Lightning goaltender pulled, lose to Flyers 4-1", "Flyers 4 Lightning 1 final", "Flyers win 4-1"] diff --git a/package.json b/package.json index 7591aff..37aa864 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "txtai", - "version": "3.1.0", + "version": "3.2.0", "author": "NeuML", "description": "Javascript bindings for txtai, an AI-powered search engine", "license": "Apache-2.0",