@langchain/core 0.3.42 → 0.3.43
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.cjs +15 -3
- package/dist/messages/base.d.ts +1 -2
- package/dist/messages/base.js +15 -3
- package/dist/prompts/chat.d.ts +2 -2
- package/package.json +1 -1
package/dist/messages/base.cjs
CHANGED
|
@@ -84,11 +84,23 @@ class BaseMessage extends serializable_js_1.Serializable {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
* Use {@link BaseMessage.content} instead.
|
|
87
|
+
* Get text content of the message.
|
|
89
88
|
*/
|
|
90
89
|
get text() {
|
|
91
|
-
|
|
90
|
+
if (typeof this.content === "string") {
|
|
91
|
+
return this.content;
|
|
92
|
+
}
|
|
93
|
+
if (!Array.isArray(this.content))
|
|
94
|
+
return "";
|
|
95
|
+
return this.content
|
|
96
|
+
.map((c) => {
|
|
97
|
+
if (typeof c === "string")
|
|
98
|
+
return c;
|
|
99
|
+
if (c.type === "text")
|
|
100
|
+
return c.text;
|
|
101
|
+
return "";
|
|
102
|
+
})
|
|
103
|
+
.join("");
|
|
92
104
|
}
|
|
93
105
|
/** The type of the message. */
|
|
94
106
|
getType() {
|
package/dist/messages/base.d.ts
CHANGED
|
@@ -97,8 +97,7 @@ export declare abstract class BaseMessage extends Serializable implements BaseMe
|
|
|
97
97
|
lc_serializable: boolean;
|
|
98
98
|
get lc_aliases(): Record<string, string>;
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
101
|
-
* Use {@link BaseMessage.content} instead.
|
|
100
|
+
* Get text content of the message.
|
|
102
101
|
*/
|
|
103
102
|
get text(): string;
|
|
104
103
|
/** The content of the message. */
|
package/dist/messages/base.js
CHANGED
|
@@ -79,11 +79,23 @@ export class BaseMessage extends Serializable {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
83
|
-
* Use {@link BaseMessage.content} instead.
|
|
82
|
+
* Get text content of the message.
|
|
84
83
|
*/
|
|
85
84
|
get text() {
|
|
86
|
-
|
|
85
|
+
if (typeof this.content === "string") {
|
|
86
|
+
return this.content;
|
|
87
|
+
}
|
|
88
|
+
if (!Array.isArray(this.content))
|
|
89
|
+
return "";
|
|
90
|
+
return this.content
|
|
91
|
+
.map((c) => {
|
|
92
|
+
if (typeof c === "string")
|
|
93
|
+
return c;
|
|
94
|
+
if (c.type === "text")
|
|
95
|
+
return c.text;
|
|
96
|
+
return "";
|
|
97
|
+
})
|
|
98
|
+
.join("");
|
|
87
99
|
}
|
|
88
100
|
/** The type of the message. */
|
|
89
101
|
getType() {
|
package/dist/prompts/chat.d.ts
CHANGED
|
@@ -96,9 +96,9 @@ export declare class ChatMessagePromptTemplate<RunInput extends InputValues = an
|
|
|
96
96
|
constructor(prompt: BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>>, role: string);
|
|
97
97
|
constructor(fields: ChatMessagePromptTemplateFields<InputValues<Extract<keyof RunInput, string>>>);
|
|
98
98
|
format(values: RunInput): Promise<BaseMessage>;
|
|
99
|
-
static fromTemplate(template:
|
|
99
|
+
static fromTemplate<RunInput extends InputValues = Symbol, T extends string = string>(template: T, role: string, options?: {
|
|
100
100
|
templateFormat?: TemplateFormat;
|
|
101
|
-
}): ChatMessagePromptTemplate<
|
|
101
|
+
}): ChatMessagePromptTemplate<ExtractedFStringParams<T, RunInput>>;
|
|
102
102
|
}
|
|
103
103
|
interface _TextTemplateParam {
|
|
104
104
|
text?: string | Record<string, any>;
|