@langchain/openai 0.5.3 → 0.5.4
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 +25 -27
- package/dist/chat_models.js +25 -27
- package/package.json +1 -1
package/dist/chat_models.cjs
CHANGED
|
@@ -231,34 +231,32 @@ function _convertMessagesToOpenAIResponsesParams(messages, model) {
|
|
|
231
231
|
}
|
|
232
232
|
return input;
|
|
233
233
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return [];
|
|
259
|
-
}),
|
|
260
|
-
};
|
|
234
|
+
const content = typeof lcMsg.content === "string"
|
|
235
|
+
? lcMsg.content
|
|
236
|
+
: lcMsg.content.flatMap((item) => {
|
|
237
|
+
if (item.type === "text") {
|
|
238
|
+
return { type: "input_text", text: item.text };
|
|
239
|
+
}
|
|
240
|
+
if (item.type === "image_url") {
|
|
241
|
+
const image_url = typeof item.image_url === "string"
|
|
242
|
+
? item.image_url
|
|
243
|
+
: item.image_url.url;
|
|
244
|
+
const detail = typeof item.image_url === "string"
|
|
245
|
+
? "auto"
|
|
246
|
+
: item.image_url.detail;
|
|
247
|
+
return { type: "input_image", image_url, detail };
|
|
248
|
+
}
|
|
249
|
+
if (item.type === "input_text" ||
|
|
250
|
+
item.type === "input_image" ||
|
|
251
|
+
item.type === "input_file") {
|
|
252
|
+
return item;
|
|
253
|
+
}
|
|
254
|
+
return [];
|
|
255
|
+
});
|
|
256
|
+
if (role === "user" || role === "system" || role === "developer") {
|
|
257
|
+
return { type: "message", role, content };
|
|
261
258
|
}
|
|
259
|
+
console.warn(`Unsupported role found when converting to OpenAI Responses API: ${role}`);
|
|
262
260
|
return [];
|
|
263
261
|
});
|
|
264
262
|
}
|
package/dist/chat_models.js
CHANGED
|
@@ -226,34 +226,32 @@ function _convertMessagesToOpenAIResponsesParams(messages, model) {
|
|
|
226
226
|
}
|
|
227
227
|
return input;
|
|
228
228
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return [];
|
|
254
|
-
}),
|
|
255
|
-
};
|
|
229
|
+
const content = typeof lcMsg.content === "string"
|
|
230
|
+
? lcMsg.content
|
|
231
|
+
: lcMsg.content.flatMap((item) => {
|
|
232
|
+
if (item.type === "text") {
|
|
233
|
+
return { type: "input_text", text: item.text };
|
|
234
|
+
}
|
|
235
|
+
if (item.type === "image_url") {
|
|
236
|
+
const image_url = typeof item.image_url === "string"
|
|
237
|
+
? item.image_url
|
|
238
|
+
: item.image_url.url;
|
|
239
|
+
const detail = typeof item.image_url === "string"
|
|
240
|
+
? "auto"
|
|
241
|
+
: item.image_url.detail;
|
|
242
|
+
return { type: "input_image", image_url, detail };
|
|
243
|
+
}
|
|
244
|
+
if (item.type === "input_text" ||
|
|
245
|
+
item.type === "input_image" ||
|
|
246
|
+
item.type === "input_file") {
|
|
247
|
+
return item;
|
|
248
|
+
}
|
|
249
|
+
return [];
|
|
250
|
+
});
|
|
251
|
+
if (role === "user" || role === "system" || role === "developer") {
|
|
252
|
+
return { type: "message", role, content };
|
|
256
253
|
}
|
|
254
|
+
console.warn(`Unsupported role found when converting to OpenAI Responses API: ${role}`);
|
|
257
255
|
return [];
|
|
258
256
|
});
|
|
259
257
|
}
|