@langchain/openai 0.4.9 → 0.5.1
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 +12 -5
- package/dist/chat_models.d.ts +1 -1
- package/dist/chat_models.js +12 -5
- 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
|
}
|
|
@@ -1107,7 +1114,7 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
1107
1114
|
enumerable: true,
|
|
1108
1115
|
configurable: true,
|
|
1109
1116
|
writable: true,
|
|
1110
|
-
value:
|
|
1117
|
+
value: void 0
|
|
1111
1118
|
});
|
|
1112
1119
|
Object.defineProperty(this, "logitBias", {
|
|
1113
1120
|
enumerable: true,
|
package/dist/chat_models.d.ts
CHANGED
|
@@ -693,7 +693,7 @@ export declare class ChatOpenAI<CallOptions extends ChatOpenAICallOptions = Chat
|
|
|
693
693
|
topP?: number;
|
|
694
694
|
frequencyPenalty?: number;
|
|
695
695
|
presencePenalty?: number;
|
|
696
|
-
n
|
|
696
|
+
n?: number;
|
|
697
697
|
logitBias?: Record<string, number>;
|
|
698
698
|
/** @deprecated Use "model" instead */
|
|
699
699
|
modelName: string;
|
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
|
}
|
|
@@ -1102,7 +1109,7 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
1102
1109
|
enumerable: true,
|
|
1103
1110
|
configurable: true,
|
|
1104
1111
|
writable: true,
|
|
1105
|
-
value:
|
|
1112
|
+
value: void 0
|
|
1106
1113
|
});
|
|
1107
1114
|
Object.defineProperty(this, "logitBias", {
|
|
1108
1115
|
enumerable: true,
|