@sprucelabs/sprucebot-llm 11.0.17 → 11.1.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.
@@ -21,10 +21,15 @@ class OpenAiAdapter {
21
21
  const messageBuilder = OpenAiMessageBuilder_1.default.Builder(bot);
22
22
  const messages = messageBuilder.buildMessages();
23
23
  this.log.info('Sending message to OpenAI', JSON.stringify(messages, null, 2));
24
- const response = await this.api.chat.completions.create({
24
+ const params = {
25
25
  messages,
26
26
  model: options?.model ?? 'gpt-4o',
27
- });
27
+ };
28
+ if (process.env.OPENAI_REASONING_EFFORT) {
29
+ params.reasoning_effort = process.env
30
+ .OPENAI_REASONING_EFFORT;
31
+ }
32
+ const response = await this.api.chat.completions.create(params);
28
33
  const message = response.choices?.[0]?.message?.content?.trim() ??
29
34
  exports.MESSAGE_RESPONSE_ERROR_MESSAGE;
30
35
  this.log.info('Received response from OpenAI', message);
@@ -26,10 +26,15 @@ class OpenAiAdapter {
26
26
  const messageBuilder = OpenAiMessageBuilder.Builder(bot);
27
27
  const messages = messageBuilder.buildMessages();
28
28
  this.log.info('Sending message to OpenAI', JSON.stringify(messages, null, 2));
29
- const response = yield this.api.chat.completions.create({
29
+ const params = {
30
30
  messages,
31
31
  model: (_a = options === null || options === void 0 ? void 0 : options.model) !== null && _a !== void 0 ? _a : 'gpt-4o',
32
- });
32
+ };
33
+ if (process.env.OPENAI_REASONING_EFFORT) {
34
+ params.reasoning_effort = process.env
35
+ .OPENAI_REASONING_EFFORT;
36
+ }
37
+ const response = yield this.api.chat.completions.create(params);
33
38
  const message = (_f = (_e = (_d = (_c = (_b = response.choices) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.trim()) !== null && _f !== void 0 ? _f : MESSAGE_RESPONSE_ERROR_MESSAGE;
34
39
  this.log.info('Received response from OpenAI', message);
35
40
  return message;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "eta"
9
9
  ]
10
10
  },
11
- "version": "11.0.17",
11
+ "version": "11.1.0",
12
12
  "files": [
13
13
  "build"
14
14
  ],