Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmezzetti committed Aug 17, 2021
1 parent 6c7b15a commit a42c7cb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions examples/node/src/embeddings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand All @@ -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]}])
Expand Down
4 changes: 2 additions & 2 deletions examples/node/src/extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit a42c7cb

Please sign in to comment.