@cobrowser/chatgpt 0.7.19 → 0.7.20

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.
@@ -1,5 +1,6 @@
1
1
  import ChatGptResponse from '../../models/ChatGptResponse';
2
2
  import BaseService from '../BaseService/BaseService';
3
+ import { AssistantResponseFormatOption } from 'openai/resources/beta/threads/threads';
3
4
  export declare class AssistantService extends BaseService {
4
5
  assistantId: string | undefined;
5
6
  threadId: string | undefined;
@@ -20,5 +21,6 @@ export declare class AssistantService extends BaseService {
20
21
  instructions?: string;
21
22
  tools?: any[];
22
23
  functionOutputs?: string;
24
+ definedSchema?: AssistantResponseFormatOption;
23
25
  }): Promise<ChatGptResponse | undefined>;
24
26
  }
@@ -78,11 +78,7 @@ class AssistantService extends BaseService_1.default {
78
78
  }
79
79
  else {
80
80
  yield openai.beta.threads.messages.create(this.threadId, { role: "user", content: message });
81
- run = yield openai.beta.threads.runs.create(this.threadId, {
82
- assistant_id: (_a = this.assistantId) !== null && _a !== void 0 ? _a : '',
83
- additional_instructions: runOptions.instructions,
84
- tools: runOptions.tools
85
- });
81
+ run = yield openai.beta.threads.runs.create(this.threadId, Object.assign(Object.assign({ assistant_id: (_a = this.assistantId) !== null && _a !== void 0 ? _a : '', additional_instructions: runOptions.instructions }, (runOptions.definedSchema ? { response_format: runOptions.definedSchema } : {})), { tools: runOptions.tools }));
86
82
  }
87
83
  }
88
84
  if (run) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobrowser/chatgpt",
3
- "version": "0.7.19",
3
+ "version": "0.7.20",
4
4
  "description": "chatgpt services to connect our projects with chatgpt api",
5
5
  "keywords": [
6
6
  "chatgpt",
@@ -24,7 +24,7 @@
24
24
  "@cobrowser/logger": "^2.0.2",
25
25
  "axios": "^1.6.1",
26
26
  "axios-mock-adapter": "^1.22.0",
27
- "openai": "^4.52.7"
27
+ "openai": "^4.86.2"
28
28
  },
29
29
  "directories": {
30
30
  "dist": "dist"
@@ -39,5 +39,5 @@
39
39
  "bugs": {
40
40
  "url": "https://bitbucket.org/cobrowser/cb_utils/issues"
41
41
  },
42
- "gitHead": "92f181d648d5372db54258bf3518092251c855fd"
42
+ "gitHead": "6633e2fd243d8ca83fce1eda3f96249f9efa426e"
43
43
  }