@socialgouv/cdtn-elasticsearch 1.8.12 → 1.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitlab-ci.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socialgouv/cdtn-elasticsearch",
|
|
3
3
|
"description": "SocialGouv - Code du travail numerique - Infrastructure - Elasticsearch",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.11.4",
|
|
5
5
|
"babel": {
|
|
6
6
|
"plugins": [
|
|
7
7
|
"@babel/plugin-transform-modules-commonjs"
|
|
8
8
|
]
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@socialgouv/cdtn-logger": "^1.
|
|
11
|
+
"@socialgouv/cdtn-logger": "^1.11.4",
|
|
12
12
|
"got": "^11.8.2"
|
|
13
13
|
},
|
|
14
14
|
"license": "Apache-2.0",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"url": "https://github.com/SocialGouv/cdtn-admin.git"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@babel/core": "^7.15.
|
|
29
|
-
"@babel/plugin-transform-modules-commonjs": "^7.15.
|
|
30
|
-
"@socialgouv/eslint-config-recommended": "^1.
|
|
28
|
+
"@babel/core": "^7.15.5",
|
|
29
|
+
"@babel/plugin-transform-modules-commonjs": "^7.15.4",
|
|
30
|
+
"@socialgouv/eslint-config-recommended": "^1.88.0",
|
|
31
31
|
"eslint": "^7.32.0",
|
|
32
|
-
"jest": "^27.
|
|
32
|
+
"jest": "^27.1.1",
|
|
33
33
|
"lint-staged": "^11.1.2",
|
|
34
34
|
"prettier": "^2.3.2"
|
|
35
35
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"typings": "src/index.d.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "13c3a9fac0e1315770b4ffddab6b62494913cf99"
|
|
50
50
|
}
|
package/src/vectorizer/index.js
CHANGED
|
@@ -32,7 +32,7 @@ function preprocess(text) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
async function callTFServe(json) {
|
|
35
|
-
const
|
|
35
|
+
const response = await got.post(tfServeURL, {
|
|
36
36
|
cache,
|
|
37
37
|
json,
|
|
38
38
|
responseType: "json",
|
|
@@ -41,7 +41,7 @@ async function callTFServe(json) {
|
|
|
41
41
|
methods: ["POST"],
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
|
-
return body["outputs"];
|
|
44
|
+
return response.body["outputs"];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
async function vectorizeDocument(title, content) {
|
|
@@ -57,6 +57,7 @@ async function vectorizeDocument(title, content) {
|
|
|
57
57
|
signature_name: "response_encoder",
|
|
58
58
|
};
|
|
59
59
|
const vectors = await callTFServe(body);
|
|
60
|
+
|
|
60
61
|
return vectors[0];
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -71,6 +72,7 @@ async function vectorizeQuery(query) {
|
|
|
71
72
|
signature_name: "question_encoder",
|
|
72
73
|
};
|
|
73
74
|
const vectors = await callTFServe(body);
|
|
75
|
+
console.log("vectors lenght", vectors.length);
|
|
74
76
|
return vectors[0];
|
|
75
77
|
}
|
|
76
78
|
|