@langchain/core 1.1.3 → 1.1.4
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/CHANGELOG.md +8 -0
- package/dist/agents.d.cts +2 -0
- package/dist/agents.d.ts +2 -0
- package/dist/callbacks/base.d.cts +60 -22
- package/dist/callbacks/base.d.ts +60 -22
- package/dist/callbacks/dispatch/index.d.cts +3 -1
- package/dist/callbacks/dispatch/index.d.ts +3 -1
- package/dist/callbacks/dispatch/web.d.cts +3 -1
- package/dist/callbacks/dispatch/web.d.ts +3 -1
- package/dist/callbacks/manager.d.cts +12 -2
- package/dist/callbacks/manager.d.ts +12 -2
- package/dist/chat_history.d.cts +1 -0
- package/dist/chat_history.d.ts +1 -0
- package/dist/document_loaders/langsmith.d.cts +3 -0
- package/dist/document_loaders/langsmith.d.ts +3 -0
- package/dist/documents/document.d.cts +12 -3
- package/dist/documents/document.d.ts +12 -3
- package/dist/example_selectors/length_based.d.cts +1 -1
- package/dist/example_selectors/length_based.d.ts +1 -1
- package/dist/indexing/base.d.cts +1 -0
- package/dist/indexing/base.d.ts +1 -0
- package/dist/indexing/record_manager.d.cts +1 -0
- package/dist/indexing/record_manager.d.ts +1 -0
- package/dist/language_models/base.d.cts +38 -8
- package/dist/language_models/base.d.ts +38 -8
- package/dist/language_models/chat_models.d.cts +33 -6
- package/dist/language_models/chat_models.d.ts +33 -6
- package/dist/language_models/llms.d.cts +6 -0
- package/dist/language_models/llms.d.ts +6 -0
- package/dist/load/import_type.d.cts +1 -0
- package/dist/load/import_type.d.ts +1 -0
- package/dist/load/map_keys.cjs +5 -4
- package/dist/load/map_keys.cjs.map +1 -1
- package/dist/load/map_keys.d.cts +1 -0
- package/dist/load/map_keys.d.ts +1 -0
- package/dist/load/map_keys.js +3 -3
- package/dist/load/map_keys.js.map +1 -1
- package/dist/load/serializable.d.cts +1 -0
- package/dist/load/serializable.d.ts +1 -0
- package/dist/memory.d.cts +3 -0
- package/dist/memory.d.ts +3 -0
- package/dist/messages/base.d.cts +13 -1
- package/dist/messages/base.d.ts +13 -1
- package/dist/messages/content/data.d.cts +7 -2
- package/dist/messages/content/data.d.ts +7 -2
- package/dist/messages/content/index.d.cts +4 -1
- package/dist/messages/content/index.d.ts +4 -1
- package/dist/messages/content/multimodal.d.cts +1 -0
- package/dist/messages/content/multimodal.d.ts +1 -0
- package/dist/messages/content/tools.d.cts +1 -0
- package/dist/messages/content/tools.d.ts +1 -0
- package/dist/messages/tool.d.cts +9 -2
- package/dist/messages/tool.d.ts +9 -2
- package/dist/messages/transformers.d.cts +3 -0
- package/dist/messages/transformers.d.ts +3 -0
- package/dist/messages/utils.d.cts +5 -2
- package/dist/messages/utils.d.ts +5 -2
- package/dist/output_parsers/json.d.cts +5 -1
- package/dist/output_parsers/json.d.ts +5 -1
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +6 -2
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +6 -2
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +34 -10
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +34 -10
- package/dist/output_parsers/transform.d.cts +1 -0
- package/dist/output_parsers/transform.d.ts +1 -0
- package/dist/outputs.d.cts +6 -0
- package/dist/outputs.d.ts +6 -0
- package/dist/prompts/base.d.cts +10 -2
- package/dist/prompts/base.d.ts +10 -2
- package/dist/prompts/chat.d.cts +51 -13
- package/dist/prompts/chat.d.ts +51 -13
- package/dist/prompts/few_shot.d.cts +5 -1
- package/dist/prompts/few_shot.d.ts +5 -1
- package/dist/prompts/image.d.cts +10 -2
- package/dist/prompts/image.d.ts +10 -2
- package/dist/prompts/prompt.d.cts +15 -4
- package/dist/prompts/prompt.d.ts +16 -4
- package/dist/prompts/serde.d.cts +1 -0
- package/dist/prompts/serde.d.ts +1 -0
- package/dist/prompts/string.d.cts +5 -1
- package/dist/prompts/string.d.ts +5 -1
- package/dist/prompts/structured.d.cts +16 -3
- package/dist/prompts/structured.d.ts +16 -3
- package/dist/retrievers/document_compressors/index.d.cts +1 -0
- package/dist/retrievers/document_compressors/index.d.ts +1 -0
- package/dist/retrievers/index.d.cts +6 -2
- package/dist/retrievers/index.d.ts +6 -2
- package/dist/runnables/base.cjs +7 -7
- package/dist/runnables/base.cjs.map +1 -1
- package/dist/runnables/base.d.cts +64 -12
- package/dist/runnables/base.d.ts +64 -12
- package/dist/runnables/base.js +1 -1
- package/dist/runnables/base.js.map +1 -1
- package/dist/runnables/branch.d.cts +2 -0
- package/dist/runnables/branch.d.ts +2 -0
- package/dist/runnables/config.d.cts +1 -0
- package/dist/runnables/config.d.ts +1 -0
- package/dist/runnables/graph.d.cts +5 -1
- package/dist/runnables/graph.d.ts +5 -1
- package/dist/runnables/history.d.cts +12 -4
- package/dist/runnables/history.d.ts +12 -4
- package/dist/runnables/passthrough.d.cts +2 -0
- package/dist/runnables/passthrough.d.ts +2 -0
- package/dist/runnables/router.d.cts +1 -0
- package/dist/runnables/router.d.ts +1 -0
- package/dist/runnables/types.d.cts +9 -2
- package/dist/runnables/types.d.ts +9 -2
- package/dist/singletons/async_local_storage/context.d.cts +2 -0
- package/dist/singletons/async_local_storage/context.d.ts +2 -0
- package/dist/singletons/async_local_storage/globals.d.cts +1 -0
- package/dist/singletons/async_local_storage/globals.d.ts +1 -0
- package/dist/singletons/callbacks.cjs.map +1 -1
- package/dist/singletons/callbacks.js.map +1 -1
- package/dist/stores.d.cts +1 -0
- package/dist/stores.d.ts +1 -0
- package/dist/structured_query/utils.d.cts +4 -1
- package/dist/structured_query/utils.d.ts +4 -1
- package/dist/tools/index.d.cts +6 -1
- package/dist/tools/index.d.ts +6 -1
- package/dist/tools/types.d.cts +13 -3
- package/dist/tools/types.d.ts +13 -3
- package/dist/tracers/base.d.cts +20 -1
- package/dist/tracers/base.d.ts +20 -1
- package/dist/tracers/console.cjs +3 -3
- package/dist/tracers/console.cjs.map +1 -1
- package/dist/tracers/console.d.cts +2 -0
- package/dist/tracers/console.d.ts +2 -0
- package/dist/tracers/console.js +3 -3
- package/dist/tracers/console.js.map +1 -1
- package/dist/tracers/event_stream.d.cts +4 -0
- package/dist/tracers/event_stream.d.ts +4 -0
- package/dist/tracers/log_stream.d.cts +6 -0
- package/dist/tracers/log_stream.d.ts +6 -0
- package/dist/types/_internal.d.cts +3 -0
- package/dist/types/_internal.d.ts +3 -0
- package/dist/types/type-utils.d.cts +2 -0
- package/dist/types/type-utils.d.ts +2 -0
- package/dist/utils/async_caller.cjs +1 -1
- package/dist/utils/async_caller.cjs.map +1 -1
- package/dist/utils/async_caller.d.cts +3 -0
- package/dist/utils/async_caller.d.ts +3 -0
- package/dist/utils/async_caller.js +1 -1
- package/dist/utils/async_caller.js.map +1 -1
- package/dist/utils/env.d.cts +4 -0
- package/dist/utils/env.d.ts +4 -0
- package/dist/utils/event_source_parse.d.cts +4 -1
- package/dist/utils/event_source_parse.d.ts +4 -1
- package/dist/utils/function_calling.d.cts +3 -1
- package/dist/utils/function_calling.d.ts +3 -1
- package/dist/{node_modules/.pnpm/is-network-error@1.3.0/node_modules → utils}/is-network-error/index.cjs +1 -1
- package/dist/utils/is-network-error/index.cjs.map +1 -0
- package/dist/{node_modules/.pnpm/is-network-error@1.3.0/node_modules → utils}/is-network-error/index.js +1 -1
- package/dist/utils/is-network-error/index.js.map +1 -0
- package/dist/utils/json.d.cts +1 -0
- package/dist/utils/json.d.ts +1 -0
- package/dist/{node_modules/.pnpm/p-retry@7.1.0/node_modules → utils}/p-retry/index.cjs +2 -2
- package/dist/utils/p-retry/index.cjs.map +1 -0
- package/dist/{node_modules/.pnpm/p-retry@7.1.0/node_modules → utils}/p-retry/index.js +2 -2
- package/dist/utils/p-retry/index.js.map +1 -0
- package/dist/utils/stream.d.cts +13 -1
- package/dist/utils/stream.d.ts +13 -1
- package/dist/utils/testing/chat_models.d.cts +11 -3
- package/dist/utils/testing/chat_models.d.ts +11 -3
- package/dist/utils/testing/retrievers.d.cts +3 -1
- package/dist/utils/testing/retrievers.d.ts +3 -1
- package/dist/utils/testing/vectorstores.d.cts +1 -0
- package/dist/utils/testing/vectorstores.d.ts +1 -0
- package/dist/utils/types/index.d.cts +2 -0
- package/dist/utils/types/index.d.ts +2 -0
- package/dist/utils/types/zod.d.cts +3 -0
- package/dist/utils/types/zod.d.ts +3 -0
- package/dist/vectorstores.d.cts +17 -5
- package/dist/vectorstores.d.ts +17 -5
- package/package.json +5 -6
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.cjs +0 -169
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js +0 -168
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js.map +0 -1
- package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.cjs +0 -122
- package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js +0 -121
- package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js.map +0 -1
- package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.cjs +0 -18
- package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js +0 -17
- package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js.map +0 -1
- package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js.map +0 -1
- package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js.map +0 -1
package/dist/load/map_keys.d.ts
CHANGED
package/dist/load/map_keys.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import snakeCase from "decamelize";
|
|
2
|
+
import camelCase from "camelcase";
|
|
3
3
|
|
|
4
4
|
//#region src/load/map_keys.ts
|
|
5
5
|
function keyToJson(key, map) {
|
|
6
|
-
return map?.[key] ||
|
|
6
|
+
return map?.[key] || snakeCase(key);
|
|
7
7
|
}
|
|
8
8
|
function keyFromJson(key, map) {
|
|
9
9
|
return map?.[key] || camelCase(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map_keys.js","names":["key: string","map?: SerializedKeyAlias","
|
|
1
|
+
{"version":3,"file":"map_keys.js","names":["key: string","map?: SerializedKeyAlias","fields: SerializedFields","mapper: typeof keyToJson","mapped: SerializedFields"],"sources":["../../src/load/map_keys.ts"],"sourcesContent":["import snakeCase from \"decamelize\";\nimport camelCase from \"camelcase\";\n\nexport interface SerializedFields {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n}\n\nexport interface SerializedKeyAlias {\n [key: string]: string;\n}\n\nexport function keyToJson(key: string, map?: SerializedKeyAlias): string {\n return map?.[key] || snakeCase(key);\n}\n\nexport function keyFromJson(key: string, map?: SerializedKeyAlias): string {\n return map?.[key] || camelCase(key);\n}\n\nexport function mapKeys(\n fields: SerializedFields,\n mapper: typeof keyToJson,\n map?: SerializedKeyAlias\n): SerializedFields {\n const mapped: SerializedFields = {};\n\n for (const key in fields) {\n if (Object.hasOwn(fields, key)) {\n mapped[mapper(key, map)] = fields[key];\n }\n }\n\n return mapped;\n}\n"],"mappings":";;;;AAYA,SAAgB,UAAUA,KAAaC,KAAkC;AACvE,QAAO,MAAM,QAAQ,UAAU,IAAI;AACpC;AAED,SAAgB,YAAYD,KAAaC,KAAkC;AACzE,QAAO,MAAM,QAAQ,UAAU,IAAI;AACpC;AAED,SAAgB,QACdC,QACAC,QACAF,KACkB;CAClB,MAAMG,SAA2B,CAAE;AAEnC,MAAK,MAAM,OAAO,OAChB,KAAI,OAAO,OAAO,QAAQ,IAAI,EAC5B,OAAO,OAAO,KAAK,IAAI,IAAI,OAAO;AAItC,QAAO;AACR"}
|
package/dist/memory.d.cts
CHANGED
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
* Type alias for a record where the keys are strings and the values can
|
|
4
4
|
* be any type. This is used to represent the input values for a Chain.
|
|
5
5
|
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
7
|
type InputValues = Record<string, any>;
|
|
7
8
|
/**
|
|
8
9
|
* Type alias for a record where the keys are strings and the values can
|
|
9
10
|
* be any type. This is used to represent the output values from a Chain.
|
|
10
11
|
*/
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
13
|
type OutputValues = Record<string, any>;
|
|
12
14
|
/**
|
|
13
15
|
* Type alias for a record where the keys are strings and the values can
|
|
14
16
|
* be any type. This is used to represent the memory variables in a Chain.
|
|
15
17
|
*/
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
19
|
type MemoryVariables = Record<string, any>;
|
|
17
20
|
/**
|
|
18
21
|
* Abstract base class for memory in LangChain's Chains. Memory refers to
|
package/dist/memory.d.ts
CHANGED
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
* Type alias for a record where the keys are strings and the values can
|
|
4
4
|
* be any type. This is used to represent the input values for a Chain.
|
|
5
5
|
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
7
|
type InputValues = Record<string, any>;
|
|
7
8
|
/**
|
|
8
9
|
* Type alias for a record where the keys are strings and the values can
|
|
9
10
|
* be any type. This is used to represent the output values from a Chain.
|
|
10
11
|
*/
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
13
|
type OutputValues = Record<string, any>;
|
|
12
14
|
/**
|
|
13
15
|
* Type alias for a record where the keys are strings and the values can
|
|
14
16
|
* be any type. This is used to represent the memory variables in a Chain.
|
|
15
17
|
*/
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
19
|
type MemoryVariables = Record<string, any>;
|
|
17
20
|
/**
|
|
18
21
|
* Abstract base class for memory in LangChain's Chains. Memory refers to
|
package/dist/messages/base.d.cts
CHANGED
|
@@ -11,8 +11,10 @@ interface StoredMessageData {
|
|
|
11
11
|
role: string | undefined;
|
|
12
12
|
name: string | undefined;
|
|
13
13
|
tool_call_id: string | undefined;
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
15
|
additional_kwargs?: Record<string, any>;
|
|
15
16
|
/** Response metadata. For example: response headers, logprobs, token counts, model name. */
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
18
|
response_metadata?: Record<string, any>;
|
|
17
19
|
id?: string;
|
|
18
20
|
}
|
|
@@ -111,8 +113,11 @@ declare abstract class BaseMessage<TStructure extends MessageStructure = Message
|
|
|
111
113
|
get contentBlocks(): Array<ContentBlock.Standard>;
|
|
112
114
|
toDict(): StoredMessage;
|
|
113
115
|
static lc_name(): string;
|
|
116
|
+
// Can't be protected for silly reasons
|
|
114
117
|
get _printableFields(): Record<string, unknown>;
|
|
115
118
|
static isInstance(obj: unknown): obj is BaseMessage;
|
|
119
|
+
// this private method is used to update the ID for the runtime
|
|
120
|
+
// value as well as in lc_kwargs for serialisation
|
|
116
121
|
_updateId(value: string | undefined): void;
|
|
117
122
|
get [Symbol.toStringTag](): any;
|
|
118
123
|
toFormattedString(format?: MessageStringFormat): string;
|
|
@@ -136,8 +141,15 @@ type OpenAIToolCall = {
|
|
|
136
141
|
index?: number;
|
|
137
142
|
};
|
|
138
143
|
declare function isOpenAIToolCallArray(value?: unknown): value is OpenAIToolCall[];
|
|
139
|
-
declare function _mergeDicts(
|
|
144
|
+
declare function _mergeDicts(
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
|
+
left?: Record<string, any>,
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
148
|
+
right?: Record<string, any>
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
|
+
): Record<string, any>;
|
|
140
151
|
declare function _mergeLists<Content extends ContentBlock>(left?: Content[], right?: Content[]): Content[] | undefined;
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
153
|
declare function _mergeObj<T = any>(left: T | undefined, right: T | undefined): T;
|
|
142
154
|
/**
|
|
143
155
|
* Represents a chunk of a message, which can be concatenated with other
|
package/dist/messages/base.d.ts
CHANGED
|
@@ -11,8 +11,10 @@ interface StoredMessageData {
|
|
|
11
11
|
role: string | undefined;
|
|
12
12
|
name: string | undefined;
|
|
13
13
|
tool_call_id: string | undefined;
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
15
|
additional_kwargs?: Record<string, any>;
|
|
15
16
|
/** Response metadata. For example: response headers, logprobs, token counts, model name. */
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
18
|
response_metadata?: Record<string, any>;
|
|
17
19
|
id?: string;
|
|
18
20
|
}
|
|
@@ -111,8 +113,11 @@ declare abstract class BaseMessage<TStructure extends MessageStructure = Message
|
|
|
111
113
|
get contentBlocks(): Array<ContentBlock.Standard>;
|
|
112
114
|
toDict(): StoredMessage;
|
|
113
115
|
static lc_name(): string;
|
|
116
|
+
// Can't be protected for silly reasons
|
|
114
117
|
get _printableFields(): Record<string, unknown>;
|
|
115
118
|
static isInstance(obj: unknown): obj is BaseMessage;
|
|
119
|
+
// this private method is used to update the ID for the runtime
|
|
120
|
+
// value as well as in lc_kwargs for serialisation
|
|
116
121
|
_updateId(value: string | undefined): void;
|
|
117
122
|
get [Symbol.toStringTag](): any;
|
|
118
123
|
toFormattedString(format?: MessageStringFormat): string;
|
|
@@ -136,8 +141,15 @@ type OpenAIToolCall = {
|
|
|
136
141
|
index?: number;
|
|
137
142
|
};
|
|
138
143
|
declare function isOpenAIToolCallArray(value?: unknown): value is OpenAIToolCall[];
|
|
139
|
-
declare function _mergeDicts(
|
|
144
|
+
declare function _mergeDicts(
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
|
+
left?: Record<string, any>,
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
148
|
+
right?: Record<string, any>
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
|
+
): Record<string, any>;
|
|
140
151
|
declare function _mergeLists<Content extends ContentBlock>(left?: Content[], right?: Content[]): Content[] | undefined;
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
153
|
declare function _mergeObj<T = any>(left: T | undefined, right: T | undefined): T;
|
|
142
154
|
/**
|
|
143
155
|
* Represents a chunk of a message, which can be concatenated with other
|
|
@@ -30,12 +30,17 @@ type MessageContentImageUrl = {
|
|
|
30
30
|
* @deprecated
|
|
31
31
|
* Use {@link ContentBlock} instead.
|
|
32
32
|
*/
|
|
33
|
-
type MessageContentComplex = MessageContentText | MessageContentImageUrl
|
|
33
|
+
type MessageContentComplex = MessageContentText | MessageContentImageUrl
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
| (Record<string, any> & {
|
|
34
36
|
type?: "text" | "image_url" | string;
|
|
35
|
-
})
|
|
37
|
+
})
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
| (Record<string, any> & {
|
|
36
40
|
type?: never;
|
|
37
41
|
});
|
|
38
42
|
type Data = never;
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
39
44
|
declare namespace Data {
|
|
40
45
|
/**
|
|
41
46
|
* @deprecated
|
|
@@ -30,12 +30,17 @@ type MessageContentImageUrl = {
|
|
|
30
30
|
* @deprecated
|
|
31
31
|
* Use {@link ContentBlock} instead.
|
|
32
32
|
*/
|
|
33
|
-
type MessageContentComplex = MessageContentText | MessageContentImageUrl
|
|
33
|
+
type MessageContentComplex = MessageContentText | MessageContentImageUrl
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
| (Record<string, any> & {
|
|
34
36
|
type?: "text" | "image_url" | string;
|
|
35
|
-
})
|
|
37
|
+
})
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
| (Record<string, any> & {
|
|
36
40
|
type?: never;
|
|
37
41
|
});
|
|
38
42
|
type Data = never;
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
39
44
|
declare namespace Data {
|
|
40
45
|
/**
|
|
41
46
|
* @deprecated
|
|
@@ -6,6 +6,7 @@ import { Data } from "./data.cjs";
|
|
|
6
6
|
//#region src/messages/content/index.d.ts
|
|
7
7
|
interface ContentBlock extends BaseContentBlock {}
|
|
8
8
|
declare const KNOWN_BLOCK_TYPES: string[];
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
9
10
|
declare namespace ContentBlock {
|
|
10
11
|
/**
|
|
11
12
|
* Annotation for citing data from a document.
|
|
@@ -97,7 +98,9 @@ declare namespace ContentBlock {
|
|
|
97
98
|
* If a provider's non-standard output includes reasoning and tool calls, it should be
|
|
98
99
|
* the adapter's job to parse that payload and emit the corresponding standard reasoning and tool call blocks.
|
|
99
100
|
*/
|
|
100
|
-
export interface NonStandard<
|
|
101
|
+
export interface NonStandard<
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
+
TValue extends Record<string, any> = Record<string, any>> extends ContentBlock {
|
|
101
104
|
/**
|
|
102
105
|
* Type of the content block
|
|
103
106
|
*/
|
|
@@ -6,6 +6,7 @@ import { Data } from "./data.js";
|
|
|
6
6
|
//#region src/messages/content/index.d.ts
|
|
7
7
|
interface ContentBlock extends BaseContentBlock {}
|
|
8
8
|
declare const KNOWN_BLOCK_TYPES: string[];
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
9
10
|
declare namespace ContentBlock {
|
|
10
11
|
/**
|
|
11
12
|
* Annotation for citing data from a document.
|
|
@@ -97,7 +98,9 @@ declare namespace ContentBlock {
|
|
|
97
98
|
* If a provider's non-standard output includes reasoning and tool calls, it should be
|
|
98
99
|
* the adapter's job to parse that payload and emit the corresponding standard reasoning and tool call blocks.
|
|
99
100
|
*/
|
|
100
|
-
export interface NonStandard<
|
|
101
|
+
export interface NonStandard<
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
+
TValue extends Record<string, any> = Record<string, any>> extends ContentBlock {
|
|
101
104
|
/**
|
|
102
105
|
* Type of the content block
|
|
103
106
|
*/
|
package/dist/messages/tool.d.cts
CHANGED
|
@@ -10,6 +10,7 @@ interface ToolMessageFields<TStructure extends MessageStructure = MessageStructu
|
|
|
10
10
|
* a subset of the full tool output is being passed as message content but the full
|
|
11
11
|
* output is needed in other parts of the code.
|
|
12
12
|
*/
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
14
|
artifact?: any;
|
|
14
15
|
tool_call_id: string;
|
|
15
16
|
status?: "success" | "error";
|
|
@@ -48,6 +49,7 @@ declare class ToolMessage<TStructure extends MessageStructure = MessageStructure
|
|
|
48
49
|
* a subset of the full tool output is being passed as message content but the full
|
|
49
50
|
* output is needed in other parts of the code.
|
|
50
51
|
*/
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
53
|
artifact?: any;
|
|
52
54
|
constructor(fields: $InferMessageContent<TStructure, "tool"> | ToolMessageFields, tool_call_id: string, name?: string);
|
|
53
55
|
constructor(fields: ToolMessageFields<TStructure>);
|
|
@@ -73,13 +75,16 @@ declare class ToolMessageChunk<TStructure extends MessageStructure = MessageStru
|
|
|
73
75
|
* a subset of the full tool output is being passed as message content but the full
|
|
74
76
|
* output is needed in other parts of the code.
|
|
75
77
|
*/
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
79
|
artifact?: any;
|
|
77
80
|
constructor(fields: ToolMessageFields<TStructure>);
|
|
78
81
|
static lc_name(): string;
|
|
79
82
|
concat(chunk: ToolMessageChunk<TStructure>): this;
|
|
80
83
|
get _printableFields(): Record<string, unknown>;
|
|
81
84
|
}
|
|
82
|
-
interface ToolCall<TName extends string = string,
|
|
85
|
+
interface ToolCall<TName extends string = string,
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
+
TArgs extends Record<string, any> = Record<string, any>> {
|
|
83
88
|
readonly type?: "tool_call";
|
|
84
89
|
/**
|
|
85
90
|
* If provided, an identifier associated with the tool call
|
|
@@ -182,7 +187,9 @@ interface InvalidToolCall<TName extends string = string> {
|
|
|
182
187
|
*/
|
|
183
188
|
index?: string | number;
|
|
184
189
|
}
|
|
185
|
-
declare function defaultToolCallParser(
|
|
190
|
+
declare function defaultToolCallParser(
|
|
191
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
192
|
+
rawToolCalls: Record<string, any>[]): [ToolCall[], InvalidToolCall[]];
|
|
186
193
|
/**
|
|
187
194
|
* @deprecated Use {@link ToolMessage.isInstance} instead
|
|
188
195
|
*/
|
package/dist/messages/tool.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface ToolMessageFields<TStructure extends MessageStructure = MessageStructu
|
|
|
10
10
|
* a subset of the full tool output is being passed as message content but the full
|
|
11
11
|
* output is needed in other parts of the code.
|
|
12
12
|
*/
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
14
|
artifact?: any;
|
|
14
15
|
tool_call_id: string;
|
|
15
16
|
status?: "success" | "error";
|
|
@@ -48,6 +49,7 @@ declare class ToolMessage<TStructure extends MessageStructure = MessageStructure
|
|
|
48
49
|
* a subset of the full tool output is being passed as message content but the full
|
|
49
50
|
* output is needed in other parts of the code.
|
|
50
51
|
*/
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
53
|
artifact?: any;
|
|
52
54
|
constructor(fields: $InferMessageContent<TStructure, "tool"> | ToolMessageFields, tool_call_id: string, name?: string);
|
|
53
55
|
constructor(fields: ToolMessageFields<TStructure>);
|
|
@@ -73,13 +75,16 @@ declare class ToolMessageChunk<TStructure extends MessageStructure = MessageStru
|
|
|
73
75
|
* a subset of the full tool output is being passed as message content but the full
|
|
74
76
|
* output is needed in other parts of the code.
|
|
75
77
|
*/
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
79
|
artifact?: any;
|
|
77
80
|
constructor(fields: ToolMessageFields<TStructure>);
|
|
78
81
|
static lc_name(): string;
|
|
79
82
|
concat(chunk: ToolMessageChunk<TStructure>): this;
|
|
80
83
|
get _printableFields(): Record<string, unknown>;
|
|
81
84
|
}
|
|
82
|
-
interface ToolCall<TName extends string = string,
|
|
85
|
+
interface ToolCall<TName extends string = string,
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
+
TArgs extends Record<string, any> = Record<string, any>> {
|
|
83
88
|
readonly type?: "tool_call";
|
|
84
89
|
/**
|
|
85
90
|
* If provided, an identifier associated with the tool call
|
|
@@ -182,7 +187,9 @@ interface InvalidToolCall<TName extends string = string> {
|
|
|
182
187
|
*/
|
|
183
188
|
index?: string | number;
|
|
184
189
|
}
|
|
185
|
-
declare function defaultToolCallParser(
|
|
190
|
+
declare function defaultToolCallParser(
|
|
191
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
192
|
+
rawToolCalls: Record<string, any>[]): [ToolCall[], InvalidToolCall[]];
|
|
186
193
|
/**
|
|
187
194
|
* @deprecated Use {@link ToolMessage.isInstance} instead
|
|
188
195
|
*/
|
|
@@ -14,6 +14,7 @@ import { RemoveMessage } from "./modifier.cjs";
|
|
|
14
14
|
//#region src/messages/transformers.d.ts
|
|
15
15
|
type MessageUnion = typeof HumanMessage | typeof AIMessage | typeof SystemMessage | typeof ChatMessage | typeof FunctionMessage | typeof ToolMessage | typeof RemoveMessage;
|
|
16
16
|
type MessageChunkUnion = typeof HumanMessageChunk | typeof AIMessageChunk | typeof SystemMessageChunk | typeof FunctionMessageChunk | typeof ToolMessageChunk | typeof ChatMessageChunk | typeof RemoveMessage;
|
|
17
|
+
// RemoveMessage does not have a chunk class.
|
|
17
18
|
type MessageTypeOrClass = MessageType | MessageUnion | MessageChunkUnion;
|
|
18
19
|
interface FilterMessagesFields {
|
|
19
20
|
/**
|
|
@@ -144,6 +145,8 @@ declare function filterMessages(messages: BaseMessage[], options?: FilterMessage
|
|
|
144
145
|
*/
|
|
145
146
|
declare function mergeMessageRuns(): Runnable<BaseMessage[], BaseMessage[]>;
|
|
146
147
|
declare function mergeMessageRuns(messages: BaseMessage[]): BaseMessage[];
|
|
148
|
+
// Since we can not import from `@langchain/textsplitters` we need
|
|
149
|
+
// to reconstruct the interface here.
|
|
147
150
|
interface _TextSplitterInterface extends BaseDocumentTransformer {
|
|
148
151
|
splitText(text: string): Promise<string[]>;
|
|
149
152
|
}
|
|
@@ -14,6 +14,7 @@ import { RemoveMessage } from "./modifier.js";
|
|
|
14
14
|
//#region src/messages/transformers.d.ts
|
|
15
15
|
type MessageUnion = typeof HumanMessage | typeof AIMessage | typeof SystemMessage | typeof ChatMessage | typeof FunctionMessage | typeof ToolMessage | typeof RemoveMessage;
|
|
16
16
|
type MessageChunkUnion = typeof HumanMessageChunk | typeof AIMessageChunk | typeof SystemMessageChunk | typeof FunctionMessageChunk | typeof ToolMessageChunk | typeof ChatMessageChunk | typeof RemoveMessage;
|
|
17
|
+
// RemoveMessage does not have a chunk class.
|
|
17
18
|
type MessageTypeOrClass = MessageType | MessageUnion | MessageChunkUnion;
|
|
18
19
|
interface FilterMessagesFields {
|
|
19
20
|
/**
|
|
@@ -144,6 +145,8 @@ declare function filterMessages(messages: BaseMessage[], options?: FilterMessage
|
|
|
144
145
|
*/
|
|
145
146
|
declare function mergeMessageRuns(): Runnable<BaseMessage[], BaseMessage[]>;
|
|
146
147
|
declare function mergeMessageRuns(messages: BaseMessage[]): BaseMessage[];
|
|
148
|
+
// Since we can not import from `@langchain/textsplitters` we need
|
|
149
|
+
// to reconstruct the interface here.
|
|
147
150
|
interface _TextSplitterInterface extends BaseDocumentTransformer {
|
|
148
151
|
splitText(text: string): Promise<string[]>;
|
|
149
152
|
}
|
|
@@ -63,7 +63,9 @@ type $OnlyIndexSignatures<T$1> = $HasIndexSignature<T$1> extends true ? [$KnownK
|
|
|
63
63
|
* // }
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
type $MergeObjects<T$1, U$1> =
|
|
66
|
+
type $MergeObjects<T$1, U$1> =
|
|
67
|
+
// If U is purely index-signature based, prefer U as a whole
|
|
68
|
+
$OnlyIndexSignatures<U$1> extends true ? U$1 : $OnlyIndexSignatures<T$1> extends true ? U$1 : { [K in keyof T$1 | keyof U$1]: K extends keyof T$1 ? K extends keyof U$1 ? T$1[K] extends Record<string, unknown> ? U$1[K] extends Record<string, unknown> ? $MergeObjects<T$1[K], U$1[K]> : U$1[K] : U$1[K] : T$1[K] : K extends keyof U$1 ? U$1[K] : never };
|
|
67
69
|
/**
|
|
68
70
|
* Merges two discriminated unions A and B based on a discriminator key (defaults to "type").
|
|
69
71
|
* For each possible value of the discriminator across both unions:
|
|
@@ -75,7 +77,8 @@ type $MergeObjects<T$1, U$1> = $OnlyIndexSignatures<U$1> extends true ? U$1 : $O
|
|
|
75
77
|
* @template B - Second discriminated union type that extends Record<Key, PropertyKey>
|
|
76
78
|
* @template Key - The discriminator key property, defaults to "type"
|
|
77
79
|
*/
|
|
78
|
-
type $MergeDiscriminatedUnion<A extends Record<Key, PropertyKey>, B extends Record<Key, PropertyKey>, Key extends PropertyKey = "type"> = { [T in A[Key] | B[Key]]: [Extract<B, Record<Key, T>>] extends [never]
|
|
80
|
+
type $MergeDiscriminatedUnion<A extends Record<Key, PropertyKey>, B extends Record<Key, PropertyKey>, Key extends PropertyKey = "type"> = { [T in A[Key] | B[Key]]: [Extract<B, Record<Key, T>>] extends [never] // Check if B has a member with this discriminator value
|
|
81
|
+
? Extract<A, Record<Key, T>> : [Extract<A, Record<Key, T>>] extends [never] ? Extract<B, Record<Key, T>> : $MergeObjects<Extract<A, Record<Key, T>>, Extract<B, Record<Key, T>>> }[A[Key] | B[Key]];
|
|
79
82
|
type Constructor<T$1> = new (...args: unknown[]) => T$1;
|
|
80
83
|
/**
|
|
81
84
|
* Immediately-invoked function expression.
|
package/dist/messages/utils.d.ts
CHANGED
|
@@ -63,7 +63,9 @@ type $OnlyIndexSignatures<T$1> = $HasIndexSignature<T$1> extends true ? [$KnownK
|
|
|
63
63
|
* // }
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
type $MergeObjects<T$1, U$1> =
|
|
66
|
+
type $MergeObjects<T$1, U$1> =
|
|
67
|
+
// If U is purely index-signature based, prefer U as a whole
|
|
68
|
+
$OnlyIndexSignatures<U$1> extends true ? U$1 : $OnlyIndexSignatures<T$1> extends true ? U$1 : { [K in keyof T$1 | keyof U$1]: K extends keyof T$1 ? K extends keyof U$1 ? T$1[K] extends Record<string, unknown> ? U$1[K] extends Record<string, unknown> ? $MergeObjects<T$1[K], U$1[K]> : U$1[K] : U$1[K] : T$1[K] : K extends keyof U$1 ? U$1[K] : never };
|
|
67
69
|
/**
|
|
68
70
|
* Merges two discriminated unions A and B based on a discriminator key (defaults to "type").
|
|
69
71
|
* For each possible value of the discriminator across both unions:
|
|
@@ -75,7 +77,8 @@ type $MergeObjects<T$1, U$1> = $OnlyIndexSignatures<U$1> extends true ? U$1 : $O
|
|
|
75
77
|
* @template B - Second discriminated union type that extends Record<Key, PropertyKey>
|
|
76
78
|
* @template Key - The discriminator key property, defaults to "type"
|
|
77
79
|
*/
|
|
78
|
-
type $MergeDiscriminatedUnion<A extends Record<Key, PropertyKey>, B extends Record<Key, PropertyKey>, Key extends PropertyKey = "type"> = { [T in A[Key] | B[Key]]: [Extract<B, Record<Key, T>>] extends [never]
|
|
80
|
+
type $MergeDiscriminatedUnion<A extends Record<Key, PropertyKey>, B extends Record<Key, PropertyKey>, Key extends PropertyKey = "type"> = { [T in A[Key] | B[Key]]: [Extract<B, Record<Key, T>>] extends [never] // Check if B has a member with this discriminator value
|
|
81
|
+
? Extract<A, Record<Key, T>> : [Extract<A, Record<Key, T>>] extends [never] ? Extract<B, Record<Key, T>> : $MergeObjects<Extract<A, Record<Key, T>>, Extract<B, Record<Key, T>>> }[A[Key] | B[Key]];
|
|
79
82
|
type Constructor<T$1> = new (...args: unknown[]) => T$1;
|
|
80
83
|
/**
|
|
81
84
|
* Immediately-invoked function expression.
|
|
@@ -8,13 +8,17 @@ import { parseJsonMarkdown, parsePartialJson } from "../utils/json.cjs";
|
|
|
8
8
|
/**
|
|
9
9
|
* Class for parsing the output of an LLM into a JSON object.
|
|
10
10
|
*/
|
|
11
|
-
declare class JsonOutputParser<
|
|
11
|
+
declare class JsonOutputParser<
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
T extends Record<string, any> = Record<string, any>> extends BaseCumulativeTransformOutputParser<T> {
|
|
12
14
|
static lc_name(): string;
|
|
13
15
|
lc_namespace: string[];
|
|
14
16
|
lc_serializable: boolean;
|
|
15
17
|
/** @internal */
|
|
16
18
|
_concatOutputChunks<T>(first: T, second: T): T;
|
|
17
19
|
protected _diff(prev: unknown | undefined, next: unknown): Operation[] | undefined;
|
|
20
|
+
// This should actually return Partial<T>, but there's no way
|
|
21
|
+
// to specify emitted chunks as instances separate from the main output type.
|
|
18
22
|
parsePartialResult(generations: ChatGeneration[] | Generation[]): Promise<T | undefined>;
|
|
19
23
|
parse(text: string): Promise<T>;
|
|
20
24
|
getFormatInstructions(): string;
|
|
@@ -8,13 +8,17 @@ import { parseJsonMarkdown, parsePartialJson } from "../utils/json.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Class for parsing the output of an LLM into a JSON object.
|
|
10
10
|
*/
|
|
11
|
-
declare class JsonOutputParser<
|
|
11
|
+
declare class JsonOutputParser<
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
T extends Record<string, any> = Record<string, any>> extends BaseCumulativeTransformOutputParser<T> {
|
|
12
14
|
static lc_name(): string;
|
|
13
15
|
lc_namespace: string[];
|
|
14
16
|
lc_serializable: boolean;
|
|
15
17
|
/** @internal */
|
|
16
18
|
_concatOutputChunks<T>(first: T, second: T): T;
|
|
17
19
|
protected _diff(prev: unknown | undefined, next: unknown): Operation[] | undefined;
|
|
20
|
+
// This should actually return Partial<T>, but there's no way
|
|
21
|
+
// to specify emitted chunks as instances separate from the main output type.
|
|
18
22
|
parsePartialResult(generations: ChatGeneration[] | Generation[]): Promise<T | undefined>;
|
|
19
23
|
parse(text: string): Promise<T>;
|
|
20
24
|
getFormatInstructions(): string;
|
|
@@ -35,7 +35,9 @@ declare class OutputFunctionsParser extends BaseLLMOutputParser<string> {
|
|
|
35
35
|
* Class for parsing the output of an LLM into a JSON object. Uses an
|
|
36
36
|
* instance of `OutputFunctionsParser` to parse the output.
|
|
37
37
|
*/
|
|
38
|
-
declare class JsonOutputFunctionsParser<
|
|
38
|
+
declare class JsonOutputFunctionsParser<
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
Output extends Record<string, any> = Record<string, any>> extends BaseCumulativeTransformOutputParser<Output> {
|
|
39
41
|
static lc_name(): string;
|
|
40
42
|
lc_namespace: string[];
|
|
41
43
|
lc_serializable: boolean;
|
|
@@ -61,7 +63,9 @@ declare class JsonOutputFunctionsParser<Output extends Record<string, any> = Rec
|
|
|
61
63
|
* a specific attribute. Uses an instance of `JsonOutputFunctionsParser`
|
|
62
64
|
* to parse the output.
|
|
63
65
|
*/
|
|
64
|
-
declare class JsonKeyOutputFunctionsParser<
|
|
66
|
+
declare class JsonKeyOutputFunctionsParser<
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
+
T extends Record<string, any> = Record<string, any>> extends BaseLLMOutputParser<T> {
|
|
65
69
|
static lc_name(): string;
|
|
66
70
|
lc_namespace: string[];
|
|
67
71
|
lc_serializable: boolean;
|
|
@@ -35,7 +35,9 @@ declare class OutputFunctionsParser extends BaseLLMOutputParser<string> {
|
|
|
35
35
|
* Class for parsing the output of an LLM into a JSON object. Uses an
|
|
36
36
|
* instance of `OutputFunctionsParser` to parse the output.
|
|
37
37
|
*/
|
|
38
|
-
declare class JsonOutputFunctionsParser<
|
|
38
|
+
declare class JsonOutputFunctionsParser<
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
Output extends Record<string, any> = Record<string, any>> extends BaseCumulativeTransformOutputParser<Output> {
|
|
39
41
|
static lc_name(): string;
|
|
40
42
|
lc_namespace: string[];
|
|
41
43
|
lc_serializable: boolean;
|
|
@@ -61,7 +63,9 @@ declare class JsonOutputFunctionsParser<Output extends Record<string, any> = Rec
|
|
|
61
63
|
* a specific attribute. Uses an instance of `JsonOutputFunctionsParser`
|
|
62
64
|
* to parse the output.
|
|
63
65
|
*/
|
|
64
|
-
declare class JsonKeyOutputFunctionsParser<
|
|
66
|
+
declare class JsonKeyOutputFunctionsParser<
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
+
T extends Record<string, any> = Record<string, any>> extends BaseLLMOutputParser<T> {
|
|
65
69
|
static lc_name(): string;
|
|
66
70
|
lc_namespace: string[];
|
|
67
71
|
lc_serializable: boolean;
|