sap-leonardo
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -5,2 +5,7 @@ # CHANGELOG | ||
## 0.5.4 | ||
- typo in Inference Service for Topic Detection | ||
- examples: | ||
- topic detection | ||
## 0.5.3 | ||
@@ -7,0 +12,0 @@ - Inference Service for Topic Detection |
@@ -19,3 +19,3 @@ "use strict"; | ||
}).then(done, done); | ||
}).timeout(20000); | ||
}).timeout(30000); | ||
}); | ||
@@ -33,3 +33,3 @@ describe("image to text with options", () => { | ||
}).then(done, done); | ||
}).timeout(20000); | ||
}).timeout(30000); | ||
it("should return a German text", (done) => { | ||
@@ -45,3 +45,3 @@ const options = { lang: "de", outputType: "txt", pageSegMode: "1", modelType: "lstmStandard" }; | ||
}).then(done, done); | ||
}).timeout(20000); | ||
}).timeout(30000); | ||
}); | ||
@@ -48,0 +48,0 @@ describe("image to text (via job)", () => { |
@@ -6,7 +6,7 @@ "use strict"; | ||
describe("topic detection", () => { | ||
const topicDectection = new index_1.TopicDectection(process.env.API_KEY); | ||
const topicDetection = new index_1.TopicDetection(process.env.API_KEY); | ||
const options = JSON.stringify({ numTopics: 3, numTopicsPerDoc: 2, numKeywordsPerTopic: 15 }); | ||
describe("files", () => { | ||
it("should detect topics", (done) => { | ||
topicDectection.topicDectection("./testdata/topic_detection.zip", options).then((body) => { | ||
topicDetection.topicDetection("./testdata/topic_detection.zip", options).then((body) => { | ||
chai_1.expect(body).to.have.property("id"); | ||
@@ -21,6 +21,6 @@ chai_1.expect(body).to.have.property("predictions"); | ||
describe("topic detection with different options", () => { | ||
const topicDectectionWithOptions = new index_1.TopicDectection(process.env.API_KEY); | ||
const topicDectectionWithOptions = new index_1.TopicDetection(process.env.API_KEY); | ||
it("should detect 2 keywords for numTopics 2", (done) => { | ||
const otherOptions = JSON.stringify({ numTopics: 2, numTopicsPerDoc: 2, numKeywordsPerTopic: 15 }); | ||
topicDectectionWithOptions.topicDectection("./testdata/topic_detection.zip", otherOptions).then((body) => { | ||
topicDectectionWithOptions.topicDetection("./testdata/topic_detection.zip", otherOptions).then((body) => { | ||
chai_1.expect(body).to.have.property("id"); | ||
@@ -36,3 +36,3 @@ chai_1.expect(body).to.have.property("predictions"); | ||
const otherOptions = JSON.stringify({ numTopics: 1, numTopicsPerDoc: 2, numKeywordsPerTopic: 15 }); | ||
topicDectectionWithOptions.topicDectection("./testdata/topic_detection.zip", otherOptions).then((body) => { | ||
topicDectectionWithOptions.topicDetection("./testdata/topic_detection.zip", otherOptions).then((body) => { | ||
chai_1.expect(body).to.have.property("id"); | ||
@@ -49,3 +49,3 @@ chai_1.expect(body).to.have.property("predictions"); | ||
it("should return an error message, that service requires at least 2 documents", (done) => { | ||
topicDectection.topicDectection("./testdata/product_text.zip", options).then((body) => { | ||
topicDetection.topicDetection("./testdata/product_text.zip", options).then((body) => { | ||
chai_1.expect(body).to.have.property("error"); | ||
@@ -60,5 +60,5 @@ chai_1.expect(body.error).to.have.property("code").to.be.equal("400"); | ||
describe("error coverage", () => { | ||
const topicDectectionErr = new index_1.TopicDectection(process.env.API_KEY, "http://localhost:11111"); | ||
const topicDectectionErr = new index_1.TopicDetection(process.env.API_KEY, "http://localhost:11111"); | ||
it("should return a file not found error", (done) => { | ||
topicDectectionErr.topicDectection("file_does_not_exist", "").then(() => { chai_1.expect.fail(); }, (err) => { | ||
topicDectectionErr.topicDetection("file_does_not_exist", "").then(() => { chai_1.expect.fail(); }, (err) => { | ||
chai_1.expect(err).to.have.property("errno").to.be.equal(-2); | ||
@@ -69,3 +69,3 @@ chai_1.expect(err).to.have.property("code").to.be.equal("ENOENT"); | ||
it("should return connection refused error", (done) => { | ||
topicDectectionErr.topicDectection("./testdata/product_text.zip", "").then(() => { chai_1.expect.fail(); }, (err) => { | ||
topicDectectionErr.topicDetection("./testdata/product_text.zip", "").then(() => { chai_1.expect.fail(); }, (err) => { | ||
chai_1.expect(err).to.have.property("errno").to.be.equal("ECONNREFUSED"); | ||
@@ -72,0 +72,0 @@ chai_1.expect(err).to.have.property("code").to.be.equal("ECONNREFUSED"); |
import { Promise } from "es6-promise"; | ||
export declare class TopicDectection { | ||
export declare class TopicDetection { | ||
private apiKey; | ||
private baseUrl; | ||
constructor(apiKey: any, baseUrl?: string); | ||
topicDectection(files: any, options: string): Promise<any>; | ||
topicDetection(files: any, options: string): Promise<any>; | ||
} |
@@ -7,3 +7,3 @@ "use strict"; | ||
const request = require("request"); | ||
class TopicDectection { | ||
class TopicDetection { | ||
constructor(apiKey, baseUrl = "https://sandbox.api.sap.com") { | ||
@@ -14,3 +14,3 @@ assert(apiKey, "apiKey is required"); | ||
} | ||
topicDectection(files, options) { | ||
topicDetection(files, options) { | ||
return new es6_promise_1.Promise((resolve, reject) => { | ||
@@ -38,2 +38,2 @@ const headers = { | ||
} | ||
exports.TopicDectection = TopicDectection; | ||
exports.TopicDetection = TopicDetection; |
{ | ||
"name": "sap-leonardo", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "NPM module for SAP Leonardo Machine Learning Foundation - Functional Services https://api.sap.com/package/SAPLeonardoMLFunctionalServices", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -70,3 +70,3 @@ # SAP Leonardo Machine Learning Foundation - Functional Services | ||
- ~~Training Service for Customizable Text Classification~~ | ||
- ~~Inference Service for Customizable Object Detection~~~~ | ||
- [Inference Service for Customizable Object Detection](https://api.sap.com/api/object_detection_api/resource) (not implemted) | ||
@@ -73,0 +73,0 @@ - [Inference Service for Optical Character Recognition (OCR)](https://api.sap.com/api/ocr_api/resource) |
295803
80
7601
59