@langchain/openai 0.3.6-rc.0 → 0.3.7

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.
@@ -1321,6 +1321,11 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
1321
1321
  if ((0, messages_1.isAIMessage)(generation.message)) {
1322
1322
  generation.message.usage_metadata = usageMetadata;
1323
1323
  }
1324
+ // Fields are not serialized unless passed to the constructor
1325
+ // Doing this ensures all fields on the message are serialized
1326
+ generation.message = new messages_1.AIMessage({
1327
+ ...generation.message,
1328
+ });
1324
1329
  generations.push(generation);
1325
1330
  }
1326
1331
  return {
@@ -1316,6 +1316,11 @@ export class ChatOpenAI extends BaseChatModel {
1316
1316
  if (isAIMessage(generation.message)) {
1317
1317
  generation.message.usage_metadata = usageMetadata;
1318
1318
  }
1319
+ // Fields are not serialized unless passed to the constructor
1320
+ // Doing this ensures all fields on the message are serialized
1321
+ generation.message = new AIMessage({
1322
+ ...generation.message,
1323
+ });
1319
1324
  generations.push(generation);
1320
1325
  }
1321
1326
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/openai",
3
- "version": "0.3.6-rc.0",
3
+ "version": "0.3.7",
4
4
  "description": "OpenAI integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {