@cobrowser/chatgpt 0.7.17 → 0.7.18

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.
@@ -16,5 +16,9 @@ export declare class AssistantService extends BaseService {
16
16
  *
17
17
  * @param message
18
18
  */
19
- getReply(message: string, instructions?: string, functionOutputs?: string): Promise<ChatGptResponse | undefined>;
19
+ getReply(message: string, runOptions?: {
20
+ instructions?: string;
21
+ tools?: any[];
22
+ functionOutputs?: string;
23
+ }): Promise<ChatGptResponse | undefined>;
20
24
  }
@@ -57,7 +57,7 @@ class AssistantService extends BaseService_1.default {
57
57
  *
58
58
  * @param message
59
59
  */
60
- getReply(message, instructions, functionOutputs) {
60
+ getReply(message, runOptions = {}) {
61
61
  var _a;
62
62
  return __awaiter(this, void 0, void 0, function* () {
63
63
  if (!this.assistantId || !this.threadId) {
@@ -66,8 +66,8 @@ class AssistantService extends BaseService_1.default {
66
66
  }
67
67
  const openai = new openai_1.default({ apiKey: this.openaiApiKey });
68
68
  let run;
69
- if (functionOutputs && this.runId) {
70
- run = yield openai.beta.threads.runs.submitToolOutputsAndPoll(this.threadId, this.runId, { tool_outputs: JSON.parse(functionOutputs) });
69
+ if (runOptions.functionOutputs && this.runId) {
70
+ run = yield openai.beta.threads.runs.submitToolOutputsAndPoll(this.threadId, this.runId, { tool_outputs: JSON.parse(runOptions.functionOutputs) });
71
71
  }
72
72
  else {
73
73
  const lastThreadMessasges = yield openai.beta.threads.messages.list(this.threadId, { order: "desc", limit: 2 });
@@ -78,7 +78,11 @@ 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, { assistant_id: (_a = this.assistantId) !== null && _a !== void 0 ? _a : '', additional_instructions: instructions });
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
+ });
82
86
  }
83
87
  }
84
88
  if (run) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobrowser/chatgpt",
3
- "version": "0.7.17",
3
+ "version": "0.7.18",
4
4
  "description": "chatgpt services to connect our projects with chatgpt api",
5
5
  "keywords": [
6
6
  "chatgpt",
@@ -39,5 +39,5 @@
39
39
  "bugs": {
40
40
  "url": "https://bitbucket.org/cobrowser/cb_utils/issues"
41
41
  },
42
- "gitHead": "cf1fbd8ba217c2b86386dfd59765308750e0e4f5"
42
+ "gitHead": "b899586229b32621acf33af6870b3664786ad970"
43
43
  }