@langchain/core 0.3.24 → 0.3.25
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/messages/base.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface StoredMessageV1 {
|
|
|
23
23
|
role: string | undefined;
|
|
24
24
|
text: string;
|
|
25
25
|
}
|
|
26
|
-
export type MessageType = "human" | "ai" | "generic" | "system" | "function" | "tool" | "remove";
|
|
26
|
+
export type MessageType = "human" | "ai" | "generic" | "developer" | "system" | "function" | "tool" | "remove";
|
|
27
27
|
export type ImageDetail = "auto" | "low" | "high";
|
|
28
28
|
export type MessageContentText = {
|
|
29
29
|
type: "text";
|
|
@@ -292,6 +292,10 @@ const _MSG_CHUNK_MAP = {
|
|
|
292
292
|
message: system_js_1.SystemMessage,
|
|
293
293
|
messageChunk: system_js_1.SystemMessageChunk,
|
|
294
294
|
},
|
|
295
|
+
developer: {
|
|
296
|
+
message: system_js_1.SystemMessage,
|
|
297
|
+
messageChunk: system_js_1.SystemMessageChunk,
|
|
298
|
+
},
|
|
295
299
|
tool: {
|
|
296
300
|
message: tool_js_1.ToolMessage,
|
|
297
301
|
messageChunk: tool_js_1.ToolMessageChunk,
|
|
@@ -351,6 +355,26 @@ function _switchTypeToMessage(messageType, fields, returnChunk) {
|
|
|
351
355
|
msg = new system_js_1.SystemMessage(fields);
|
|
352
356
|
}
|
|
353
357
|
break;
|
|
358
|
+
case "developer":
|
|
359
|
+
if (returnChunk) {
|
|
360
|
+
chunk = new system_js_1.SystemMessageChunk({
|
|
361
|
+
...fields,
|
|
362
|
+
additional_kwargs: {
|
|
363
|
+
...fields.additional_kwargs,
|
|
364
|
+
__openai_role__: "developer",
|
|
365
|
+
},
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
msg = new system_js_1.SystemMessage({
|
|
370
|
+
...fields,
|
|
371
|
+
additional_kwargs: {
|
|
372
|
+
...fields.additional_kwargs,
|
|
373
|
+
__openai_role__: "developer",
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
break;
|
|
354
378
|
case "tool":
|
|
355
379
|
if ("tool_call_id" in fields) {
|
|
356
380
|
if (returnChunk) {
|
|
@@ -286,6 +286,10 @@ const _MSG_CHUNK_MAP = {
|
|
|
286
286
|
message: SystemMessage,
|
|
287
287
|
messageChunk: SystemMessageChunk,
|
|
288
288
|
},
|
|
289
|
+
developer: {
|
|
290
|
+
message: SystemMessage,
|
|
291
|
+
messageChunk: SystemMessageChunk,
|
|
292
|
+
},
|
|
289
293
|
tool: {
|
|
290
294
|
message: ToolMessage,
|
|
291
295
|
messageChunk: ToolMessageChunk,
|
|
@@ -345,6 +349,26 @@ function _switchTypeToMessage(messageType, fields, returnChunk) {
|
|
|
345
349
|
msg = new SystemMessage(fields);
|
|
346
350
|
}
|
|
347
351
|
break;
|
|
352
|
+
case "developer":
|
|
353
|
+
if (returnChunk) {
|
|
354
|
+
chunk = new SystemMessageChunk({
|
|
355
|
+
...fields,
|
|
356
|
+
additional_kwargs: {
|
|
357
|
+
...fields.additional_kwargs,
|
|
358
|
+
__openai_role__: "developer",
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
msg = new SystemMessage({
|
|
364
|
+
...fields,
|
|
365
|
+
additional_kwargs: {
|
|
366
|
+
...fields.additional_kwargs,
|
|
367
|
+
__openai_role__: "developer",
|
|
368
|
+
},
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
break;
|
|
348
372
|
case "tool":
|
|
349
373
|
if ("tool_call_id" in fields) {
|
|
350
374
|
if (returnChunk) {
|
package/dist/messages/utils.cjs
CHANGED
|
@@ -83,6 +83,15 @@ function _constructMessageFromParams(params) {
|
|
|
83
83
|
else if (type === "system") {
|
|
84
84
|
return new system_js_1.SystemMessage(rest);
|
|
85
85
|
}
|
|
86
|
+
else if (type === "developer") {
|
|
87
|
+
return new system_js_1.SystemMessage({
|
|
88
|
+
...rest,
|
|
89
|
+
additional_kwargs: {
|
|
90
|
+
...rest.additional_kwargs,
|
|
91
|
+
__openai_role__: "developer",
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
86
95
|
else if (type === "tool" && "tool_call_id" in rest) {
|
|
87
96
|
return new tool_js_1.ToolMessage({
|
|
88
97
|
...rest,
|
|
@@ -92,7 +101,7 @@ function _constructMessageFromParams(params) {
|
|
|
92
101
|
});
|
|
93
102
|
}
|
|
94
103
|
else {
|
|
95
|
-
const error = (0, index_js_1.addLangChainErrorFields)(new Error(`Unable to coerce message from array: only human, AI, system, or tool message coercion is currently supported.\n\nReceived: ${JSON.stringify(params, null, 2)}`), "MESSAGE_COERCION_FAILURE");
|
|
104
|
+
const error = (0, index_js_1.addLangChainErrorFields)(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.\n\nReceived: ${JSON.stringify(params, null, 2)}`), "MESSAGE_COERCION_FAILURE");
|
|
96
105
|
throw error;
|
|
97
106
|
}
|
|
98
107
|
}
|
package/dist/messages/utils.js
CHANGED
|
@@ -80,6 +80,15 @@ function _constructMessageFromParams(params) {
|
|
|
80
80
|
else if (type === "system") {
|
|
81
81
|
return new SystemMessage(rest);
|
|
82
82
|
}
|
|
83
|
+
else if (type === "developer") {
|
|
84
|
+
return new SystemMessage({
|
|
85
|
+
...rest,
|
|
86
|
+
additional_kwargs: {
|
|
87
|
+
...rest.additional_kwargs,
|
|
88
|
+
__openai_role__: "developer",
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
83
92
|
else if (type === "tool" && "tool_call_id" in rest) {
|
|
84
93
|
return new ToolMessage({
|
|
85
94
|
...rest,
|
|
@@ -89,7 +98,7 @@ function _constructMessageFromParams(params) {
|
|
|
89
98
|
});
|
|
90
99
|
}
|
|
91
100
|
else {
|
|
92
|
-
const error = addLangChainErrorFields(new Error(`Unable to coerce message from array: only human, AI, system, or tool message coercion is currently supported.\n\nReceived: ${JSON.stringify(params, null, 2)}`), "MESSAGE_COERCION_FAILURE");
|
|
101
|
+
const error = addLangChainErrorFields(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.\n\nReceived: ${JSON.stringify(params, null, 2)}`), "MESSAGE_COERCION_FAILURE");
|
|
93
102
|
throw error;
|
|
94
103
|
}
|
|
95
104
|
}
|