@langchain/openai 0.5.0 → 0.5.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.
- package/dist/chat_models.cjs +11 -4
- package/dist/chat_models.js +11 -4
- package/dist/tools/dalle.cjs +1 -1
- package/dist/tools/dalle.js +1 -1
- package/package.json +1 -1
package/dist/chat_models.cjs
CHANGED
|
@@ -215,10 +215,17 @@ function _convertMessagesToOpenAIResponsesParams(messages, model) {
|
|
|
215
215
|
arguments: toolCall.function.arguments,
|
|
216
216
|
})));
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
const toolOutputs = lcMsg.response_metadata.output?.length
|
|
219
|
+
? lcMsg.response_metadata.output
|
|
220
|
+
: lcMsg.additional_kwargs.tool_outputs;
|
|
221
|
+
if (toolOutputs != null) {
|
|
222
|
+
const castToolOutputs = toolOutputs;
|
|
223
|
+
const reasoningCalls = castToolOutputs?.filter((item) => item.type === "reasoning");
|
|
224
|
+
const computerCalls = castToolOutputs?.filter((item) => item.type === "computer_call");
|
|
225
|
+
// NOTE: Reasoning outputs must be passed to the model BEFORE computer calls.
|
|
226
|
+
if (reasoningCalls.length > 0 && computerCalls.length > 0) {
|
|
227
|
+
input.push(...reasoningCalls);
|
|
228
|
+
}
|
|
222
229
|
if (computerCalls.length > 0)
|
|
223
230
|
input.push(...computerCalls);
|
|
224
231
|
}
|
package/dist/chat_models.js
CHANGED
|
@@ -210,10 +210,17 @@ function _convertMessagesToOpenAIResponsesParams(messages, model) {
|
|
|
210
210
|
arguments: toolCall.function.arguments,
|
|
211
211
|
})));
|
|
212
212
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
const toolOutputs = lcMsg.response_metadata.output?.length
|
|
214
|
+
? lcMsg.response_metadata.output
|
|
215
|
+
: lcMsg.additional_kwargs.tool_outputs;
|
|
216
|
+
if (toolOutputs != null) {
|
|
217
|
+
const castToolOutputs = toolOutputs;
|
|
218
|
+
const reasoningCalls = castToolOutputs?.filter((item) => item.type === "reasoning");
|
|
219
|
+
const computerCalls = castToolOutputs?.filter((item) => item.type === "computer_call");
|
|
220
|
+
// NOTE: Reasoning outputs must be passed to the model BEFORE computer calls.
|
|
221
|
+
if (reasoningCalls.length > 0 && computerCalls.length > 0) {
|
|
222
|
+
input.push(...reasoningCalls);
|
|
223
|
+
}
|
|
217
224
|
if (computerCalls.length > 0)
|
|
218
225
|
input.push(...computerCalls);
|
|
219
226
|
}
|
package/dist/tools/dalle.cjs
CHANGED
|
@@ -89,7 +89,7 @@ class DallEAPIWrapper extends tools_1.Tool {
|
|
|
89
89
|
apiKey: openAIApiKey,
|
|
90
90
|
organization,
|
|
91
91
|
dangerouslyAllowBrowser: true,
|
|
92
|
-
|
|
92
|
+
baseURL: fields?.baseUrl,
|
|
93
93
|
};
|
|
94
94
|
this.client = new openai_1.OpenAI(clientConfig);
|
|
95
95
|
this.model = fields?.model ?? fields?.modelName ?? this.model;
|
package/dist/tools/dalle.js
CHANGED
|
@@ -86,7 +86,7 @@ export class DallEAPIWrapper extends Tool {
|
|
|
86
86
|
apiKey: openAIApiKey,
|
|
87
87
|
organization,
|
|
88
88
|
dangerouslyAllowBrowser: true,
|
|
89
|
-
|
|
89
|
+
baseURL: fields?.baseUrl,
|
|
90
90
|
};
|
|
91
91
|
this.client = new OpenAIClient(clientConfig);
|
|
92
92
|
this.model = fields?.model ?? fields?.modelName ?? this.model;
|