@langchain/openai 0.3.15 → 0.3.16
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 -10
- package/dist/chat_models.js +11 -10
- package/package.json +1 -1
package/dist/chat_models.cjs
CHANGED
|
@@ -72,13 +72,15 @@ function openAIResponseToChatMessage(message, rawResponse, includeRawResponse) {
|
|
|
72
72
|
if (includeRawResponse !== undefined) {
|
|
73
73
|
additional_kwargs.__raw_response = rawResponse;
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
const response_metadata = {
|
|
76
|
+
model_name: rawResponse.model,
|
|
77
|
+
...(rawResponse.system_fingerprint
|
|
78
|
+
? {
|
|
79
|
+
usage: { ...rawResponse.usage },
|
|
80
|
+
system_fingerprint: rawResponse.system_fingerprint,
|
|
81
|
+
}
|
|
82
|
+
: {}),
|
|
83
|
+
};
|
|
82
84
|
if (message.audio) {
|
|
83
85
|
additional_kwargs.audio = message.audio;
|
|
84
86
|
}
|
|
@@ -1277,6 +1279,7 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
1277
1279
|
// Only include system fingerprint in the last chunk for now
|
|
1278
1280
|
// to avoid concatenation issues
|
|
1279
1281
|
generationInfo.system_fingerprint = data.system_fingerprint;
|
|
1282
|
+
generationInfo.model_name = data.model;
|
|
1280
1283
|
}
|
|
1281
1284
|
if (this.logprobs) {
|
|
1282
1285
|
generationInfo.logprobs = choice.logprobs;
|
|
@@ -1456,9 +1459,7 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
1456
1459
|
}
|
|
1457
1460
|
// Fields are not serialized unless passed to the constructor
|
|
1458
1461
|
// Doing this ensures all fields on the message are serialized
|
|
1459
|
-
generation.message = new messages_1.AIMessage(
|
|
1460
|
-
...generation.message,
|
|
1461
|
-
});
|
|
1462
|
+
generation.message = new messages_1.AIMessage(Object.fromEntries(Object.entries(generation.message).filter(([key]) => !key.startsWith("lc_"))));
|
|
1462
1463
|
generations.push(generation);
|
|
1463
1464
|
}
|
|
1464
1465
|
return {
|
package/dist/chat_models.js
CHANGED
|
@@ -68,13 +68,15 @@ function openAIResponseToChatMessage(message, rawResponse, includeRawResponse) {
|
|
|
68
68
|
if (includeRawResponse !== undefined) {
|
|
69
69
|
additional_kwargs.__raw_response = rawResponse;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
const response_metadata = {
|
|
72
|
+
model_name: rawResponse.model,
|
|
73
|
+
...(rawResponse.system_fingerprint
|
|
74
|
+
? {
|
|
75
|
+
usage: { ...rawResponse.usage },
|
|
76
|
+
system_fingerprint: rawResponse.system_fingerprint,
|
|
77
|
+
}
|
|
78
|
+
: {}),
|
|
79
|
+
};
|
|
78
80
|
if (message.audio) {
|
|
79
81
|
additional_kwargs.audio = message.audio;
|
|
80
82
|
}
|
|
@@ -1272,6 +1274,7 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
1272
1274
|
// Only include system fingerprint in the last chunk for now
|
|
1273
1275
|
// to avoid concatenation issues
|
|
1274
1276
|
generationInfo.system_fingerprint = data.system_fingerprint;
|
|
1277
|
+
generationInfo.model_name = data.model;
|
|
1275
1278
|
}
|
|
1276
1279
|
if (this.logprobs) {
|
|
1277
1280
|
generationInfo.logprobs = choice.logprobs;
|
|
@@ -1451,9 +1454,7 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
1451
1454
|
}
|
|
1452
1455
|
// Fields are not serialized unless passed to the constructor
|
|
1453
1456
|
// Doing this ensures all fields on the message are serialized
|
|
1454
|
-
generation.message = new AIMessage(
|
|
1455
|
-
...generation.message,
|
|
1456
|
-
});
|
|
1457
|
+
generation.message = new AIMessage(Object.fromEntries(Object.entries(generation.message).filter(([key]) => !key.startsWith("lc_"))));
|
|
1457
1458
|
generations.push(generation);
|
|
1458
1459
|
}
|
|
1459
1460
|
return {
|