@cobrowser/chatgpt 0.2.0 → 0.4.0
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/README.md +29 -5
- package/dist/index.js +1 -5
- package/dist/services/BaseService/BaseService.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ChatGpt Lib
|
|
2
|
+
it is a list of services to use to work with ChatGPT API
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
```
|
|
5
|
+
Before working with the API make sure you have the `OPEN AI API KEY` in the env variables
|
|
6
|
+
it should be avaliable with process.env.OPEN_AI_API_KEY
|
|
7
|
+
```
|
|
8
|
+
the API key will be used to make authorization with the openAI APIs
|
|
9
|
+
`OPEN_AI_API_KEY`
|
|
10
|
+
`process.env.OPEN_AI_API_KEY`
|
|
11
|
+
|
|
12
|
+
## Current Available Services
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
we will have a list of services to use for different purposes
|
|
15
|
+
|
|
16
|
+
### Translation Service
|
|
17
|
+
can be used to translate a text from one language to another
|
|
18
|
+
|
|
19
|
+
**Usage**
|
|
6
20
|
|
|
7
21
|
```
|
|
8
|
-
const chatgpt = require('chatgpt');
|
|
9
22
|
|
|
10
|
-
|
|
23
|
+
const { TranslationService } = require('@cobrowser/chatgpt');
|
|
24
|
+
const service = new TranslationService();
|
|
25
|
+
const translation = await service.translate('Text to Translate');
|
|
11
26
|
```
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
translate(text: string, toLanguage = 'English', fromLanguage?: string)
|
|
30
|
+
```
|
|
31
|
+
```
|
|
32
|
+
By Default if languages didn't specifed the default language to translate to will be English
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
All services will have their API documentation (thanks to Typescript)
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
@@ -41,7 +41,7 @@ class BaseService {
|
|
|
41
41
|
baseURL: apiUrl || this.BASE_CHAT_COMPLETION_URL,
|
|
42
42
|
headers: {
|
|
43
43
|
'Content-Type': 'application/json',
|
|
44
|
-
Authorization: `Bearer ${process.env.
|
|
44
|
+
Authorization: `Bearer ${process.env.OPEN_AI_API_KEY} `,
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
47
|
this.chatGptModel = model;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobrowser/chatgpt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "chatgpt services to connect our projects with chatgpt api",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chatgpt",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"bugs": {
|
|
39
39
|
"url": "https://bitbucket.org/cobrowser/cb_utils/issues"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "c3e9dd6ac0f9796698aa88ce1f2c2cc4fbc1a2c2"
|
|
42
42
|
}
|