@langchain/openai 0.5.8 → 0.5.10

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.
@@ -433,6 +433,7 @@ function _convertOpenAIResponsesMessageToBaseMessage(response) {
433
433
  error.name = response.error.code;
434
434
  throw error;
435
435
  }
436
+ let messageId;
436
437
  const content = [];
437
438
  const tool_calls = [];
438
439
  const invalid_tool_calls = [];
@@ -451,6 +452,7 @@ function _convertOpenAIResponsesMessageToBaseMessage(response) {
451
452
  const additional_kwargs = {};
452
453
  for (const item of response.output) {
453
454
  if (item.type === "message") {
455
+ messageId = item.id;
454
456
  content.push(...item.content.flatMap((part) => {
455
457
  if (part.type === "output_text") {
456
458
  if ("parsed" in part && part.parsed != null) {
@@ -501,7 +503,7 @@ function _convertOpenAIResponsesMessageToBaseMessage(response) {
501
503
  }
502
504
  }
503
505
  return new messages_1.AIMessage({
504
- id: response.id,
506
+ id: messageId,
505
507
  content,
506
508
  tool_calls,
507
509
  invalid_tool_calls,
@@ -543,7 +545,7 @@ function _convertOpenAIResponsesDeltaToBaseMessageChunk(chunk) {
543
545
  type: "tool_call_chunk",
544
546
  name: chunk.item.name,
545
547
  args: chunk.item.arguments,
546
- id: chunk.item.id,
548
+ id: chunk.item.call_id,
547
549
  index: chunk.output_index,
548
550
  });
549
551
  additional_kwargs[_FUNCTION_CALL_IDS_MAP_KEY] = {
@@ -428,6 +428,7 @@ function _convertOpenAIResponsesMessageToBaseMessage(response) {
428
428
  error.name = response.error.code;
429
429
  throw error;
430
430
  }
431
+ let messageId;
431
432
  const content = [];
432
433
  const tool_calls = [];
433
434
  const invalid_tool_calls = [];
@@ -446,6 +447,7 @@ function _convertOpenAIResponsesMessageToBaseMessage(response) {
446
447
  const additional_kwargs = {};
447
448
  for (const item of response.output) {
448
449
  if (item.type === "message") {
450
+ messageId = item.id;
449
451
  content.push(...item.content.flatMap((part) => {
450
452
  if (part.type === "output_text") {
451
453
  if ("parsed" in part && part.parsed != null) {
@@ -496,7 +498,7 @@ function _convertOpenAIResponsesMessageToBaseMessage(response) {
496
498
  }
497
499
  }
498
500
  return new AIMessage({
499
- id: response.id,
501
+ id: messageId,
500
502
  content,
501
503
  tool_calls,
502
504
  invalid_tool_calls,
@@ -538,7 +540,7 @@ function _convertOpenAIResponsesDeltaToBaseMessageChunk(chunk) {
538
540
  type: "tool_call_chunk",
539
541
  name: chunk.item.name,
540
542
  args: chunk.item.arguments,
541
- id: chunk.item.id,
543
+ id: chunk.item.call_id,
542
544
  index: chunk.output_index,
543
545
  });
544
546
  additional_kwargs[_FUNCTION_CALL_IDS_MAP_KEY] = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/openai",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "OpenAI integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {