@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @langchain/core
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#9575](https://github.com/langchain-ai/langchainjs/pull/9575) [`0bade90`](https://github.com/langchain-ai/langchainjs/commit/0bade90ed47c7988ed86f1e695a28273c7b3df50) Thanks [@hntrl](https://github.com/hntrl)! - bin p-retry
|
|
8
|
+
|
|
9
|
+
- [#9574](https://github.com/langchain-ai/langchainjs/pull/9574) [`6c40d00`](https://github.com/langchain-ai/langchainjs/commit/6c40d00e926f377d249c2919549381522eac8ed1) Thanks [@hntrl](https://github.com/hntrl)! - Revert "fix(@langchain/core): update and bundle dependencies (#9534)"
|
|
10
|
+
|
|
3
11
|
## 1.1.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/agents.d.cts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
//#region src/agents.d.ts
|
|
2
2
|
type AgentAction = {
|
|
3
3
|
tool: string;
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
5
|
toolInput: string | Record<string, any>;
|
|
5
6
|
log: string;
|
|
6
7
|
};
|
|
7
8
|
type AgentFinish = {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
10
|
returnValues: Record<string, any>;
|
|
9
11
|
log: string;
|
|
10
12
|
};
|
package/dist/agents.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
//#region src/agents.d.ts
|
|
2
2
|
type AgentAction = {
|
|
3
3
|
tool: string;
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
5
|
toolInput: string | Record<string, any>;
|
|
5
6
|
log: string;
|
|
6
7
|
};
|
|
7
8
|
type AgentFinish = {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
10
|
returnValues: Record<string, any>;
|
|
9
11
|
log: string;
|
|
10
12
|
};
|
|
@@ -8,6 +8,7 @@ import { ChainValues } from "../utils/types/index.cjs";
|
|
|
8
8
|
import { DocumentInterface } from "../documents/document.cjs";
|
|
9
9
|
|
|
10
10
|
//#region src/callbacks/base.d.ts
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
12
|
type Error = any;
|
|
12
13
|
/**
|
|
13
14
|
* Interface for the input parameters of the BaseCallbackHandler class. It
|
|
@@ -31,6 +32,7 @@ interface NewTokenIndices {
|
|
|
31
32
|
prompt: number;
|
|
32
33
|
completion: number;
|
|
33
34
|
}
|
|
35
|
+
// TODO: Add all additional callback fields here
|
|
34
36
|
type HandleLLMNewTokenCallbackFields = {
|
|
35
37
|
chunk?: GenerationChunk | ChatGenerationChunk;
|
|
36
38
|
};
|
|
@@ -44,7 +46,9 @@ declare abstract class BaseCallbackHandlerMethodsClass {
|
|
|
44
46
|
* Called at the start of an LLM or Chat Model run, with the prompt(s)
|
|
45
47
|
* and the run ID.
|
|
46
48
|
*/
|
|
47
|
-
handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
49
|
+
handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
Promise<any> | any;
|
|
48
52
|
/**
|
|
49
53
|
* Called when an LLM/ChatModel in `streaming` mode produces a new token
|
|
50
54
|
*/
|
|
@@ -55,50 +59,72 @@ declare abstract class BaseCallbackHandlerMethodsClass {
|
|
|
55
59
|
* idx.completion is the index of the completion that produced the token
|
|
56
60
|
* (if multiple completions per prompt are requested)
|
|
57
61
|
*/
|
|
58
|
-
idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields):
|
|
62
|
+
idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields):
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
+
Promise<any> | any;
|
|
59
65
|
/**
|
|
60
66
|
* Called if an LLM/ChatModel run encounters an error
|
|
61
67
|
*/
|
|
62
|
-
handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>):
|
|
68
|
+
handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>):
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
Promise<any> | any;
|
|
63
71
|
/**
|
|
64
72
|
* Called at the end of an LLM/ChatModel run, with the output and the run ID.
|
|
65
73
|
*/
|
|
66
|
-
handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>):
|
|
74
|
+
handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>):
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
Promise<any> | any;
|
|
67
77
|
/**
|
|
68
78
|
* Called at the start of a Chat Model run, with the prompt(s)
|
|
69
79
|
* and the run ID.
|
|
70
80
|
*/
|
|
71
|
-
handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
81
|
+
handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
Promise<any> | any;
|
|
72
84
|
/**
|
|
73
85
|
* Called at the start of a Chain run, with the chain name and inputs
|
|
74
86
|
* and the run ID.
|
|
75
87
|
*/
|
|
76
|
-
handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runType?: string, runName?: string):
|
|
88
|
+
handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runType?: string, runName?: string):
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
|
+
Promise<any> | any;
|
|
77
91
|
/**
|
|
78
92
|
* Called if a Chain run encounters an error
|
|
79
93
|
*/
|
|
80
94
|
handleChainError?(err: Error, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
|
|
81
95
|
inputs?: Record<string, unknown>;
|
|
82
|
-
}):
|
|
96
|
+
}):
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
+
Promise<any> | any;
|
|
83
99
|
/**
|
|
84
100
|
* Called at the end of a Chain run, with the outputs and the run ID.
|
|
85
101
|
*/
|
|
86
102
|
handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
|
|
87
103
|
inputs?: Record<string, unknown>;
|
|
88
|
-
}):
|
|
104
|
+
}):
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
|
+
Promise<any> | any;
|
|
89
107
|
/**
|
|
90
108
|
* Called at the start of a Tool run, with the tool name and input
|
|
91
109
|
* and the run ID.
|
|
92
110
|
*/
|
|
93
|
-
handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
111
|
+
handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
+
Promise<any> | any;
|
|
94
114
|
/**
|
|
95
115
|
* Called if a Tool run encounters an error
|
|
96
116
|
*/
|
|
97
|
-
handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]):
|
|
117
|
+
handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]):
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
+
Promise<any> | any;
|
|
98
120
|
/**
|
|
99
121
|
* Called at the end of a Tool run, with the tool output and the run ID.
|
|
100
122
|
*/
|
|
101
|
-
handleToolEnd?(
|
|
123
|
+
handleToolEnd?(
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
|
+
output: any, runId: string, parentRunId?: string, tags?: string[]):
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
+
Promise<any> | any;
|
|
102
128
|
handleText?(text: string, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
|
|
103
129
|
/**
|
|
104
130
|
* Called when an agent is about to execute an action,
|
|
@@ -110,10 +136,22 @@ declare abstract class BaseCallbackHandlerMethodsClass {
|
|
|
110
136
|
* with the final output and the run ID.
|
|
111
137
|
*/
|
|
112
138
|
handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
|
|
113
|
-
handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string):
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
139
|
+
handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string):
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
|
+
Promise<any> | any;
|
|
142
|
+
handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]):
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
144
|
+
Promise<any> | any;
|
|
145
|
+
handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]):
|
|
146
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
147
|
+
Promise<any> | any;
|
|
148
|
+
handleCustomEvent?(eventName: string,
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
|
+
data: any, runId: string, tags?: string[],
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
|
+
metadata?: Record<string, any>):
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
|
+
Promise<any> | any;
|
|
117
155
|
}
|
|
118
156
|
/**
|
|
119
157
|
* Base interface for callbacks. All methods are optional. If a method is not
|
|
@@ -178,7 +216,6 @@ declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsCla
|
|
|
178
216
|
toJSON(): Serialized;
|
|
179
217
|
toJSONNotImplemented(): SerializedNotImplemented;
|
|
180
218
|
static fromMethods(methods: CallbackHandlerMethods): {
|
|
181
|
-
name: string;
|
|
182
219
|
/**
|
|
183
220
|
* Called at the start of an LLM or Chat Model run, with the prompt(s)
|
|
184
221
|
* and the run ID.
|
|
@@ -247,21 +284,21 @@ declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsCla
|
|
|
247
284
|
handleRetrieverError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
|
|
248
285
|
handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[] | undefined, metadata?: Record<string, any> | undefined): any;
|
|
249
286
|
lc_serializable: boolean;
|
|
250
|
-
|
|
251
|
-
|
|
287
|
+
readonly lc_namespace: ["langchain_core", "callbacks", string];
|
|
288
|
+
readonly lc_secrets: {
|
|
252
289
|
[key: string]: string;
|
|
253
290
|
} | undefined;
|
|
254
|
-
|
|
291
|
+
readonly lc_attributes: {
|
|
255
292
|
[key: string]: string;
|
|
256
293
|
} | undefined;
|
|
257
|
-
|
|
294
|
+
readonly lc_aliases: {
|
|
258
295
|
[key: string]: string;
|
|
259
296
|
} | undefined;
|
|
260
|
-
|
|
297
|
+
readonly lc_serializable_keys: string[] | undefined;
|
|
261
298
|
/**
|
|
262
299
|
* The final serialized identifier for the module.
|
|
263
300
|
*/
|
|
264
|
-
|
|
301
|
+
readonly lc_id: string[];
|
|
265
302
|
lc_kwargs: SerializedFields;
|
|
266
303
|
ignoreLLM: boolean;
|
|
267
304
|
ignoreChain: boolean;
|
|
@@ -273,6 +310,7 @@ declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsCla
|
|
|
273
310
|
copy(): BaseCallbackHandler;
|
|
274
311
|
toJSON(): Serialized;
|
|
275
312
|
toJSONNotImplemented(): SerializedNotImplemented;
|
|
313
|
+
name: string;
|
|
276
314
|
};
|
|
277
315
|
}
|
|
278
316
|
declare const isBaseCallbackHandler: (x: unknown) => boolean;
|
package/dist/callbacks/base.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ChainValues } from "../utils/types/index.js";
|
|
|
8
8
|
import { DocumentInterface } from "../documents/document.js";
|
|
9
9
|
|
|
10
10
|
//#region src/callbacks/base.d.ts
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
12
|
type Error = any;
|
|
12
13
|
/**
|
|
13
14
|
* Interface for the input parameters of the BaseCallbackHandler class. It
|
|
@@ -31,6 +32,7 @@ interface NewTokenIndices {
|
|
|
31
32
|
prompt: number;
|
|
32
33
|
completion: number;
|
|
33
34
|
}
|
|
35
|
+
// TODO: Add all additional callback fields here
|
|
34
36
|
type HandleLLMNewTokenCallbackFields = {
|
|
35
37
|
chunk?: GenerationChunk | ChatGenerationChunk;
|
|
36
38
|
};
|
|
@@ -44,7 +46,9 @@ declare abstract class BaseCallbackHandlerMethodsClass {
|
|
|
44
46
|
* Called at the start of an LLM or Chat Model run, with the prompt(s)
|
|
45
47
|
* and the run ID.
|
|
46
48
|
*/
|
|
47
|
-
handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
49
|
+
handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
Promise<any> | any;
|
|
48
52
|
/**
|
|
49
53
|
* Called when an LLM/ChatModel in `streaming` mode produces a new token
|
|
50
54
|
*/
|
|
@@ -55,50 +59,72 @@ declare abstract class BaseCallbackHandlerMethodsClass {
|
|
|
55
59
|
* idx.completion is the index of the completion that produced the token
|
|
56
60
|
* (if multiple completions per prompt are requested)
|
|
57
61
|
*/
|
|
58
|
-
idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields):
|
|
62
|
+
idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields):
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
+
Promise<any> | any;
|
|
59
65
|
/**
|
|
60
66
|
* Called if an LLM/ChatModel run encounters an error
|
|
61
67
|
*/
|
|
62
|
-
handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>):
|
|
68
|
+
handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>):
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
Promise<any> | any;
|
|
63
71
|
/**
|
|
64
72
|
* Called at the end of an LLM/ChatModel run, with the output and the run ID.
|
|
65
73
|
*/
|
|
66
|
-
handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>):
|
|
74
|
+
handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>):
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
Promise<any> | any;
|
|
67
77
|
/**
|
|
68
78
|
* Called at the start of a Chat Model run, with the prompt(s)
|
|
69
79
|
* and the run ID.
|
|
70
80
|
*/
|
|
71
|
-
handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
81
|
+
handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
Promise<any> | any;
|
|
72
84
|
/**
|
|
73
85
|
* Called at the start of a Chain run, with the chain name and inputs
|
|
74
86
|
* and the run ID.
|
|
75
87
|
*/
|
|
76
|
-
handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runType?: string, runName?: string):
|
|
88
|
+
handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runType?: string, runName?: string):
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
|
+
Promise<any> | any;
|
|
77
91
|
/**
|
|
78
92
|
* Called if a Chain run encounters an error
|
|
79
93
|
*/
|
|
80
94
|
handleChainError?(err: Error, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
|
|
81
95
|
inputs?: Record<string, unknown>;
|
|
82
|
-
}):
|
|
96
|
+
}):
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
+
Promise<any> | any;
|
|
83
99
|
/**
|
|
84
100
|
* Called at the end of a Chain run, with the outputs and the run ID.
|
|
85
101
|
*/
|
|
86
102
|
handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
|
|
87
103
|
inputs?: Record<string, unknown>;
|
|
88
|
-
}):
|
|
104
|
+
}):
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
|
+
Promise<any> | any;
|
|
89
107
|
/**
|
|
90
108
|
* Called at the start of a Tool run, with the tool name and input
|
|
91
109
|
* and the run ID.
|
|
92
110
|
*/
|
|
93
|
-
handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
111
|
+
handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string):
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
+
Promise<any> | any;
|
|
94
114
|
/**
|
|
95
115
|
* Called if a Tool run encounters an error
|
|
96
116
|
*/
|
|
97
|
-
handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]):
|
|
117
|
+
handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]):
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
+
Promise<any> | any;
|
|
98
120
|
/**
|
|
99
121
|
* Called at the end of a Tool run, with the tool output and the run ID.
|
|
100
122
|
*/
|
|
101
|
-
handleToolEnd?(
|
|
123
|
+
handleToolEnd?(
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
|
+
output: any, runId: string, parentRunId?: string, tags?: string[]):
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
+
Promise<any> | any;
|
|
102
128
|
handleText?(text: string, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
|
|
103
129
|
/**
|
|
104
130
|
* Called when an agent is about to execute an action,
|
|
@@ -110,10 +136,22 @@ declare abstract class BaseCallbackHandlerMethodsClass {
|
|
|
110
136
|
* with the final output and the run ID.
|
|
111
137
|
*/
|
|
112
138
|
handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
|
|
113
|
-
handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string):
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
139
|
+
handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string):
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
|
+
Promise<any> | any;
|
|
142
|
+
handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]):
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
144
|
+
Promise<any> | any;
|
|
145
|
+
handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]):
|
|
146
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
147
|
+
Promise<any> | any;
|
|
148
|
+
handleCustomEvent?(eventName: string,
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
|
+
data: any, runId: string, tags?: string[],
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
|
+
metadata?: Record<string, any>):
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
|
+
Promise<any> | any;
|
|
117
155
|
}
|
|
118
156
|
/**
|
|
119
157
|
* Base interface for callbacks. All methods are optional. If a method is not
|
|
@@ -178,7 +216,6 @@ declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsCla
|
|
|
178
216
|
toJSON(): Serialized;
|
|
179
217
|
toJSONNotImplemented(): SerializedNotImplemented;
|
|
180
218
|
static fromMethods(methods: CallbackHandlerMethods): {
|
|
181
|
-
name: string;
|
|
182
219
|
/**
|
|
183
220
|
* Called at the start of an LLM or Chat Model run, with the prompt(s)
|
|
184
221
|
* and the run ID.
|
|
@@ -247,21 +284,21 @@ declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsCla
|
|
|
247
284
|
handleRetrieverError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
|
|
248
285
|
handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[] | undefined, metadata?: Record<string, any> | undefined): any;
|
|
249
286
|
lc_serializable: boolean;
|
|
250
|
-
|
|
251
|
-
|
|
287
|
+
readonly lc_namespace: ["langchain_core", "callbacks", string];
|
|
288
|
+
readonly lc_secrets: {
|
|
252
289
|
[key: string]: string;
|
|
253
290
|
} | undefined;
|
|
254
|
-
|
|
291
|
+
readonly lc_attributes: {
|
|
255
292
|
[key: string]: string;
|
|
256
293
|
} | undefined;
|
|
257
|
-
|
|
294
|
+
readonly lc_aliases: {
|
|
258
295
|
[key: string]: string;
|
|
259
296
|
} | undefined;
|
|
260
|
-
|
|
297
|
+
readonly lc_serializable_keys: string[] | undefined;
|
|
261
298
|
/**
|
|
262
299
|
* The final serialized identifier for the module.
|
|
263
300
|
*/
|
|
264
|
-
|
|
301
|
+
readonly lc_id: string[];
|
|
265
302
|
lc_kwargs: SerializedFields;
|
|
266
303
|
ignoreLLM: boolean;
|
|
267
304
|
ignoreChain: boolean;
|
|
@@ -273,6 +310,7 @@ declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsCla
|
|
|
273
310
|
copy(): BaseCallbackHandler;
|
|
274
311
|
toJSON(): Serialized;
|
|
275
312
|
toJSONNotImplemented(): SerializedNotImplemented;
|
|
313
|
+
name: string;
|
|
276
314
|
};
|
|
277
315
|
}
|
|
278
316
|
declare const isBaseCallbackHandler: (x: unknown) => boolean;
|
|
@@ -35,7 +35,9 @@ import { RunnableConfig } from "../../runnables/types.cjs";
|
|
|
35
35
|
* await foo.invoke("hi", { callbacks })
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
declare function dispatchCustomEvent(eventName: string,
|
|
38
|
+
declare function dispatchCustomEvent(eventName: string,
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
payload: any, config?: RunnableConfig): Promise<void>;
|
|
39
41
|
//#endregion
|
|
40
42
|
export { dispatchCustomEvent };
|
|
41
43
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -36,7 +36,9 @@ import "../../runnables/config.js";
|
|
|
36
36
|
* await foo.invoke("hi", { callbacks })
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
declare function dispatchCustomEvent(eventName: string,
|
|
39
|
+
declare function dispatchCustomEvent(eventName: string,
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
payload: any, config?: RunnableConfig): Promise<void>;
|
|
40
42
|
//#endregion
|
|
41
43
|
export { dispatchCustomEvent };
|
|
42
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -32,7 +32,9 @@ import { RunnableConfig } from "../../runnables/types.cjs";
|
|
|
32
32
|
* await foo.invoke("hi", { callbacks })
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
declare function dispatchCustomEvent(name: string,
|
|
35
|
+
declare function dispatchCustomEvent(name: string,
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
|
+
payload: any, config?: RunnableConfig): Promise<void>;
|
|
36
38
|
//#endregion
|
|
37
39
|
export { dispatchCustomEvent };
|
|
38
40
|
//# sourceMappingURL=web.d.cts.map
|
|
@@ -33,7 +33,9 @@ import "../../runnables/config.js";
|
|
|
33
33
|
* await foo.invoke("hi", { callbacks })
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
declare function dispatchCustomEvent(name: string,
|
|
36
|
+
declare function dispatchCustomEvent(name: string,
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
payload: any, config?: RunnableConfig): Promise<void>;
|
|
37
39
|
//#endregion
|
|
38
40
|
export { dispatchCustomEvent };
|
|
39
41
|
//# sourceMappingURL=web.d.ts.map
|
|
@@ -64,7 +64,11 @@ declare class BaseRunManager {
|
|
|
64
64
|
constructor(runId: string, handlers: BaseCallbackHandler[], inheritableHandlers: BaseCallbackHandler[], tags: string[], inheritableTags: string[], metadata: Record<string, unknown>, inheritableMetadata: Record<string, unknown>, _parentRunId?: string | undefined);
|
|
65
65
|
get parentRunId(): string | undefined;
|
|
66
66
|
handleText(text: string): Promise<void>;
|
|
67
|
-
handleCustomEvent(eventName: string,
|
|
67
|
+
handleCustomEvent(eventName: string,
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
+
data: any, _runId?: string, _tags?: string[],
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
+
_metadata?: Record<string, any>): Promise<void>;
|
|
68
72
|
}
|
|
69
73
|
/**
|
|
70
74
|
* Manages callbacks for retriever runs.
|
|
@@ -93,6 +97,7 @@ declare class CallbackManagerForChainRun extends BaseRunManager implements BaseC
|
|
|
93
97
|
declare class CallbackManagerForToolRun extends BaseRunManager implements BaseCallbackManagerMethods {
|
|
94
98
|
getChild(tag?: string): CallbackManager;
|
|
95
99
|
handleToolError(err: Error | unknown): Promise<void>;
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
101
|
handleToolEnd(output: any): Promise<void>;
|
|
97
102
|
}
|
|
98
103
|
/**
|
|
@@ -141,7 +146,11 @@ declare class CallbackManager extends BaseCallbackManager implements BaseCallbac
|
|
|
141
146
|
handleChainStart(chain: Serialized, inputs: ChainValues, runId?: string, runType?: string | undefined, _tags?: string[] | undefined, _metadata?: Record<string, unknown> | undefined, runName?: string | undefined): Promise<CallbackManagerForChainRun>;
|
|
142
147
|
handleToolStart(tool: Serialized, input: string, runId?: string, _parentRunId?: string | undefined, _tags?: string[] | undefined, _metadata?: Record<string, unknown> | undefined, runName?: string | undefined): Promise<CallbackManagerForToolRun>;
|
|
143
148
|
handleRetrieverStart(retriever: Serialized, query: string, runId?: string, _parentRunId?: string | undefined, _tags?: string[] | undefined, _metadata?: Record<string, unknown> | undefined, runName?: string | undefined): Promise<CallbackManagerForRetrieverRun>;
|
|
144
|
-
handleCustomEvent?(eventName: string,
|
|
149
|
+
handleCustomEvent?(eventName: string,
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
151
|
+
data: any, runId: string, _tags?: string[],
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
153
|
+
_metadata?: Record<string, any>): Promise<any>;
|
|
145
154
|
addHandler(handler: BaseCallbackHandler, inherit?: boolean): void;
|
|
146
155
|
removeHandler(handler: BaseCallbackHandler): void;
|
|
147
156
|
setHandlers(handlers: BaseCallbackHandler[], inherit?: boolean): void;
|
|
@@ -152,6 +161,7 @@ declare class CallbackManager extends BaseCallbackManager implements BaseCallbac
|
|
|
152
161
|
copy(additionalHandlers?: BaseCallbackHandler[], inherit?: boolean): CallbackManager;
|
|
153
162
|
static fromHandlers(handlers: CallbackHandlerMethods): CallbackManager;
|
|
154
163
|
static configure(inheritableHandlers?: Callbacks, localHandlers?: Callbacks, inheritableTags?: string[], localTags?: string[], inheritableMetadata?: Record<string, unknown>, localMetadata?: Record<string, unknown>, options?: CallbackManagerOptions): CallbackManager | undefined;
|
|
164
|
+
// TODO: Deprecate async method in favor of this one.
|
|
155
165
|
static _configureSync(inheritableHandlers?: Callbacks, localHandlers?: Callbacks, inheritableTags?: string[], localTags?: string[], inheritableMetadata?: Record<string, unknown>, localMetadata?: Record<string, unknown>, options?: CallbackManagerOptions): CallbackManager | undefined;
|
|
156
166
|
}
|
|
157
167
|
declare function ensureHandler(handler: BaseCallbackHandler | CallbackHandlerMethods): BaseCallbackHandler;
|
|
@@ -64,7 +64,11 @@ declare class BaseRunManager {
|
|
|
64
64
|
constructor(runId: string, handlers: BaseCallbackHandler[], inheritableHandlers: BaseCallbackHandler[], tags: string[], inheritableTags: string[], metadata: Record<string, unknown>, inheritableMetadata: Record<string, unknown>, _parentRunId?: string | undefined);
|
|
65
65
|
get parentRunId(): string | undefined;
|
|
66
66
|
handleText(text: string): Promise<void>;
|
|
67
|
-
handleCustomEvent(eventName: string,
|
|
67
|
+
handleCustomEvent(eventName: string,
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
+
data: any, _runId?: string, _tags?: string[],
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
+
_metadata?: Record<string, any>): Promise<void>;
|
|
68
72
|
}
|
|
69
73
|
/**
|
|
70
74
|
* Manages callbacks for retriever runs.
|
|
@@ -93,6 +97,7 @@ declare class CallbackManagerForChainRun extends BaseRunManager implements BaseC
|
|
|
93
97
|
declare class CallbackManagerForToolRun extends BaseRunManager implements BaseCallbackManagerMethods {
|
|
94
98
|
getChild(tag?: string): CallbackManager;
|
|
95
99
|
handleToolError(err: Error | unknown): Promise<void>;
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
101
|
handleToolEnd(output: any): Promise<void>;
|
|
97
102
|
}
|
|
98
103
|
/**
|
|
@@ -141,7 +146,11 @@ declare class CallbackManager extends BaseCallbackManager implements BaseCallbac
|
|
|
141
146
|
handleChainStart(chain: Serialized, inputs: ChainValues, runId?: string, runType?: string | undefined, _tags?: string[] | undefined, _metadata?: Record<string, unknown> | undefined, runName?: string | undefined): Promise<CallbackManagerForChainRun>;
|
|
142
147
|
handleToolStart(tool: Serialized, input: string, runId?: string, _parentRunId?: string | undefined, _tags?: string[] | undefined, _metadata?: Record<string, unknown> | undefined, runName?: string | undefined): Promise<CallbackManagerForToolRun>;
|
|
143
148
|
handleRetrieverStart(retriever: Serialized, query: string, runId?: string, _parentRunId?: string | undefined, _tags?: string[] | undefined, _metadata?: Record<string, unknown> | undefined, runName?: string | undefined): Promise<CallbackManagerForRetrieverRun>;
|
|
144
|
-
handleCustomEvent?(eventName: string,
|
|
149
|
+
handleCustomEvent?(eventName: string,
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
151
|
+
data: any, runId: string, _tags?: string[],
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
153
|
+
_metadata?: Record<string, any>): Promise<any>;
|
|
145
154
|
addHandler(handler: BaseCallbackHandler, inherit?: boolean): void;
|
|
146
155
|
removeHandler(handler: BaseCallbackHandler): void;
|
|
147
156
|
setHandlers(handlers: BaseCallbackHandler[], inherit?: boolean): void;
|
|
@@ -152,6 +161,7 @@ declare class CallbackManager extends BaseCallbackManager implements BaseCallbac
|
|
|
152
161
|
copy(additionalHandlers?: BaseCallbackHandler[], inherit?: boolean): CallbackManager;
|
|
153
162
|
static fromHandlers(handlers: CallbackHandlerMethods): CallbackManager;
|
|
154
163
|
static configure(inheritableHandlers?: Callbacks, localHandlers?: Callbacks, inheritableTags?: string[], localTags?: string[], inheritableMetadata?: Record<string, unknown>, localMetadata?: Record<string, unknown>, options?: CallbackManagerOptions): CallbackManager | undefined;
|
|
164
|
+
// TODO: Deprecate async method in favor of this one.
|
|
155
165
|
static _configureSync(inheritableHandlers?: Callbacks, localHandlers?: Callbacks, inheritableTags?: string[], localTags?: string[], inheritableMetadata?: Record<string, unknown>, localMetadata?: Record<string, unknown>, options?: CallbackManagerOptions): CallbackManager | undefined;
|
|
156
166
|
}
|
|
157
167
|
declare function ensureHandler(handler: BaseCallbackHandler | CallbackHandlerMethods): BaseCallbackHandler;
|
package/dist/chat_history.d.cts
CHANGED
package/dist/chat_history.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { KVMap } from "langsmith/schemas";
|
|
|
5
5
|
import { Client } from "langsmith";
|
|
6
6
|
|
|
7
7
|
//#region src/document_loaders/langsmith.d.ts
|
|
8
|
+
// TODO: Replace with import from `langsmith` once exposed.
|
|
8
9
|
interface ClientConfig {
|
|
9
10
|
apiUrl?: string;
|
|
10
11
|
apiKey?: string;
|
|
@@ -30,6 +31,7 @@ interface LangSmithLoaderFields {
|
|
|
30
31
|
metadata?: KVMap;
|
|
31
32
|
filter?: string;
|
|
32
33
|
contentKey?: string;
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
35
|
formatContent?: (content: any) => string;
|
|
34
36
|
client?: Client;
|
|
35
37
|
clientConfig?: ClientConfig;
|
|
@@ -90,6 +92,7 @@ declare class LangSmithLoader extends BaseDocumentLoader {
|
|
|
90
92
|
metadata?: KVMap;
|
|
91
93
|
filter?: string;
|
|
92
94
|
contentKey: string[];
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
96
|
formatContent: (content: any) => string;
|
|
94
97
|
client: Client;
|
|
95
98
|
constructor(fields: LangSmithLoaderFields);
|
|
@@ -5,6 +5,7 @@ import { Client } from "langsmith";
|
|
|
5
5
|
import { KVMap } from "langsmith/schemas";
|
|
6
6
|
|
|
7
7
|
//#region src/document_loaders/langsmith.d.ts
|
|
8
|
+
// TODO: Replace with import from `langsmith` once exposed.
|
|
8
9
|
interface ClientConfig {
|
|
9
10
|
apiUrl?: string;
|
|
10
11
|
apiKey?: string;
|
|
@@ -30,6 +31,7 @@ interface LangSmithLoaderFields {
|
|
|
30
31
|
metadata?: KVMap;
|
|
31
32
|
filter?: string;
|
|
32
33
|
contentKey?: string;
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
35
|
formatContent?: (content: any) => string;
|
|
34
36
|
client?: Client;
|
|
35
37
|
clientConfig?: ClientConfig;
|
|
@@ -90,6 +92,7 @@ declare class LangSmithLoader extends BaseDocumentLoader {
|
|
|
90
92
|
metadata?: KVMap;
|
|
91
93
|
filter?: string;
|
|
92
94
|
contentKey: string[];
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
96
|
formatContent: (content: any) => string;
|
|
94
97
|
client: Client;
|
|
95
98
|
constructor(fields: LangSmithLoaderFields);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
//#region src/documents/document.d.ts
|
|
2
|
-
interface DocumentInput<
|
|
2
|
+
interface DocumentInput<
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
Metadata extends Record<string, any> = Record<string, any>> {
|
|
3
5
|
pageContent: string;
|
|
4
6
|
metadata?: Metadata;
|
|
5
7
|
/**
|
|
@@ -10,7 +12,9 @@ interface DocumentInput<Metadata extends Record<string, any> = Record<string, an
|
|
|
10
12
|
*/
|
|
11
13
|
id?: string;
|
|
12
14
|
}
|
|
13
|
-
interface DocumentInterface<
|
|
15
|
+
interface DocumentInterface<
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
Metadata extends Record<string, any> = Record<string, any>> {
|
|
14
18
|
pageContent: string;
|
|
15
19
|
metadata: Metadata;
|
|
16
20
|
/**
|
|
@@ -24,9 +28,14 @@ interface DocumentInterface<Metadata extends Record<string, any> = Record<string
|
|
|
24
28
|
/**
|
|
25
29
|
* Interface for interacting with a document.
|
|
26
30
|
*/
|
|
27
|
-
declare class Document<
|
|
31
|
+
declare class Document<
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {
|
|
28
34
|
pageContent: string;
|
|
29
35
|
metadata: Metadata;
|
|
36
|
+
// The ID field is optional at the moment.
|
|
37
|
+
// It will likely become required in a future major release after
|
|
38
|
+
// it has been adopted by enough vectorstore implementations.
|
|
30
39
|
/**
|
|
31
40
|
* An optional identifier for the document.
|
|
32
41
|
*
|