openai-api
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -56,2 +56,7 @@ "use strict"; | ||
classification(opts) { | ||
const url = config.classificationsUrl(); | ||
return this._send_request(url, "post", opts); | ||
} | ||
engines() { | ||
@@ -58,0 +63,0 @@ const url = config.enginesUrl(); |
{ | ||
"name": "openai-api", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "A tiny client module for the openAI API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -103,2 +103,22 @@ # openai-api | ||
### Classification API call | ||
```js | ||
(async () => { | ||
const gptResponse = await openai.classification({ | ||
"examples": [ | ||
["A happy moment", "Positive"], | ||
["I am sad.", "Negative"], | ||
["I am feeling awesome", "Positive"] | ||
], | ||
"labels": ["Positive", "Negative", "Neutral"], | ||
"query": "It is a raining day :(", | ||
"search_model": "ada", | ||
"model": "curie" | ||
}); | ||
console.log(gptResponse.data); | ||
})(); | ||
``` | ||
### Engines API call | ||
@@ -105,0 +125,0 @@ |
@@ -51,2 +51,17 @@ require('dotenv').config(); | ||
it("should handle classification", async function () { | ||
const result = await openai.classification({ | ||
examples: [ | ||
["A happy moment", "Positive"], | ||
["I am sad.", "Negative"], | ||
["I am feeling awesome", "Positive"], | ||
], | ||
labels: ["Positive", "Negative", "Neutral"], | ||
query: "It is a raining day :(", | ||
search_model: "ada", | ||
model: "curie", | ||
}); | ||
expect(result).to.be.ok; | ||
}); | ||
it('should handle engines', async function () { | ||
@@ -53,0 +68,0 @@ const result = await openai.engines(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10910
221
143