@cobrowser/chatgpt 0.6.0 → 0.6.2

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.
@@ -5,6 +5,7 @@ export declare enum ChatGptRole {
5
5
  }
6
6
  export interface ChatGptRequestBody {
7
7
  model: string;
8
+ response_format?: {};
8
9
  messages: ChatGptMessage[];
9
10
  }
10
11
  interface ChatGptMessage {
@@ -12,7 +12,7 @@ class BaseService {
12
12
  * @param model the main chatGPT model to use
13
13
  * @param maxNumberOfChoices How many chat completion choices to generate for each request.
14
14
  */
15
- constructor(apiUrl, model = 'gpt-3.5-turbo', maxNumberOfChoices = 1) {
15
+ constructor(apiUrl, model = 'gpt-3.5-turbo-1106', maxNumberOfChoices = 1) {
16
16
  Object.defineProperty(this, "request", {
17
17
  enumerable: true,
18
18
  configurable: true,
@@ -44,10 +44,11 @@ class TranslationService extends BaseService_1.default {
44
44
  // the body we need to send to the request
45
45
  requestBody = {
46
46
  model: this.chatGptModel,
47
+ response_format: { type: "json_object" },
47
48
  messages: [
48
49
  {
49
50
  role: ChatGptMessage_1.ChatGptRole.SYSTEM,
50
- content: 'Your a translator that providees a response in JSON format only, the response should be a json having a boolean called error and data which is array of objects, the array of objects will contain objects having translation and translated_message properties',
51
+ content: 'Your a translator that providees a response in JSON format only, the response should be a json having a boolean called error and data which is array of objects, the array of objects will contain objects, each object will have translation property which will hold the translation of the message and the translated_message property will contain the the original message before being translated',
51
52
  },
52
53
  {
53
54
  role: ChatGptMessage_1.ChatGptRole.USER,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobrowser/chatgpt",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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": "df1339b9477e1828f68c3553666ed88c9a3ef198"
41
+ "gitHead": "d63bcaa212c0bb8f870479c1e001478d3e578980"
42
42
  }