backend-manager 3.2.16 → 3.2.17
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/package.json
CHANGED
|
@@ -87,6 +87,9 @@ OpenAI.prototype.request = function (options) {
|
|
|
87
87
|
options.message.settings,
|
|
88
88
|
).trim();
|
|
89
89
|
const user = options.user?.auth?.uid || assistant.request.geolocation.ip;
|
|
90
|
+
const responseFormat = options.response === 'json' && !options.model.includes('gpt-3.5')
|
|
91
|
+
? { type: 'json_object' }
|
|
92
|
+
: undefined;
|
|
90
93
|
|
|
91
94
|
assistant.log('callOpenAI(): Prompt', prompt);
|
|
92
95
|
assistant.log('callOpenAI(): Message', message);
|
|
@@ -125,7 +128,7 @@ OpenAI.prototype.request = function (options) {
|
|
|
125
128
|
|
|
126
129
|
request.body = {
|
|
127
130
|
model: options.model,
|
|
128
|
-
response_format:
|
|
131
|
+
response_format: responseFormat,
|
|
129
132
|
messages: options.history.messages,
|
|
130
133
|
temperature: options.temperature,
|
|
131
134
|
max_tokens: options.maxTokens,
|
|
@@ -193,6 +196,8 @@ OpenAI.prototype.request = function (options) {
|
|
|
193
196
|
moderation: moderation,
|
|
194
197
|
})
|
|
195
198
|
} catch (e) {
|
|
199
|
+
assistant.warn('callOpenAI(): Error parsing response', r, e);
|
|
200
|
+
|
|
196
201
|
return reject(e);
|
|
197
202
|
}
|
|
198
203
|
})
|