@langchain/core 1.1.6 → 1.2.0-dev-1765937705265
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/caches/index.d.cts +2 -2
- package/dist/caches/index.d.cts.map +1 -1
- package/dist/caches/index.d.ts +2 -2
- package/dist/caches/index.d.ts.map +1 -1
- package/dist/callbacks/base.d.cts +2 -2
- package/dist/callbacks/base.d.cts.map +1 -1
- package/dist/callbacks/base.d.ts +2 -2
- package/dist/callbacks/base.d.ts.map +1 -1
- package/dist/messages/ai.cjs +13 -9
- package/dist/messages/ai.cjs.map +1 -1
- package/dist/messages/ai.d.cts +25 -5
- package/dist/messages/ai.d.cts.map +1 -1
- package/dist/messages/ai.d.ts +25 -5
- package/dist/messages/ai.d.ts.map +1 -1
- package/dist/messages/ai.js +13 -9
- package/dist/messages/ai.js.map +1 -1
- package/dist/messages/base.cjs.map +1 -1
- package/dist/messages/base.js.map +1 -1
- package/dist/messages/index.d.cts +2 -2
- package/dist/messages/index.d.ts +2 -2
- package/dist/messages/message.cjs.map +1 -1
- package/dist/messages/message.d.cts +62 -6
- package/dist/messages/message.d.cts.map +1 -1
- package/dist/messages/message.d.ts +62 -6
- package/dist/messages/message.d.ts.map +1 -1
- package/dist/messages/message.js.map +1 -1
- package/dist/messages/tool.cjs.map +1 -1
- package/dist/messages/tool.d.cts +10 -0
- package/dist/messages/tool.d.cts.map +1 -1
- package/dist/messages/tool.d.ts +10 -0
- package/dist/messages/tool.d.ts.map +1 -1
- package/dist/messages/tool.js.map +1 -1
- package/dist/messages/utils.d.cts +3 -3
- package/dist/messages/utils.d.cts.map +1 -1
- package/dist/messages/utils.d.ts +3 -3
- package/dist/messages/utils.d.ts.map +1 -1
- package/dist/prompt_values.d.cts +4 -4
- package/dist/prompt_values.d.cts.map +1 -1
- package/dist/prompt_values.d.ts +4 -4
- package/dist/prompt_values.d.ts.map +1 -1
- package/dist/prompts/chat.d.cts +2 -2
- package/dist/prompts/chat.d.cts.map +1 -1
- package/dist/prompts/chat.d.ts +2 -2
- package/dist/prompts/chat.d.ts.map +1 -1
- package/dist/stores.d.cts.map +1 -1
- package/dist/stores.d.ts.map +1 -1
- package/dist/tools/index.cjs +2 -1
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.cts +17 -12
- package/dist/tools/index.d.cts.map +1 -1
- package/dist/tools/index.d.ts +17 -12
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/utils/event_source_parse.d.cts.map +1 -1
- package/dist/utils/stream.d.cts.map +1 -1
- package/dist/utils/testing/chat_models.d.cts +4 -4
- package/dist/utils/testing/chat_models.d.cts.map +1 -1
- package/dist/utils/testing/chat_models.d.ts +4 -4
- package/dist/utils/testing/chat_models.d.ts.map +1 -1
- package/package.json +2 -2
- package/agents.cjs +0 -1
- package/agents.d.cts +0 -1
- package/agents.d.ts +0 -1
- package/agents.js +0 -1
- package/caches.cjs +0 -1
- package/caches.d.cts +0 -1
- package/caches.d.ts +0 -1
- package/caches.js +0 -1
- package/callbacks/base.cjs +0 -1
- package/callbacks/base.d.cts +0 -1
- package/callbacks/base.d.ts +0 -1
- package/callbacks/base.js +0 -1
- package/callbacks/dispatch/web.cjs +0 -1
- package/callbacks/dispatch/web.d.cts +0 -1
- package/callbacks/dispatch/web.d.ts +0 -1
- package/callbacks/dispatch/web.js +0 -1
- package/callbacks/dispatch.cjs +0 -1
- package/callbacks/dispatch.d.cts +0 -1
- package/callbacks/dispatch.d.ts +0 -1
- package/callbacks/dispatch.js +0 -1
- package/callbacks/manager.cjs +0 -1
- package/callbacks/manager.d.cts +0 -1
- package/callbacks/manager.d.ts +0 -1
- package/callbacks/manager.js +0 -1
- package/callbacks/promises.cjs +0 -1
- package/callbacks/promises.d.cts +0 -1
- package/callbacks/promises.d.ts +0 -1
- package/callbacks/promises.js +0 -1
- package/chat_history.cjs +0 -1
- package/chat_history.d.cts +0 -1
- package/chat_history.d.ts +0 -1
- package/chat_history.js +0 -1
- package/context.cjs +0 -1
- package/context.d.cts +0 -1
- package/context.d.ts +0 -1
- package/context.js +0 -1
- package/document_loaders/base.cjs +0 -1
- package/document_loaders/base.d.cts +0 -1
- package/document_loaders/base.d.ts +0 -1
- package/document_loaders/base.js +0 -1
- package/document_loaders/langsmith.cjs +0 -1
- package/document_loaders/langsmith.d.cts +0 -1
- package/document_loaders/langsmith.d.ts +0 -1
- package/document_loaders/langsmith.js +0 -1
- package/documents.cjs +0 -1
- package/documents.d.cts +0 -1
- package/documents.d.ts +0 -1
- package/documents.js +0 -1
- package/embeddings.cjs +0 -1
- package/embeddings.d.cts +0 -1
- package/embeddings.d.ts +0 -1
- package/embeddings.js +0 -1
- package/example_selectors.cjs +0 -1
- package/example_selectors.d.cts +0 -1
- package/example_selectors.d.ts +0 -1
- package/example_selectors.js +0 -1
- package/indexing.cjs +0 -1
- package/indexing.d.cts +0 -1
- package/indexing.d.ts +0 -1
- package/indexing.js +0 -1
- package/language_models/base.cjs +0 -1
- package/language_models/base.d.cts +0 -1
- package/language_models/base.d.ts +0 -1
- package/language_models/base.js +0 -1
- package/language_models/chat_models.cjs +0 -1
- package/language_models/chat_models.d.cts +0 -1
- package/language_models/chat_models.d.ts +0 -1
- package/language_models/chat_models.js +0 -1
- package/language_models/llms.cjs +0 -1
- package/language_models/llms.d.cts +0 -1
- package/language_models/llms.d.ts +0 -1
- package/language_models/llms.js +0 -1
- package/language_models/profile.cjs +0 -1
- package/language_models/profile.d.cts +0 -1
- package/language_models/profile.d.ts +0 -1
- package/language_models/profile.js +0 -1
- package/load/serializable.cjs +0 -1
- package/load/serializable.d.cts +0 -1
- package/load/serializable.d.ts +0 -1
- package/load/serializable.js +0 -1
- package/load.cjs +0 -1
- package/load.d.cts +0 -1
- package/load.d.ts +0 -1
- package/load.js +0 -1
- package/memory.cjs +0 -1
- package/memory.d.cts +0 -1
- package/memory.d.ts +0 -1
- package/memory.js +0 -1
- package/messages/tool.cjs +0 -1
- package/messages/tool.d.cts +0 -1
- package/messages/tool.d.ts +0 -1
- package/messages/tool.js +0 -1
- package/messages.cjs +0 -1
- package/messages.d.cts +0 -1
- package/messages.d.ts +0 -1
- package/messages.js +0 -1
- package/output_parsers/openai_functions.cjs +0 -1
- package/output_parsers/openai_functions.d.cts +0 -1
- package/output_parsers/openai_functions.d.ts +0 -1
- package/output_parsers/openai_functions.js +0 -1
- package/output_parsers/openai_tools.cjs +0 -1
- package/output_parsers/openai_tools.d.cts +0 -1
- package/output_parsers/openai_tools.d.ts +0 -1
- package/output_parsers/openai_tools.js +0 -1
- package/output_parsers.cjs +0 -1
- package/output_parsers.d.cts +0 -1
- package/output_parsers.d.ts +0 -1
- package/output_parsers.js +0 -1
- package/outputs.cjs +0 -1
- package/outputs.d.cts +0 -1
- package/outputs.d.ts +0 -1
- package/outputs.js +0 -1
- package/prompt_values.cjs +0 -1
- package/prompt_values.d.cts +0 -1
- package/prompt_values.d.ts +0 -1
- package/prompt_values.js +0 -1
- package/prompts.cjs +0 -1
- package/prompts.d.cts +0 -1
- package/prompts.d.ts +0 -1
- package/prompts.js +0 -1
- package/retrievers/document_compressors.cjs +0 -1
- package/retrievers/document_compressors.d.cts +0 -1
- package/retrievers/document_compressors.d.ts +0 -1
- package/retrievers/document_compressors.js +0 -1
- package/retrievers.cjs +0 -1
- package/retrievers.d.cts +0 -1
- package/retrievers.d.ts +0 -1
- package/retrievers.js +0 -1
- package/runnables/graph.cjs +0 -1
- package/runnables/graph.d.cts +0 -1
- package/runnables/graph.d.ts +0 -1
- package/runnables/graph.js +0 -1
- package/runnables.cjs +0 -1
- package/runnables.d.cts +0 -1
- package/runnables.d.ts +0 -1
- package/runnables.js +0 -1
- package/singletons.cjs +0 -1
- package/singletons.d.cts +0 -1
- package/singletons.d.ts +0 -1
- package/singletons.js +0 -1
- package/stores.cjs +0 -1
- package/stores.d.cts +0 -1
- package/stores.d.ts +0 -1
- package/stores.js +0 -1
- package/structured_query.cjs +0 -1
- package/structured_query.d.cts +0 -1
- package/structured_query.d.ts +0 -1
- package/structured_query.js +0 -1
- package/tools.cjs +0 -1
- package/tools.d.cts +0 -1
- package/tools.d.ts +0 -1
- package/tools.js +0 -1
- package/tracers/base.cjs +0 -1
- package/tracers/base.d.cts +0 -1
- package/tracers/base.d.ts +0 -1
- package/tracers/base.js +0 -1
- package/tracers/console.cjs +0 -1
- package/tracers/console.d.cts +0 -1
- package/tracers/console.d.ts +0 -1
- package/tracers/console.js +0 -1
- package/tracers/log_stream.cjs +0 -1
- package/tracers/log_stream.d.cts +0 -1
- package/tracers/log_stream.d.ts +0 -1
- package/tracers/log_stream.js +0 -1
- package/tracers/run_collector.cjs +0 -1
- package/tracers/run_collector.d.cts +0 -1
- package/tracers/run_collector.d.ts +0 -1
- package/tracers/run_collector.js +0 -1
- package/tracers/tracer_langchain.cjs +0 -1
- package/tracers/tracer_langchain.d.cts +0 -1
- package/tracers/tracer_langchain.d.ts +0 -1
- package/tracers/tracer_langchain.js +0 -1
- package/types/stream.cjs +0 -1
- package/types/stream.d.cts +0 -1
- package/types/stream.d.ts +0 -1
- package/types/stream.js +0 -1
- package/utils/async_caller.cjs +0 -1
- package/utils/async_caller.d.cts +0 -1
- package/utils/async_caller.d.ts +0 -1
- package/utils/async_caller.js +0 -1
- package/utils/chunk_array.cjs +0 -1
- package/utils/chunk_array.d.cts +0 -1
- package/utils/chunk_array.d.ts +0 -1
- package/utils/chunk_array.js +0 -1
- package/utils/env.cjs +0 -1
- package/utils/env.d.cts +0 -1
- package/utils/env.d.ts +0 -1
- package/utils/env.js +0 -1
- package/utils/event_source_parse.cjs +0 -1
- package/utils/event_source_parse.d.cts +0 -1
- package/utils/event_source_parse.d.ts +0 -1
- package/utils/event_source_parse.js +0 -1
- package/utils/format.cjs +0 -1
- package/utils/format.d.cts +0 -1
- package/utils/format.d.ts +0 -1
- package/utils/format.js +0 -1
- package/utils/function_calling.cjs +0 -1
- package/utils/function_calling.d.cts +0 -1
- package/utils/function_calling.d.ts +0 -1
- package/utils/function_calling.js +0 -1
- package/utils/hash.cjs +0 -1
- package/utils/hash.d.cts +0 -1
- package/utils/hash.d.ts +0 -1
- package/utils/hash.js +0 -1
- package/utils/json_patch.cjs +0 -1
- package/utils/json_patch.d.cts +0 -1
- package/utils/json_patch.d.ts +0 -1
- package/utils/json_patch.js +0 -1
- package/utils/json_schema.cjs +0 -1
- package/utils/json_schema.d.cts +0 -1
- package/utils/json_schema.d.ts +0 -1
- package/utils/json_schema.js +0 -1
- package/utils/math.cjs +0 -1
- package/utils/math.d.cts +0 -1
- package/utils/math.d.ts +0 -1
- package/utils/math.js +0 -1
- package/utils/stream.cjs +0 -1
- package/utils/stream.d.cts +0 -1
- package/utils/stream.d.ts +0 -1
- package/utils/stream.js +0 -1
- package/utils/testing.cjs +0 -1
- package/utils/testing.d.cts +0 -1
- package/utils/testing.d.ts +0 -1
- package/utils/testing.js +0 -1
- package/utils/tiktoken.cjs +0 -1
- package/utils/tiktoken.d.cts +0 -1
- package/utils/tiktoken.d.ts +0 -1
- package/utils/tiktoken.js +0 -1
- package/utils/types.cjs +0 -1
- package/utils/types.d.cts +0 -1
- package/utils/types.d.ts +0 -1
- package/utils/types.js +0 -1
- package/vectorstores.cjs +0 -1
- package/vectorstores.d.cts +0 -1
- package/vectorstores.d.ts +0 -1
- package/vectorstores.js +0 -1
package/dist/tools/index.d.ts
CHANGED
|
@@ -122,14 +122,18 @@ declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT
|
|
|
122
122
|
*
|
|
123
123
|
* Schema can be passed as Zod or JSON schema. The tool will not validate
|
|
124
124
|
* input if JSON schema is passed.
|
|
125
|
+
*
|
|
126
|
+
* @template NameT The literal type of the tool name (for discriminated union support)
|
|
125
127
|
*/
|
|
126
|
-
declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {
|
|
128
|
+
declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, NameT extends string = string> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {
|
|
127
129
|
static lc_name(): string;
|
|
128
|
-
name:
|
|
130
|
+
name: NameT;
|
|
129
131
|
description: string;
|
|
130
132
|
func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>["func"];
|
|
131
133
|
schema: SchemaT;
|
|
132
|
-
constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>
|
|
134
|
+
constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT> & {
|
|
135
|
+
name: NameT;
|
|
136
|
+
});
|
|
133
137
|
/**
|
|
134
138
|
* @deprecated Use .invoke() instead. Will be removed in 0.3.0.
|
|
135
139
|
*/
|
|
@@ -151,13 +155,14 @@ declare abstract class BaseToolkit {
|
|
|
151
155
|
* Schema can be provided as Zod or JSON schema.
|
|
152
156
|
* Both schema types will be validated.
|
|
153
157
|
* @template {ToolInputSchemaBase} RunInput The input schema for the tool.
|
|
158
|
+
* @template {string} NameT The literal name type for discriminated union support.
|
|
154
159
|
*/
|
|
155
|
-
interface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined> extends ToolParams {
|
|
160
|
+
interface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined, NameT extends string = string> extends ToolParams {
|
|
156
161
|
/**
|
|
157
162
|
* The name of the tool. If using with an LLM, this
|
|
158
163
|
* will be passed as the tool name.
|
|
159
164
|
*/
|
|
160
|
-
name:
|
|
165
|
+
name: NameT;
|
|
161
166
|
/**
|
|
162
167
|
* The description of the tool.
|
|
163
168
|
* @default `${fields.name} tool`
|
|
@@ -206,15 +211,15 @@ interface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined> extends
|
|
|
206
211
|
*/
|
|
207
212
|
declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
|
|
208
213
|
declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
|
|
209
|
-
declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
210
|
-
declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
211
|
-
declare function tool<SchemaT extends JsonSchema7Type, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
212
|
-
declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JsonSchema7Type = InteropZodObject, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> | DynamicTool<ToolOutputT>;
|
|
214
|
+
declare function tool<SchemaT extends ZodObjectV3, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
|
|
215
|
+
declare function tool<SchemaT extends ZodObjectV4, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
|
|
216
|
+
declare function tool<SchemaT extends JsonSchema7Type, NameT extends string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
|
|
217
|
+
declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JsonSchema7Type = InteropZodObject, NameT extends string = string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT> | DynamicTool<ToolOutputT>;
|
|
213
218
|
declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
|
|
214
219
|
declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
|
|
215
|
-
declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
216
|
-
declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
217
|
-
declare function tool<SchemaT extends JsonSchema7Type, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
220
|
+
declare function tool<SchemaT extends ZodObjectV3, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
|
|
221
|
+
declare function tool<SchemaT extends ZodObjectV4, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
|
|
222
|
+
declare function tool<SchemaT extends JsonSchema7Type, NameT extends string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
|
|
218
223
|
type ServerTool = Record<string, unknown>;
|
|
219
224
|
type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;
|
|
220
225
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","RunnableToolLike","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","InteropZodObject","InteropZodType","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","ToolRuntime","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","TInput","TConfig","TArg","SchemaT","SchemaOutputT","SchemaInputT","ToolOutputT","Record","Promise","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool","TState","TContext","ServerTool","ClientTool"],"sources":["../../src/tools/index.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { CallbackManagerForToolRun } from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport { type RunnableConfig } from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, type InteropZodObject, type InteropZodType, type ZodStringV3, type ZodStringV4, type ZodObjectV3, type ZodObjectV4 } from \"../utils/types/zod.js\";\nimport type { StructuredToolCallInput, ToolInputSchemaBase, ToolReturnType, ResponseFormat, ToolInputSchemaInputType, ToolInputSchemaOutputType, ToolParams, ToolRunnableConfig, StructuredToolInterface, DynamicToolInput, DynamicStructuredToolInput, StringInputToolSchema, ToolInterface, ToolOutputType, ToolRuntime } from \"./types.js\";\nimport { type JSONSchema } from \"../utils/json_schema.js\";\nexport type { BaseDynamicToolInput, ContentAndArtifact, DynamicToolInput, DynamicStructuredToolInput, ResponseFormat, StructuredToolCallInput, StructuredToolInterface, StructuredToolParams, ToolInterface, ToolParams, ToolReturnType, ToolRunnableConfig, ToolInputSchemaBase as ToolSchemaBase, } from \"./types.js\";\nexport { isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, type ToolRuntime, } from \"./types.js\";\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport declare abstract class StructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends BaseLangChain<StructuredToolCallInput<SchemaT, SchemaInputT>, ToolOutputT | ToolMessage> implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT> {\n abstract name: string;\n abstract description: string;\n abstract schema: SchemaT;\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect: boolean;\n verboseParsingErrors: boolean;\n get lc_namespace(): string[];\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n constructor(fields?: ToolParams);\n protected abstract _call(arg: SchemaOutputT, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n invoke<TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(input: TInput, config?: TConfig): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>>;\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>>;\n}\n/**\n * Base class for Tools that accept input as a string.\n */\nexport declare abstract class Tool<ToolOutputT = ToolOutputType> extends StructuredTool<StringInputToolSchema, ToolInputSchemaOutputType<StringInputToolSchema>, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> implements ToolInterface<StringInputToolSchema, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> {\n schema: z.ZodEffects<z.ZodObject<{\n input: z.ZodOptional<z.ZodString>;\n }, \"strip\", z.ZodTypeAny, {\n input?: string | undefined;\n }, {\n input?: string | undefined;\n }>, string | undefined, {\n input?: string | undefined;\n }>;\n constructor(fields?: ToolParams);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n constructor(fields: DynamicToolInput<ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n /** @ignore */\n _call(input: string, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n */\nexport declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n schema: SchemaT;\n constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n protected _call(arg: Parameters<DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]>[0], runManager?: CallbackManagerForToolRun, parentConfig?: RunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport declare abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n getTools(): StructuredToolInterface[];\n}\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n */\ninterface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined> extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: string;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends JSONSchema, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JSONSchema = InteropZodObject, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> | DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends JSONSchema, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;;;;;;;;;AAiBA;;;AAA4FsB,uBAA9DmB,cAA8DnB,CAAAA,UAArCJ,mBAAqCI,EAAAA,gBAAAA,yBAAAA,CAA0BuB,OAA1BvB,CAAAA,EAAAA,eAAmDD,wBAAnDC,CAA4EuB,OAA5EvB,CAAAA,EAAAA,cAAoGQ,cAApGR,CAAAA,SAA4HpB,aAA5HoB,CAA0IL,uBAA1IK,CAAkKuB,OAAlKvB,EAA2KyB,YAA3KzB,CAAAA,EAA0L0B,WAA1L1B,GAAwMhB,WAAxMgB,CAAAA,YAAgOG,uBAAhOH,CAAwPuB,OAAxPvB,EAAiQyB,YAAjQzB,EAA+Q0B,WAA/Q1B,CAAAA,CAAAA;EAA4EuB,SAAAA,IAAAA,EAAAA,MAAAA;EAAzBxB,SAAAA,WAAAA,EAAAA,MAAAA;EAAiDS,SAAAA,MAAAA,EAG3Ke,OAH2Kf;EAA8De;;;;;;EAA+FE,MAAAA,CAAAA,EAUhVE,MAVgVF,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;EAAcC;;;;;;EAmCzUF,YAAAA,EAAAA,OAAAA;EAA4B7C,oBAAAA,EAAAA,OAAAA;EAA0CuB,IAAAA,YAAAA,CAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAA6BwB;;;;;;;;;EAOsDL,cAAAA,CAAAA,EAbtKvB,cAasKuB;EAASK;;;EAYtJH,aAAAA,CAAAA,EArB1Br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EAAAA,gBAODY,yBAPCZ,CAOyBmC,OAPzBnC,CAAAA,EAAAA,eAOkDW,wBAPlDX,CAO2EmC,OAP3EnC,CAAAA,EAAAA,cAOmGoB,cAPnGpB,EAAAA,SAAAA,OAAAA,EAAAA,WAAAA,OAAAA,CAAAA,CAAAA,IAAAA,EAAAA,CAAAA,KAAAA,EAOuKmD,UAPvKnD,CAOkLiB,0BAPlLjB,CAO6MmC,OAP7MnC,CAAAA,CAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,OAAAA,EAO4OqB,WAP5OrB,CAOwPwD,MAPxPxD,EAOgQyD,QAPhQzD,CAAAA,EAAAA,GAO8QsC,WAP9QtC,GAO4RwC,OAP5RxC,CAOoSsC,WAPpStC,CAAAA,EAAAA,MAAAA,EAO0TqD,iBAP1TrD,CAO4UmC,OAP5UnC,CAAAA,CAAAA,EAOuVkD,qBAPvVlD,CAO6WmC,OAP7WnC,EAOsXoC,aAPtXpC,EAOqYqC,YAPrYrC,EAOmZsC,WAPnZtC,CAAAA;AAAoEmC,KAQlIuB,UAAAA,GAAanB,MARqHJ,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;AAArBpC,KAS7G4D,UAAAA,GAAa5C,uBATgGhB,GAStEkD,WATsElD,GASxDF,gBATwDE"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","RunnableToolLike","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","InteropZodObject","InteropZodType","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","ToolRuntime","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","TInput","TConfig","TArg","SchemaT","SchemaOutputT","SchemaInputT","ToolOutputT","Record","Promise","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","NameT","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool","TState","TContext","ServerTool","ClientTool"],"sources":["../../src/tools/index.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { CallbackManagerForToolRun } from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport { type RunnableConfig } from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, type InteropZodObject, type InteropZodType, type ZodStringV3, type ZodStringV4, type ZodObjectV3, type ZodObjectV4 } from \"../utils/types/zod.js\";\nimport type { StructuredToolCallInput, ToolInputSchemaBase, ToolReturnType, ResponseFormat, ToolInputSchemaInputType, ToolInputSchemaOutputType, ToolParams, ToolRunnableConfig, StructuredToolInterface, DynamicToolInput, DynamicStructuredToolInput, StringInputToolSchema, ToolInterface, ToolOutputType, ToolRuntime } from \"./types.js\";\nimport { type JSONSchema } from \"../utils/json_schema.js\";\nexport type { BaseDynamicToolInput, ContentAndArtifact, DynamicToolInput, DynamicStructuredToolInput, ResponseFormat, StructuredToolCallInput, StructuredToolInterface, StructuredToolParams, ToolInterface, ToolParams, ToolReturnType, ToolRunnableConfig, ToolInputSchemaBase as ToolSchemaBase, } from \"./types.js\";\nexport { isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, type ToolRuntime, } from \"./types.js\";\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport declare abstract class StructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends BaseLangChain<StructuredToolCallInput<SchemaT, SchemaInputT>, ToolOutputT | ToolMessage> implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT> {\n abstract name: string;\n abstract description: string;\n abstract schema: SchemaT;\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect: boolean;\n verboseParsingErrors: boolean;\n get lc_namespace(): string[];\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n constructor(fields?: ToolParams);\n protected abstract _call(arg: SchemaOutputT, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n invoke<TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(input: TInput, config?: TConfig): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>>;\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>>;\n}\n/**\n * Base class for Tools that accept input as a string.\n */\nexport declare abstract class Tool<ToolOutputT = ToolOutputType> extends StructuredTool<StringInputToolSchema, ToolInputSchemaOutputType<StringInputToolSchema>, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> implements ToolInterface<StringInputToolSchema, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> {\n schema: z.ZodEffects<z.ZodObject<{\n input: z.ZodOptional<z.ZodString>;\n }, \"strip\", z.ZodTypeAny, {\n input?: string | undefined;\n }, {\n input?: string | undefined;\n }>, string | undefined, {\n input?: string | undefined;\n }>;\n constructor(fields?: ToolParams);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n constructor(fields: DynamicToolInput<ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n /** @ignore */\n _call(input: string, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n *\n * @template NameT The literal type of the tool name (for discriminated union support)\n */\nexport declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, NameT extends string = string> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name(): string;\n name: NameT;\n description: string;\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n schema: SchemaT;\n constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT> & {\n name: NameT;\n });\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n protected _call(arg: Parameters<DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]>[0], runManager?: CallbackManagerForToolRun, parentConfig?: RunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport declare abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n getTools(): StructuredToolInterface[];\n}\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n * @template {string} NameT The literal name type for discriminated union support.\n */\ninterface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined, NameT extends string = string> extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: NameT;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends ZodObjectV4, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends JSONSchema, NameT extends string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JSONSchema = InteropZodObject, NameT extends string = string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT> | DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends ZodObjectV4, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends JSONSchema, NameT extends string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;;;;;;;;;AAiBA;;;AAA4FsB,uBAA9DmB,cAA8DnB,CAAAA,UAArCJ,mBAAqCI,EAAAA,gBAAAA,yBAAAA,CAA0BuB,OAA1BvB,CAAAA,EAAAA,eAAmDD,wBAAnDC,CAA4EuB,OAA5EvB,CAAAA,EAAAA,cAAoGQ,cAApGR,CAAAA,SAA4HpB,aAA5HoB,CAA0IL,uBAA1IK,CAAkKuB,OAAlKvB,EAA2KyB,YAA3KzB,CAAAA,EAA0L0B,WAA1L1B,GAAwMhB,WAAxMgB,CAAAA,YAAgOG,uBAAhOH,CAAwPuB,OAAxPvB,EAAiQyB,YAAjQzB,EAA+Q0B,WAA/Q1B,CAAAA,CAAAA;EAA4EuB,SAAAA,IAAAA,EAAAA,MAAAA;EAAzBxB,SAAAA,WAAAA,EAAAA,MAAAA;EAAiDS,SAAAA,MAAAA,EAG3Ke,OAH2Kf;EAA8De;;;;;;EAA+FE,MAAAA,CAAAA,EAUhVE,MAVgVF,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;EAAcC;;;;;;EAmCzUF,YAAAA,EAAAA,OAAAA;EAA4B7C,oBAAAA,EAAAA,OAAAA;EAA0CuB,IAAAA,YAAAA,CAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAA6BwB;;;;;;;;;EAOsDL,cAAAA,CAAAA,EAbtKvB,cAasKuB;EAASK;;;EAYtJH,aAAAA,CAAAA,EArB1BrB,kBAqB0BqB;EAASE,WAAAA,CAAAA,MAAAA,CAAAA,EApB9BxB,UAoB8BwB;EAAjC9B,mBAAAA,KAAAA,CAAAA,GAAAA,EAnBY6B,aAmBZ7B,EAAAA,UAAAA,CAAAA,EAnBwChB,yBAmBxCgB,EAAAA,YAAAA,CAAAA,EAnBkFO,kBAmBlFP,CAAAA,EAnBuGiC,OA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|
213
213
|
* Schema can be passed as Zod or JSON schema. The tool will not validate
|
|
214
214
|
* input if JSON schema is passed.
|
|
215
|
+
*
|
|
216
|
+
* @template NameT The literal type of the tool name (for discriminated union support)
|
|
215
217
|
*/
|
|
216
218
|
var DynamicStructuredTool = class extends StructuredTool {
|
|
217
219
|
static lc_name() {
|
|
218
220
|
return "DynamicStructuredTool";
|
|
219
221
|
}
|
|
220
|
-
name;
|
|
221
222
|
description;
|
|
222
223
|
func;
|
|
223
224
|
schema;
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fields?: ToolParams","input: TInput","config?: TConfig","toolInput: Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >","enrichedConfig: ToolRunnableConfig","arg: TArg","configArg?: TConfig","tags?: string[]","parsed: SchemaOutputT","z4","result","toolCallId: string | undefined","callbacks?: TConfig","fields: DynamicToolInput<ToolOutputT>","input: string","runManager?: CallbackManagerForToolRun","parentConfig?: ToolRunnableConfig","fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>","arg: Parameters<\n DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]\n >[0]","parentConfig?: RunnableConfig","func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>","fields: ToolWrapperParams<SchemaT>","listener: (() => void) | undefined","params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n metadata?: Record<string, unknown>;\n}","content: unknown"],"sources":["../../src/tools/index.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { z as z4, ZodError } from \"zod/v4\";\nimport {\n validate,\n type Schema as ValidationSchema,\n} from \"@cfworker/json-schema\";\nimport {\n CallbackManager,\n CallbackManagerForToolRun,\n parseCallbackConfigArg,\n} from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport {\n mergeConfigs,\n ensureConfig,\n patchConfig,\n pickRunnableConfigKeys,\n type RunnableConfig,\n} from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { isDirectToolOutput, ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport { AsyncLocalStorageProviderSingleton } from \"../singletons/index.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport {\n _configHasToolCallId,\n _isToolCall,\n ToolInputParsingException,\n} from \"./utils.js\";\nimport {\n type InferInteropZodInput,\n type InferInteropZodOutput,\n type InteropZodObject,\n type InteropZodType,\n interopParseAsync,\n isSimpleStringZodSchema,\n isInteropZodError,\n isInteropZodSchema,\n type ZodStringV3,\n type ZodStringV4,\n type ZodObjectV3,\n type ZodObjectV4,\n} from \"../utils/types/zod.js\";\nimport { getAbortSignalError } from \"../utils/signal.js\";\nimport type {\n StructuredToolCallInput,\n ToolInputSchemaBase,\n ToolReturnType,\n ResponseFormat,\n ToolInputSchemaInputType,\n ToolInputSchemaOutputType,\n ToolParams,\n ToolRunnableConfig,\n StructuredToolInterface,\n DynamicToolInput,\n DynamicStructuredToolInput,\n StringInputToolSchema,\n ToolInterface,\n ToolOutputType,\n ToolRuntime,\n} from \"./types.js\";\nimport { type JSONSchema, validatesOnlyStrings } from \"../utils/json_schema.js\";\n\nexport type {\n BaseDynamicToolInput,\n ContentAndArtifact,\n DynamicToolInput,\n DynamicStructuredToolInput,\n ResponseFormat,\n StructuredToolCallInput,\n StructuredToolInterface,\n StructuredToolParams,\n ToolInterface,\n ToolParams,\n ToolReturnType,\n ToolRunnableConfig,\n ToolInputSchemaBase as ToolSchemaBase,\n} from \"./types.js\";\n\nexport {\n isLangChainTool,\n isRunnableToolLike,\n isStructuredTool,\n isStructuredToolParams,\n type ToolRuntime,\n} from \"./types.js\";\n\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport abstract class StructuredTool<\n SchemaT = ToolInputSchemaBase,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n >\n extends BaseLangChain<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolOutputT | ToolMessage\n >\n implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT>\n{\n abstract name: string;\n\n abstract description: string;\n\n abstract schema: SchemaT;\n\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect = false;\n\n verboseParsingErrors = false;\n\n get lc_namespace() {\n return [\"langchain\", \"tools\"];\n }\n\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat = \"content\";\n\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n\n constructor(fields?: ToolParams) {\n super(fields ?? {});\n\n this.verboseParsingErrors =\n fields?.verboseParsingErrors ?? this.verboseParsingErrors;\n this.responseFormat = fields?.responseFormat ?? this.responseFormat;\n this.defaultConfig = fields?.defaultConfig ?? this.defaultConfig;\n this.metadata = fields?.metadata ?? this.metadata;\n this.extras = fields?.extras ?? this.extras;\n }\n\n protected abstract _call(\n arg: SchemaOutputT,\n runManager?: CallbackManagerForToolRun,\n parentConfig?: ToolRunnableConfig\n ): Promise<ToolOutputT>;\n\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n async invoke<\n TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n input: TInput,\n config?: TConfig\n ): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>> {\n let toolInput: Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n\n let enrichedConfig: ToolRunnableConfig = ensureConfig(\n mergeConfigs(this.defaultConfig, config)\n );\n if (_isToolCall(input)) {\n toolInput = input.args as Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n enrichedConfig = {\n ...enrichedConfig,\n toolCall: input,\n };\n } else {\n toolInput = input as Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n }\n\n return this.call(toolInput, enrichedConfig) as Promise<\n ToolReturnType<TInput, TConfig, ToolOutputT>\n >;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n async call<\n TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig,\n /** @deprecated */\n tags?: string[]\n ): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>> {\n // Determine the actual input that needs parsing/validation.\n // If arg is a ToolCall, use its args; otherwise, use arg directly.\n const inputForValidation = _isToolCall(arg) ? arg.args : arg;\n\n let parsed: SchemaOutputT; // This will hold the successfully parsed input of the expected output type.\n if (isInteropZodSchema(this.schema)) {\n try {\n // Validate the inputForValidation - TS needs help here as it can't exclude ToolCall based on the check\n parsed = await interopParseAsync(\n this.schema as InteropZodType,\n inputForValidation as Exclude<TArg, ToolCall>\n );\n } catch (e) {\n let message = `Received tool input did not match expected schema`;\n if (this.verboseParsingErrors) {\n message = `${message}\\nDetails: ${(e as Error).message}`;\n }\n if (isInteropZodError(e)) {\n message = `${message}\\n\\n${z4.prettifyError(e as ZodError)}`;\n }\n // Pass the original raw input arg to the exception\n throw new ToolInputParsingException(message, JSON.stringify(arg));\n }\n } else {\n const result = validate(\n inputForValidation,\n this.schema as ValidationSchema\n );\n if (!result.valid) {\n let message = `Received tool input did not match expected schema`;\n if (this.verboseParsingErrors) {\n message = `${message}\\nDetails: ${result.errors\n .map((e) => `${e.keywordLocation}: ${e.error}`)\n .join(\"\\n\")}`;\n }\n // Pass the original raw input arg to the exception\n throw new ToolInputParsingException(message, JSON.stringify(arg));\n }\n // Assign the validated input to parsed\n // We cast here because validate() doesn't narrow the type sufficiently for TS, but we know it's valid.\n parsed = inputForValidation as SchemaOutputT;\n }\n\n const config = parseCallbackConfigArg(configArg);\n const callbackManager_ = CallbackManager.configure(\n config.callbacks,\n this.callbacks,\n config.tags || tags,\n this.tags,\n config.metadata,\n this.metadata,\n { verbose: this.verbose }\n );\n const runManager = await callbackManager_?.handleToolStart(\n this.toJSON(),\n // Log the original raw input arg\n typeof arg === \"string\" ? arg : JSON.stringify(arg),\n config.runId,\n undefined,\n undefined,\n undefined,\n config.runName\n );\n delete config.runId;\n let result;\n try {\n // Pass the correctly typed parsed input to _call\n result = await this._call(parsed, runManager, config);\n } catch (e) {\n await runManager?.handleToolError(e);\n throw e;\n }\n let content;\n let artifact;\n if (this.responseFormat === \"content_and_artifact\") {\n if (Array.isArray(result) && result.length === 2) {\n [content, artifact] = result;\n } else {\n throw new Error(\n `Tool response format is \"content_and_artifact\" but the output was not a two-tuple.\\nResult: ${JSON.stringify(\n result\n )}`\n );\n }\n } else {\n content = result;\n }\n\n let toolCallId: string | undefined;\n // Extract toolCallId ONLY if the original arg was a ToolCall\n if (_isToolCall(arg)) {\n toolCallId = arg.id;\n }\n // Or if it was provided in the config's toolCall property\n if (!toolCallId && _configHasToolCallId(config)) {\n toolCallId = config.toolCall.id;\n }\n\n const formattedOutput = _formatToolOutput<ToolOutputT>({\n content,\n artifact,\n toolCallId,\n name: this.name,\n metadata: this.metadata,\n });\n await runManager?.handleToolEnd(formattedOutput);\n return formattedOutput as ToolReturnType<TArg, TConfig, ToolOutputT>;\n }\n}\n\n/**\n * Base class for Tools that accept input as a string.\n */\nexport abstract class Tool<ToolOutputT = ToolOutputType>\n extends StructuredTool<\n StringInputToolSchema,\n ToolInputSchemaOutputType<StringInputToolSchema>,\n ToolInputSchemaInputType<StringInputToolSchema>,\n ToolOutputT\n >\n implements\n ToolInterface<\n StringInputToolSchema,\n ToolInputSchemaInputType<StringInputToolSchema>,\n ToolOutputT\n >\n{\n schema = z\n .object({ input: z.string().optional() })\n .transform((obj) => obj.input);\n\n constructor(fields?: ToolParams) {\n super(fields);\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n // Match the base class signature including the generics and conditional return type\n call<\n TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n callbacks?: TConfig\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n // Prepare the input for the base class call method.\n // If arg is string or undefined, wrap it; otherwise, pass ToolCall or { input: ... } directly.\n const structuredArg =\n typeof arg === \"string\" || arg == null ? { input: arg } : arg;\n\n // Ensure TConfig is passed to super.call\n return super.call(structuredArg, callbacks);\n }\n}\n\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport class DynamicTool<\n ToolOutputT = ToolOutputType\n> extends Tool<ToolOutputT> {\n static lc_name() {\n return \"DynamicTool\";\n }\n\n name: string;\n\n description: string;\n\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n\n constructor(fields: DynamicToolInput<ToolOutputT>) {\n super(fields);\n this.name = fields.name;\n this.description = fields.description;\n this.func = fields.func;\n this.returnDirect = fields.returnDirect ?? this.returnDirect;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n async call<\n TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n const config = parseCallbackConfigArg(configArg);\n if (config.runName === undefined) {\n config.runName = this.name;\n }\n // Call the Tool class's call method, passing generics through\n // Cast config to TConfig to satisfy the super.call signature\n return super.call<TArg, TConfig>(arg, config as TConfig);\n }\n\n /** @ignore */\n async _call(\n input: string, // DynamicTool's _call specifically expects a string after schema transformation\n runManager?: CallbackManagerForToolRun,\n parentConfig?: ToolRunnableConfig\n ): Promise<ToolOutputT> {\n return this.func(input, runManager, parentConfig);\n }\n}\n\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n */\nexport class DynamicStructuredTool<\n SchemaT = ToolInputSchemaBase,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name() {\n return \"DynamicStructuredTool\";\n }\n\n name: string;\n\n description: string;\n\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n\n schema: SchemaT;\n\n constructor(\n fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>\n ) {\n super(fields);\n this.name = fields.name;\n this.description = fields.description;\n this.func = fields.func;\n this.returnDirect = fields.returnDirect ?? this.returnDirect;\n this.schema = fields.schema;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n // Match the base class signature\n async call<\n TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig,\n /** @deprecated */\n tags?: string[]\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n const config = parseCallbackConfigArg(configArg);\n if (config.runName === undefined) {\n config.runName = this.name;\n }\n\n // Call the base class method, passing generics through\n // Cast config to TConfig to satisfy the super.call signature\n return super.call<TArg, TConfig>(arg, config as TConfig, tags);\n }\n\n protected _call(\n arg: Parameters<\n DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]\n >[0],\n runManager?: CallbackManagerForToolRun,\n parentConfig?: RunnableConfig\n ): Promise<ToolOutputT> {\n return this.func(arg, runManager, parentConfig);\n }\n}\n\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n\n getTools(): StructuredToolInterface[] {\n return this.tools;\n }\n}\n\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n */\ninterface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined>\n extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: string;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(\n func: RunnableFunc<\n InferInteropZodOutput<SchemaT>,\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(\n func: RunnableFunc<\n InferInteropZodOutput<SchemaT>,\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV3,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV4,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends JSONSchema,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<\n Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0],\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends\n | InteropZodObject\n | InteropZodType<string>\n | JSONSchema = InteropZodObject,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT>\n):\n | DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>\n | DynamicTool<ToolOutputT>;\n\n// Overloads with ToolRuntime as CallOptions\nexport function tool<\n SchemaT extends ZodStringV3,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: InferInteropZodOutput<SchemaT>,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodStringV4,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: InferInteropZodOutput<SchemaT>,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV3,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV4,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends JSONSchema,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0],\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends\n | InteropZodObject\n | InteropZodType<string>\n | JSONSchema = InteropZodObject,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n):\n | DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>\n | DynamicTool<ToolOutputT> {\n const isSimpleStringSchema = isSimpleStringZodSchema(fields.schema);\n const isStringJSONSchema = validatesOnlyStrings(fields.schema);\n\n // If the schema is not provided, or it's a simple string schema, create a DynamicTool\n if (!fields.schema || isSimpleStringSchema || isStringJSONSchema) {\n return new DynamicTool<ToolOutputT>({\n ...fields,\n description:\n fields.description ??\n (fields.schema as { description?: string } | undefined)?.description ??\n `${fields.name} tool`,\n func: async (input, runManager, config) => {\n return new Promise<ToolOutputT>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n // eslint-disable-next-line no-void\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolve(func(input as any, childConfig as any));\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n },\n });\n }\n\n const schema = fields.schema as InteropZodObject | JSONSchema;\n\n const description =\n fields.description ??\n (fields.schema as { description?: string }).description ??\n `${fields.name} tool`;\n\n return new DynamicStructuredTool<\n typeof schema,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT\n >({\n ...fields,\n description,\n schema,\n func: async (input, runManager, config) => {\n return new Promise<ToolOutputT>((resolve, reject) => {\n let listener: (() => void) | undefined;\n const cleanup = () => {\n if (config?.signal && listener) {\n config.signal.removeEventListener(\"abort\", listener);\n }\n };\n\n if (config?.signal) {\n listener = () => {\n cleanup();\n reject(getAbortSignalError(config.signal));\n };\n config.signal.addEventListener(\"abort\", listener);\n }\n\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n // eslint-disable-next-line no-void\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result = await func(input as any, childConfig as any);\n\n /**\n * If the signal is aborted, we don't want to resolve the promise\n * as the promise is already rejected.\n */\n if (config?.signal?.aborted) {\n cleanup();\n return;\n }\n\n cleanup();\n resolve(result);\n } catch (e) {\n cleanup();\n reject(e);\n }\n }\n );\n });\n },\n }) as DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT\n >;\n}\n\nfunction _formatToolOutput<TOutput extends ToolOutputType>(params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n metadata?: Record<string, unknown>;\n}): ToolMessage | TOutput {\n const { content, artifact, toolCallId, metadata } = params;\n if (toolCallId && !isDirectToolOutput(content)) {\n if (\n typeof content === \"string\" ||\n (Array.isArray(content) &&\n content.every((item) => typeof item === \"object\"))\n ) {\n return new ToolMessage({\n status: \"success\",\n content,\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n metadata,\n });\n } else {\n return new ToolMessage({\n status: \"success\",\n content: _stringify(content),\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n metadata,\n });\n }\n } else {\n return content;\n }\n}\n\nfunction _stringify(content: unknown): string {\n try {\n return JSON.stringify(content, null, 2) ?? \"\";\n } catch (_noOp) {\n return `${content}`;\n }\n}\n\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool =\n | StructuredToolInterface\n | DynamicTool\n | RunnableToolLike;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,IAAsB,iBAAtB,cAMU,cAKV;;;;;;;CAaE;;;;;;;CAQA,eAAe;CAEf,uBAAuB;CAEvB,IAAI,eAAe;AACjB,SAAO,CAAC,aAAa,OAAQ;CAC9B;;;;;;;;;;CAWD,iBAAkC;;;;CAKlC;CAEA,YAAYA,QAAqB;EAC/B,MAAM,UAAU,CAAE,EAAC;EAEnB,KAAK,uBACH,QAAQ,wBAAwB,KAAK;EACvC,KAAK,iBAAiB,QAAQ,kBAAkB,KAAK;EACrD,KAAK,gBAAgB,QAAQ,iBAAiB,KAAK;EACnD,KAAK,WAAW,Q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GACF;EACF;CACF;AAMF;AAED,SAAS,kBAAkDC,QAMjC;CACxB,MAAM,EAAE,SAAS,UAAU,YAAY,UAAU,GAAG;AACpD,KAAI,cAAc,CAAC,mBAAmB,QAAQ,CAC5C,KACE,OAAO,YAAY,YAClB,MAAM,QAAQ,QAAQ,IACrB,QAAQ,MAAM,CAAC,SAAS,OAAO,SAAS,SAAS,CAEnD,QAAO,IAAI,YAAY;EACrB,QAAQ;EACR;EACA;EACA,cAAc;EACd,MAAM,OAAO;EACb;CACD;KAED,QAAO,IAAI,YAAY;EACrB,QAAQ;EACR,SAAS,WAAW,QAAQ;EAC5B;EACA,cAAc;EACd,MAAM,OAAO;EACb;CACD;KAGH,QAAO;AAEV;AAED,SAAS,WAAWC,SAA0B;AAC5C,KAAI;AACF,SAAO,KAAK,UAAU,SAAS,MAAM,EAAE,IAAI;CAC5C,SAAQ,OAAO;AACd,SAAO,GAAG,SAAS;CACpB;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["fields?: ToolParams","input: TInput","config?: TConfig","toolInput: Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >","enrichedConfig: ToolRunnableConfig","arg: TArg","configArg?: TConfig","tags?: string[]","parsed: SchemaOutputT","z4","result","toolCallId: string | undefined","callbacks?: TConfig","fields: DynamicToolInput<ToolOutputT>","input: string","runManager?: CallbackManagerForToolRun","parentConfig?: ToolRunnableConfig","fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT> & {\n name: NameT;\n }","arg: Parameters<\n DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]\n >[0]","parentConfig?: RunnableConfig","func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>","fields: ToolWrapperParams<SchemaT, NameT>","listener: (() => void) | undefined","params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n metadata?: Record<string, unknown>;\n}","content: unknown"],"sources":["../../src/tools/index.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { z as z4, ZodError } from \"zod/v4\";\nimport {\n validate,\n type Schema as ValidationSchema,\n} from \"@cfworker/json-schema\";\nimport {\n CallbackManager,\n CallbackManagerForToolRun,\n parseCallbackConfigArg,\n} from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport {\n mergeConfigs,\n ensureConfig,\n patchConfig,\n pickRunnableConfigKeys,\n type RunnableConfig,\n} from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { isDirectToolOutput, ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport { AsyncLocalStorageProviderSingleton } from \"../singletons/index.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport {\n _configHasToolCallId,\n _isToolCall,\n ToolInputParsingException,\n} from \"./utils.js\";\nimport {\n type InferInteropZodInput,\n type InferInteropZodOutput,\n type InteropZodObject,\n type InteropZodType,\n interopParseAsync,\n isSimpleStringZodSchema,\n isInteropZodError,\n isInteropZodSchema,\n type ZodStringV3,\n type ZodStringV4,\n type ZodObjectV3,\n type ZodObjectV4,\n} from \"../utils/types/zod.js\";\nimport { getAbortSignalError } from \"../utils/signal.js\";\nimport type {\n StructuredToolCallInput,\n ToolInputSchemaBase,\n ToolReturnType,\n ResponseFormat,\n ToolInputSchemaInputType,\n ToolInputSchemaOutputType,\n ToolParams,\n ToolRunnableConfig,\n StructuredToolInterface,\n DynamicToolInput,\n DynamicStructuredToolInput,\n StringInputToolSchema,\n ToolInterface,\n ToolOutputType,\n ToolRuntime,\n} from \"./types.js\";\nimport { type JSONSchema, validatesOnlyStrings } from \"../utils/json_schema.js\";\n\nexport type {\n BaseDynamicToolInput,\n ContentAndArtifact,\n DynamicToolInput,\n DynamicStructuredToolInput,\n ResponseFormat,\n StructuredToolCallInput,\n StructuredToolInterface,\n StructuredToolParams,\n ToolInterface,\n ToolParams,\n ToolReturnType,\n ToolRunnableConfig,\n ToolInputSchemaBase as ToolSchemaBase,\n} from \"./types.js\";\n\nexport {\n isLangChainTool,\n isRunnableToolLike,\n isStructuredTool,\n isStructuredToolParams,\n type ToolRuntime,\n} from \"./types.js\";\n\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport abstract class StructuredTool<\n SchemaT = ToolInputSchemaBase,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n >\n extends BaseLangChain<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolOutputT | ToolMessage\n >\n implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT>\n{\n abstract name: string;\n\n abstract description: string;\n\n abstract schema: SchemaT;\n\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect = false;\n\n verboseParsingErrors = false;\n\n get lc_namespace() {\n return [\"langchain\", \"tools\"];\n }\n\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat = \"content\";\n\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n\n constructor(fields?: ToolParams) {\n super(fields ?? {});\n\n this.verboseParsingErrors =\n fields?.verboseParsingErrors ?? this.verboseParsingErrors;\n this.responseFormat = fields?.responseFormat ?? this.responseFormat;\n this.defaultConfig = fields?.defaultConfig ?? this.defaultConfig;\n this.metadata = fields?.metadata ?? this.metadata;\n this.extras = fields?.extras ?? this.extras;\n }\n\n protected abstract _call(\n arg: SchemaOutputT,\n runManager?: CallbackManagerForToolRun,\n parentConfig?: ToolRunnableConfig\n ): Promise<ToolOutputT>;\n\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n async invoke<\n TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n input: TInput,\n config?: TConfig\n ): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>> {\n let toolInput: Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n\n let enrichedConfig: ToolRunnableConfig = ensureConfig(\n mergeConfigs(this.defaultConfig, config)\n );\n if (_isToolCall(input)) {\n toolInput = input.args as Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n enrichedConfig = {\n ...enrichedConfig,\n toolCall: input,\n };\n } else {\n toolInput = input as Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n }\n\n return this.call(toolInput, enrichedConfig) as Promise<\n ToolReturnType<TInput, TConfig, ToolOutputT>\n >;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n async call<\n TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig,\n /** @deprecated */\n tags?: string[]\n ): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>> {\n // Determine the actual input that needs parsing/validation.\n // If arg is a ToolCall, use its args; otherwise, use arg directly.\n const inputForValidation = _isToolCall(arg) ? arg.args : arg;\n\n let parsed: SchemaOutputT; // This will hold the successfully parsed input of the expected output type.\n if (isInteropZodSchema(this.schema)) {\n try {\n // Validate the inputForValidation - TS needs help here as it can't exclude ToolCall based on the check\n parsed = await interopParseAsync(\n this.schema as InteropZodType,\n inputForValidation as Exclude<TArg, ToolCall>\n );\n } catch (e) {\n let message = `Received tool input did not match expected schema`;\n if (this.verboseParsingErrors) {\n message = `${message}\\nDetails: ${(e as Error).message}`;\n }\n if (isInteropZodError(e)) {\n message = `${message}\\n\\n${z4.prettifyError(e as ZodError)}`;\n }\n // Pass the original raw input arg to the exception\n throw new ToolInputParsingException(message, JSON.stringify(arg));\n }\n } else {\n const result = validate(\n inputForValidation,\n this.schema as ValidationSchema\n );\n if (!result.valid) {\n let message = `Received tool input did not match expected schema`;\n if (this.verboseParsingErrors) {\n message = `${message}\\nDetails: ${result.errors\n .map((e) => `${e.keywordLocation}: ${e.error}`)\n .join(\"\\n\")}`;\n }\n // Pass the original raw input arg to the exception\n throw new ToolInputParsingException(message, JSON.stringify(arg));\n }\n // Assign the validated input to parsed\n // We cast here because validate() doesn't narrow the type sufficiently for TS, but we know it's valid.\n parsed = inputForValidation as SchemaOutputT;\n }\n\n const config = parseCallbackConfigArg(configArg);\n const callbackManager_ = CallbackManager.configure(\n config.callbacks,\n this.callbacks,\n config.tags || tags,\n this.tags,\n config.metadata,\n this.metadata,\n { verbose: this.verbose }\n );\n const runManager = await callbackManager_?.handleToolStart(\n this.toJSON(),\n // Log the original raw input arg\n typeof arg === \"string\" ? arg : JSON.stringify(arg),\n config.runId,\n undefined,\n undefined,\n undefined,\n config.runName\n );\n delete config.runId;\n let result;\n try {\n // Pass the correctly typed parsed input to _call\n result = await this._call(parsed, runManager, config);\n } catch (e) {\n await runManager?.handleToolError(e);\n throw e;\n }\n let content;\n let artifact;\n if (this.responseFormat === \"content_and_artifact\") {\n if (Array.isArray(result) && result.length === 2) {\n [content, artifact] = result;\n } else {\n throw new Error(\n `Tool response format is \"content_and_artifact\" but the output was not a two-tuple.\\nResult: ${JSON.stringify(\n result\n )}`\n );\n }\n } else {\n content = result;\n }\n\n let toolCallId: string | undefined;\n // Extract toolCallId ONLY if the original arg was a ToolCall\n if (_isToolCall(arg)) {\n toolCallId = arg.id;\n }\n // Or if it was provided in the config's toolCall property\n if (!toolCallId && _configHasToolCallId(config)) {\n toolCallId = config.toolCall.id;\n }\n\n const formattedOutput = _formatToolOutput<ToolOutputT>({\n content,\n artifact,\n toolCallId,\n name: this.name,\n metadata: this.metadata,\n });\n await runManager?.handleToolEnd(formattedOutput);\n return formattedOutput as ToolReturnType<TArg, TConfig, ToolOutputT>;\n }\n}\n\n/**\n * Base class for Tools that accept input as a string.\n */\nexport abstract class Tool<ToolOutputT = ToolOutputType>\n extends StructuredTool<\n StringInputToolSchema,\n ToolInputSchemaOutputType<StringInputToolSchema>,\n ToolInputSchemaInputType<StringInputToolSchema>,\n ToolOutputT\n >\n implements\n ToolInterface<\n StringInputToolSchema,\n ToolInputSchemaInputType<StringInputToolSchema>,\n ToolOutputT\n >\n{\n schema = z\n .object({ input: z.string().optional() })\n .transform((obj) => obj.input);\n\n constructor(fields?: ToolParams) {\n super(fields);\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n // Match the base class signature including the generics and conditional return type\n call<\n TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n callbacks?: TConfig\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n // Prepare the input for the base class call method.\n // If arg is string or undefined, wrap it; otherwise, pass ToolCall or { input: ... } directly.\n const structuredArg =\n typeof arg === \"string\" || arg == null ? { input: arg } : arg;\n\n // Ensure TConfig is passed to super.call\n return super.call(structuredArg, callbacks);\n }\n}\n\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport class DynamicTool<\n ToolOutputT = ToolOutputType\n> extends Tool<ToolOutputT> {\n static lc_name() {\n return \"DynamicTool\";\n }\n\n name: string;\n\n description: string;\n\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n\n constructor(fields: DynamicToolInput<ToolOutputT>) {\n super(fields);\n this.name = fields.name;\n this.description = fields.description;\n this.func = fields.func;\n this.returnDirect = fields.returnDirect ?? this.returnDirect;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n async call<\n TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n const config = parseCallbackConfigArg(configArg);\n if (config.runName === undefined) {\n config.runName = this.name;\n }\n // Call the Tool class's call method, passing generics through\n // Cast config to TConfig to satisfy the super.call signature\n return super.call<TArg, TConfig>(arg, config as TConfig);\n }\n\n /** @ignore */\n async _call(\n input: string, // DynamicTool's _call specifically expects a string after schema transformation\n runManager?: CallbackManagerForToolRun,\n parentConfig?: ToolRunnableConfig\n ): Promise<ToolOutputT> {\n return this.func(input, runManager, parentConfig);\n }\n}\n\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n *\n * @template NameT The literal type of the tool name (for discriminated union support)\n */\nexport class DynamicStructuredTool<\n SchemaT = ToolInputSchemaBase,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n NameT extends string = string\n> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name() {\n return \"DynamicStructuredTool\";\n }\n\n declare name: NameT;\n\n description: string;\n\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n\n schema: SchemaT;\n\n constructor(\n fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT> & {\n name: NameT;\n }\n ) {\n super(fields);\n this.name = fields.name;\n this.description = fields.description;\n this.func = fields.func;\n this.returnDirect = fields.returnDirect ?? this.returnDirect;\n this.schema = fields.schema;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n // Match the base class signature\n async call<\n TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig,\n /** @deprecated */\n tags?: string[]\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n const config = parseCallbackConfigArg(configArg);\n if (config.runName === undefined) {\n config.runName = this.name;\n }\n\n // Call the base class method, passing generics through\n // Cast config to TConfig to satisfy the super.call signature\n return super.call<TArg, TConfig>(arg, config as TConfig, tags);\n }\n\n protected _call(\n arg: Parameters<\n DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]\n >[0],\n runManager?: CallbackManagerForToolRun,\n parentConfig?: RunnableConfig\n ): Promise<ToolOutputT> {\n return this.func(arg, runManager, parentConfig);\n }\n}\n\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n\n getTools(): StructuredToolInterface[] {\n return this.tools;\n }\n}\n\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n * @template {string} NameT The literal name type for discriminated union support.\n */\ninterface ToolWrapperParams<\n RunInput = ToolInputSchemaBase | undefined,\n NameT extends string = string\n> extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: NameT;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(\n func: RunnableFunc<\n InferInteropZodOutput<SchemaT>,\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(\n func: RunnableFunc<\n InferInteropZodOutput<SchemaT>,\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV3,\n NameT extends string,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends ZodObjectV4,\n NameT extends string,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends JSONSchema,\n NameT extends string,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<\n Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0],\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends\n | InteropZodObject\n | InteropZodType<string>\n | JSONSchema = InteropZodObject,\n NameT extends string = string,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT, NameT>\n):\n | DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n >\n | DynamicTool<ToolOutputT>;\n\n// Overloads with ToolRuntime as CallOptions\nexport function tool<\n SchemaT extends ZodStringV3,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: InferInteropZodOutput<SchemaT>,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodStringV4,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: InferInteropZodOutput<SchemaT>,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV3,\n NameT extends string,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends ZodObjectV4,\n NameT extends string,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends JSONSchema,\n NameT extends string,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0],\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends\n | InteropZodObject\n | InteropZodType<string>\n | JSONSchema = InteropZodObject,\n NameT extends string = string,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT, NameT>\n):\n | DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n >\n | DynamicTool<ToolOutputT> {\n const isSimpleStringSchema = isSimpleStringZodSchema(fields.schema);\n const isStringJSONSchema = validatesOnlyStrings(fields.schema);\n\n // If the schema is not provided, or it's a simple string schema, create a DynamicTool\n if (!fields.schema || isSimpleStringSchema || isStringJSONSchema) {\n return new DynamicTool<ToolOutputT>({\n ...fields,\n description:\n fields.description ??\n (fields.schema as { description?: string } | undefined)?.description ??\n `${fields.name} tool`,\n func: async (input, runManager, config) => {\n return new Promise<ToolOutputT>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n // eslint-disable-next-line no-void\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolve(func(input as any, childConfig as any));\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n },\n });\n }\n\n const schema = fields.schema as InteropZodObject | JSONSchema;\n\n const description =\n fields.description ??\n (fields.schema as { description?: string }).description ??\n `${fields.name} tool`;\n\n return new DynamicStructuredTool<\n typeof schema,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n >({\n ...fields,\n description,\n schema,\n func: async (input, runManager, config) => {\n return new Promise<ToolOutputT>((resolve, reject) => {\n let listener: (() => void) | undefined;\n const cleanup = () => {\n if (config?.signal && listener) {\n config.signal.removeEventListener(\"abort\", listener);\n }\n };\n\n if (config?.signal) {\n listener = () => {\n cleanup();\n reject(getAbortSignalError(config.signal));\n };\n config.signal.addEventListener(\"abort\", listener);\n }\n\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n // eslint-disable-next-line no-void\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result = await func(input as any, childConfig as any);\n\n /**\n * If the signal is aborted, we don't want to resolve the promise\n * as the promise is already rejected.\n */\n if (config?.signal?.aborted) {\n cleanup();\n return;\n }\n\n cleanup();\n resolve(result);\n } catch (e) {\n cleanup();\n reject(e);\n }\n }\n );\n });\n },\n }) as DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n >;\n}\n\nfunction _formatToolOutput<TOutput extends ToolOutputType>(params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n metadata?: Record<string, unknown>;\n}): ToolMessage | TOutput {\n const { content, artifact, toolCallId, metadata } = params;\n if (toolCallId && !isDirectToolOutput(content)) {\n if (\n typeof content === \"string\" ||\n (Array.isArray(content) &&\n content.every((item) => typeof item === \"object\"))\n ) {\n return new ToolMessage({\n status: \"success\",\n content,\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n metadata,\n });\n } else {\n return new ToolMessage({\n status: \"success\",\n content: _stringify(content),\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n metadata,\n });\n }\n } else {\n return content;\n }\n}\n\nfunction _stringify(content: unknown): string {\n try {\n return JSON.stringify(content, null, 2) ?? \"\";\n } catch (_noOp) {\n return `${content}`;\n }\n}\n\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool =\n | StructuredToolInterface\n | DynamicTool\n | RunnableToolLike;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,IAAsB,iBAAtB,cAMU,cAKV;;;;;;;CAaE;;;;;;;CAQA,eAAe;CAEf,uBAAuB;CAEvB,IAAI,eAAe;AACjB,SAAO,CAAC,aAAa,OAAQ;CAC9B;;;;;;;;;;CAWD,iBAAkC;;;;CAKlC;CAEA,YAAYA,QAAqB;EAC/B,MAAM,UAAU,CAAE,EAAC;EAEnB,KAAK,uBACH,QAAQ,wBAAwB,KAAK;EACvC,KAAK,iBAAiB,QAAQ,kBAAkB,KAAK;EACrD,KAAK,gBAAgB,QAAQ,iBAAiB,KAAK;EACnD,KAAK,WAAW,QAAQ,YAAY,KAAK;EACzC,KAAK,SAAS,QAAQ,UAAU,KAAK;CACtC;;;;;;;CAcD,MAAM,OAIJC,OACAC,QACuD;EACvD,IAAIC;EAKJ,IAAIC,iBAAqC,aACvC,aAAa,KAAK,eAAe,OAAO,CACzC;AACD,MAAI,YAAY,MAAM,EAAE;GACtB,YAAY,MAAM;GAIlB,iBAAiB;IACf,GAAG;IACH,UAAU;GACX;EACF,OACC,YAAY;AAMd,SAAO,KAAK,KAAK,WAAW,eAAe;CAG5C;;;;;;;;;;;;CAaD,MAAM,KAIJC,KACAC,WAEAC,MACqD;EAGrD,MAAM,qBAAqB,YAAY,IAAI,GAAG,IAAI,OAAO;EAEzD,IAAIC;AACJ,MAAI,mBAAmB,KAAK,OAAO,CACjC,KAAI;GAEF,SAAS,MAAM,kBACb,KAAK,QACL,mBACD;EACF,SAAQ,GAAG;GACV,IAAI,UAAU,CAAC,iDA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S;CACpB;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event_source_parse.d.cts","names":["IterableReadableStream","EventStreamContentType","EventSourceMessage","getBytes","Uint8Array","ReadableStream","AsyncIterable","Promise","getLines","ArrayBufferLike","getMessages","convertEventStreamToIterableReadableDataStream"],"sources":["../../src/utils/event_source_parse.d.ts"],"sourcesContent":["import { IterableReadableStream } from \"./stream.js\";\nexport declare const EventStreamContentType = \"text/event-stream\";\n/**\n * Represents a message sent in an event stream\n * https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format\n */\nexport interface EventSourceMessage {\n /** The event ID to set the EventSource object's last event ID value. */\n id: string;\n /** A string identifying the type of event described. */\n event: string;\n /** The event data */\n data: string;\n /** The reconnection interval (in milliseconds) to wait before retrying the connection */\n retry?: number;\n}\n/**\n * Converts a ReadableStream into a callback pattern.\n * @param stream The input ReadableStream.\n * @param onChunk A function that will be called on each new byte chunk in the stream.\n * @returns {Promise<void>} A promise that will be resolved when the stream closes.\n */\nexport declare function getBytes(stream: ReadableStream<Uint8Array> | AsyncIterable<any>, onChunk: (arr: Uint8Array, flush?: boolean) => void): Promise<void>;\n/**\n * Parses arbitary byte chunks into EventSource line buffers.\n * Each line should be of the format \"field: value\" and ends with \\r, \\n, or \\r\\n.\n * @param onLine A function that will be called on each new EventSource line.\n * @returns A function that should be called for each incoming byte chunk.\n */\nexport declare function getLines(onLine: (line: Uint8Array, fieldLength: number, flush?: boolean) => void): (arr: Uint8Array<ArrayBufferLike>, flush?: boolean | undefined) => void;\n/**\n * Parses line buffers into EventSourceMessages.\n * @param onId A function that will be called on each `id` field.\n * @param onRetry A function that will be called on each `retry` field.\n * @param onMessage A function that will be called on each message.\n * @returns A function that should be called for each incoming line buffer.\n */\nexport declare function getMessages(onMessage?: (msg: EventSourceMessage) => void, onId?: (id: string) => void, onRetry?: (retry: number) => void): (line: Uint8Array<ArrayBufferLike>, fieldLength: number, flush?: boolean | undefined) => void;\nexport declare function convertEventStreamToIterableReadableDataStream(stream: ReadableStream, onMetadataEvent?: (e: unknown) => unknown): IterableReadableStream<any>;\n//# sourceMappingURL=event_source_parse.d.ts.map"],"mappings":";;;cACqBC,sBAAAA;;AAArB;AAKA;AAgBA;AAAwDG,UAhBvCF,kBAAAA,CAgBuCE;EAAfC;EAA6BC,EAAAA,EAAAA,MAAAA;EAAmCF;EAAuCG,KAAAA,EAAAA,MAAAA;EAAO;EAO/HC,IAAAA,EAAAA,MAAQ;EAAgBJ;EAA6EK,KAAAA,CAAAA,EAAAA,MAAAA;;AAAD;AAQ5H;;;;AAAqK;AAC7IE,iBAhBAR,QAAAA,CAgBAQ,MAAAA,EAhBiBN,cAgB6B,CAhBdD,UAgBuBC,CAAAA,GAhBTC,aAgBqEN,CAAAA,GAAAA,CAAAA,EAAAA,OAAAA,EAAAA,CAAAA,
|
|
1
|
+
{"version":3,"file":"event_source_parse.d.cts","names":["IterableReadableStream","EventStreamContentType","EventSourceMessage","getBytes","Uint8Array","ReadableStream","AsyncIterable","Promise","getLines","ArrayBufferLike","getMessages","convertEventStreamToIterableReadableDataStream"],"sources":["../../src/utils/event_source_parse.d.ts"],"sourcesContent":["import { IterableReadableStream } from \"./stream.js\";\nexport declare const EventStreamContentType = \"text/event-stream\";\n/**\n * Represents a message sent in an event stream\n * https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format\n */\nexport interface EventSourceMessage {\n /** The event ID to set the EventSource object's last event ID value. */\n id: string;\n /** A string identifying the type of event described. */\n event: string;\n /** The event data */\n data: string;\n /** The reconnection interval (in milliseconds) to wait before retrying the connection */\n retry?: number;\n}\n/**\n * Converts a ReadableStream into a callback pattern.\n * @param stream The input ReadableStream.\n * @param onChunk A function that will be called on each new byte chunk in the stream.\n * @returns {Promise<void>} A promise that will be resolved when the stream closes.\n */\nexport declare function getBytes(stream: ReadableStream<Uint8Array> | AsyncIterable<any>, onChunk: (arr: Uint8Array, flush?: boolean) => void): Promise<void>;\n/**\n * Parses arbitary byte chunks into EventSource line buffers.\n * Each line should be of the format \"field: value\" and ends with \\r, \\n, or \\r\\n.\n * @param onLine A function that will be called on each new EventSource line.\n * @returns A function that should be called for each incoming byte chunk.\n */\nexport declare function getLines(onLine: (line: Uint8Array, fieldLength: number, flush?: boolean) => void): (arr: Uint8Array<ArrayBufferLike>, flush?: boolean | undefined) => void;\n/**\n * Parses line buffers into EventSourceMessages.\n * @param onId A function that will be called on each `id` field.\n * @param onRetry A function that will be called on each `retry` field.\n * @param onMessage A function that will be called on each message.\n * @returns A function that should be called for each incoming line buffer.\n */\nexport declare function getMessages(onMessage?: (msg: EventSourceMessage) => void, onId?: (id: string) => void, onRetry?: (retry: number) => void): (line: Uint8Array<ArrayBufferLike>, fieldLength: number, flush?: boolean | undefined) => void;\nexport declare function convertEventStreamToIterableReadableDataStream(stream: ReadableStream, onMetadataEvent?: (e: unknown) => unknown): IterableReadableStream<any>;\n//# sourceMappingURL=event_source_parse.d.ts.map"],"mappings":";;;cACqBC,sBAAAA;;AAArB;AAKA;AAgBA;AAAwDG,UAhBvCF,kBAAAA,CAgBuCE;EAAfC;EAA6BC,EAAAA,EAAAA,MAAAA;EAAmCF;EAAuCG,KAAAA,EAAAA,MAAAA;EAAO;EAO/HC,IAAAA,EAAAA,MAAQ;EAAgBJ;EAA6EK,KAAAA,CAAAA,EAAAA,MAAAA;;AAAD;AAQ5H;;;;AAAqK;AAC7IE,iBAhBAR,QAAAA,CAgBAQ,MAAAA,EAhBiBN,cAgB6B,CAhBdD,UAgBuBC,CAAAA,GAhBTC,aAgBqEN,CAAAA,GAAAA,CAAAA,EAAAA,OAAAA,EAAAA,CAAAA,GAAsB,EAhBxDI,UAgBwD,EAAA,KAAA,CAAA,EAAA,OAAA,EAAA,GAAA,IAAA,CAAA,EAhBjBG,OAgBiB,CAAA,IAAA,CAAA;;;;;;;iBATzIC,QAAAA,gBAAwBJ,kEAAkEA,WAAWK;;;;;;;;iBAQrGC,WAAAA,mBAA8BR,qGAAqGE,WAAWK;iBAC9IE,8CAAAA,SAAuDN,4DAA4DL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.cts","names":["IterableReadableStreamInterface","IterableReadableStream","T","ReadableStreamDefaultReader","IteratorResult","Promise","Symbol","asyncIterator","asyncDispose","ReadableStream","AsyncGenerator","atee","concat","Array","Record","AsyncGeneratorWithSetup","S","TReturn","TNext","AbortSignal","PromiseLike","Error","pipeGeneratorWithSetup","A","U","UReturn","UNext","Awaited"],"sources":["../../src/utils/stream.d.ts"],"sourcesContent":["import type { IterableReadableStreamInterface } from \"../types/_internal.js\";\nexport type { IterableReadableStreamInterface };\nexport declare class IterableReadableStream<T> extends ReadableStream<T> implements IterableReadableStreamInterface<T> {\n reader: ReadableStreamDefaultReader<T>;\n ensureReader(): void;\n next(): Promise<IteratorResult<T>>;\n return(): Promise<IteratorResult<T>>;\n throw(e: any): Promise<IteratorResult<T>>;\n [Symbol.asyncIterator](): this;\n [Symbol.asyncDispose](): Promise<void>;\n static fromReadableStream<T>(stream: ReadableStream<T>): IterableReadableStream<T>;\n static fromAsyncGenerator<T>(generator: AsyncGenerator<T>): IterableReadableStream<T>;\n}\nexport declare function atee<T>(iter: AsyncGenerator<T>, length?: number): AsyncGenerator<T>[];\nexport declare function concat<T extends Array<any> | string | number | Record<string, any> | any>(first: T, second: T): T;\nexport declare class AsyncGeneratorWithSetup<S = unknown, T = unknown, TReturn = unknown, TNext = unknown> implements AsyncGenerator<T, TReturn, TNext> {\n private generator;\n setup: Promise<S>;\n config?: unknown;\n signal?: AbortSignal;\n private firstResult;\n private firstResultUsed;\n constructor(params: {\n generator: AsyncGenerator<T>;\n startSetup?: () => Promise<S>;\n config?: unknown;\n signal?: AbortSignal;\n });\n next(...args: [] | [TNext]): Promise<IteratorResult<T>>;\n return(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T>>;\n throw(e: Error): Promise<IteratorResult<T>>;\n [Symbol.asyncIterator](): this;\n [Symbol.asyncDispose](): Promise<void>;\n}\nexport declare function pipeGeneratorWithSetup<S, A extends unknown[], T, TReturn, TNext, U, UReturn, UNext>(to: (g: AsyncGenerator<T, TReturn, TNext>, s: S, ...args: A) => AsyncGenerator<U, UReturn, UNext>, generator: AsyncGenerator<T, TReturn, TNext>, startSetup: () => Promise<S>, signal: AbortSignal | undefined, ...args: A): Promise<{\n output: AsyncGenerator<U, UReturn, UNext>;\n setup: Awaited<S>;\n}>;\n//# sourceMappingURL=stream.d.ts.map"],"mappings":";;;cAEqBC,kCAAkCQ,eAAeP,cAAcF,gCAAgCE;EAA/FD,MAAAA,EACTE,2BAD+BD,CACHA,
|
|
1
|
+
{"version":3,"file":"stream.d.cts","names":["IterableReadableStreamInterface","IterableReadableStream","T","ReadableStreamDefaultReader","IteratorResult","Promise","Symbol","asyncIterator","asyncDispose","ReadableStream","AsyncGenerator","atee","concat","Array","Record","AsyncGeneratorWithSetup","S","TReturn","TNext","AbortSignal","PromiseLike","Error","pipeGeneratorWithSetup","A","U","UReturn","UNext","Awaited"],"sources":["../../src/utils/stream.d.ts"],"sourcesContent":["import type { IterableReadableStreamInterface } from \"../types/_internal.js\";\nexport type { IterableReadableStreamInterface };\nexport declare class IterableReadableStream<T> extends ReadableStream<T> implements IterableReadableStreamInterface<T> {\n reader: ReadableStreamDefaultReader<T>;\n ensureReader(): void;\n next(): Promise<IteratorResult<T>>;\n return(): Promise<IteratorResult<T>>;\n throw(e: any): Promise<IteratorResult<T>>;\n [Symbol.asyncIterator](): this;\n [Symbol.asyncDispose](): Promise<void>;\n static fromReadableStream<T>(stream: ReadableStream<T>): IterableReadableStream<T>;\n static fromAsyncGenerator<T>(generator: AsyncGenerator<T>): IterableReadableStream<T>;\n}\nexport declare function atee<T>(iter: AsyncGenerator<T>, length?: number): AsyncGenerator<T>[];\nexport declare function concat<T extends Array<any> | string | number | Record<string, any> | any>(first: T, second: T): T;\nexport declare class AsyncGeneratorWithSetup<S = unknown, T = unknown, TReturn = unknown, TNext = unknown> implements AsyncGenerator<T, TReturn, TNext> {\n private generator;\n setup: Promise<S>;\n config?: unknown;\n signal?: AbortSignal;\n private firstResult;\n private firstResultUsed;\n constructor(params: {\n generator: AsyncGenerator<T>;\n startSetup?: () => Promise<S>;\n config?: unknown;\n signal?: AbortSignal;\n });\n next(...args: [] | [TNext]): Promise<IteratorResult<T>>;\n return(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T>>;\n throw(e: Error): Promise<IteratorResult<T>>;\n [Symbol.asyncIterator](): this;\n [Symbol.asyncDispose](): Promise<void>;\n}\nexport declare function pipeGeneratorWithSetup<S, A extends unknown[], T, TReturn, TNext, U, UReturn, UNext>(to: (g: AsyncGenerator<T, TReturn, TNext>, s: S, ...args: A) => AsyncGenerator<U, UReturn, UNext>, generator: AsyncGenerator<T, TReturn, TNext>, startSetup: () => Promise<S>, signal: AbortSignal | undefined, ...args: A): Promise<{\n output: AsyncGenerator<U, UReturn, UNext>;\n setup: Awaited<S>;\n}>;\n//# sourceMappingURL=stream.d.ts.map"],"mappings":";;;cAEqBC,kCAAkCQ,eAAeP,cAAcF,gCAAgCE;EAA/FD,MAAAA,EACTE,2BAD+BD,CACHA,CADG,CAAA;EAA2BA,YAAAA,CAAAA,CAAAA,EAAAA,IAAAA;EAA8CA,IAAAA,CAAAA,CAAAA,EAGxGG,OAHwGH,CAGhGE,cAHgGF,CAGjFA,CAHiFA,CAAAA,CAAAA;EAC5EA,MAAAA,CAAAA,CAAAA,EAG1BG,OAH0BH,CAGlBE,cAHkBF,CAGHA,CAHGA,CAAAA,CAAAA;EAA5BC,KAAAA,CAAAA,CAAAA,EAAAA,GAAAA,CAAAA,EAIOE,OAJPF,CAIeC,cAJfD,CAI8BD,CAJ9BC,CAAAA,CAAAA;EAEuBD,CAG9BI,MAAAA,CAAOC,aAAAA,GAHuBL,EAAAA,IAAAA;EAAfE,CAIfE,MAAAA,CAAOE,YAAAA,GAJQJ,EA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OArBrGvB,EAqB8GwB,KArB9GxB,CAAAA,EAAAA,SAAAA,EAqBiIQ,cArBjIR,CAqBgJA,CArBhJA,EAqBmJe,OArBnJf,EAqB4JgB,KArB5JhB,CAAAA,EAAAA,UAAAA,EAAAA,GAAAA,GAqBsLG,OArBtLH,CAqB8Lc,CArB9Ld,CAAAA,EAAAA,MAAAA,EAqB0MiB,WArB1MjB,GAAAA,SAAAA,EAAAA,GAAAA,IAAAA,EAqB4OqB,CArB5OrB,CAAAA,EAqBgPG,OArBhPH,CAAAA;EAAfQ,MAAAA,EAsB/DA,cAtB+DA,CAsBhDc,CAtBgDd,EAsB7Ce,OAtB6Cf,EAsBpCgB,KAtBoChB,CAAAA;EAAc,KAAA,EAuB9EiB,OAvB8E,CAuBtEX,CAvBsE,CAAA;AACzF,CAAA,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseMessage } from "../../messages/base.cjs";
|
|
2
2
|
import { AIMessage, AIMessageChunk } from "../../messages/ai.cjs";
|
|
3
|
-
import { MessageStructure } from "../../messages/message.cjs";
|
|
3
|
+
import { MessageStructure, MessageToolSet } from "../../messages/message.cjs";
|
|
4
4
|
import { ChatGenerationChunk, ChatResult } from "../../outputs.cjs";
|
|
5
5
|
import { InteropZodType } from "../types/zod.cjs";
|
|
6
6
|
import { CallbackManagerForLLMRun } from "../../callbacks/manager.cjs";
|
|
@@ -57,7 +57,7 @@ declare class FakeStreamingChatModel extends BaseChatModel<FakeStreamingChatMode
|
|
|
57
57
|
...rest
|
|
58
58
|
}: FakeStreamingChatModelFields & BaseLLMParams);
|
|
59
59
|
_llmType(): string;
|
|
60
|
-
bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<MessageStructure
|
|
60
|
+
bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<MessageStructure<MessageToolSet>>, FakeStreamingChatModelCallOptions>;
|
|
61
61
|
_generate(messages: BaseMessage[], _options: this["ParsedCallOptions"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
62
62
|
_streamResponseChunks(_messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
|
|
63
63
|
}
|
|
@@ -115,7 +115,7 @@ declare class FakeListChatModel extends BaseChatModel<FakeListChatModelCallOptio
|
|
|
115
115
|
_llmType(): string;
|
|
116
116
|
_generate(_messages: BaseMessage[], options?: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
117
117
|
_formatGeneration(text: string): {
|
|
118
|
-
message: AIMessage<MessageStructure
|
|
118
|
+
message: AIMessage<MessageStructure<MessageToolSet>>;
|
|
119
119
|
text: string;
|
|
120
120
|
};
|
|
121
121
|
_streamResponseChunks(_messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
|
|
@@ -124,7 +124,7 @@ declare class FakeListChatModel extends BaseChatModel<FakeListChatModelCallOptio
|
|
|
124
124
|
_createResponseChunk(text: string, generationInfo?: Record<string, any>): ChatGenerationChunk;
|
|
125
125
|
_currentResponse(): string;
|
|
126
126
|
_incrementResponse(): void;
|
|
127
|
-
bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<MessageStructure
|
|
127
|
+
bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<MessageStructure<MessageToolSet>>, FakeListChatModelCallOptions>;
|
|
128
128
|
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_params: StructuredOutputMethodParams<RunOutput, false> | InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
129
129
|
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_params: StructuredOutputMethodParams<RunOutput, true> | InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
130
130
|
raw: BaseMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_models.d.cts","names":["CallbackManagerForLLMRun","BaseChatModel","BaseChatModelCallOptions","BaseChatModelParams","BaseLLMParams","BaseMessage","AIMessage","AIMessageChunk","ChatResult","ChatGenerationChunk","Runnable","StructuredTool","StructuredOutputMethodParams","BaseLanguageModelInput","StructuredOutputMethodOptions","InteropZodType","ToolSpec","Record","FakeStreamingChatModelCallOptions","FakeStreamingChatModelFields","FakeChatModel","Promise","FakeStreamingChatModel","sleep","responses","chunks","toolStyle","thrownErrorString","______messages_message_js0","MessageStructure","AsyncGenerator","FakeChatInput","FakeListChatModelCallOptions","FakeListChatModel","RunOutput"],"sources":["../../../src/utils/testing/chat_models.d.ts"],"sourcesContent":["import { CallbackManagerForLLMRun } from \"../../callbacks/manager.js\";\nimport { BaseChatModel, BaseChatModelCallOptions, BaseChatModelParams } from \"../../language_models/chat_models.js\";\nimport { BaseLLMParams } from \"../../language_models/llms.js\";\nimport { BaseMessage, AIMessage, AIMessageChunk } from \"../../messages/index.js\";\nimport { type ChatResult, ChatGenerationChunk } from \"../../outputs.js\";\nimport { Runnable } from \"../../runnables/base.js\";\nimport { StructuredTool } from \"../../tools/index.js\";\nimport { StructuredOutputMethodParams, BaseLanguageModelInput, StructuredOutputMethodOptions } from \"../../language_models/base.js\";\nimport { InteropZodType } from \"../types/zod.js\";\n/** Minimal shape actually needed by `bindTools` */\nexport interface ToolSpec {\n name: string;\n description?: string;\n schema: InteropZodType | Record<string, unknown>;\n}\n/**\n * Interface specific to the Fake Streaming Chat model.\n */\nexport interface FakeStreamingChatModelCallOptions extends BaseChatModelCallOptions {\n}\n/**\n * Interface for the Constructor-field specific to the Fake Streaming Chat model (all optional because we fill in defaults).\n */\nexport interface FakeStreamingChatModelFields extends BaseChatModelParams {\n /** Milliseconds to pause between fallback char-by-char chunks */\n sleep?: number;\n /** Full AI messages to fall back to when no `chunks` supplied */\n responses?: BaseMessage[];\n /** Exact chunks to emit (can include tool-call deltas) */\n chunks?: AIMessageChunk[];\n /** How tool specs are formatted in `bindTools` */\n toolStyle?: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n /** Throw this error instead of streaming (useful in tests) */\n thrownErrorString?: string;\n}\nexport declare class FakeChatModel extends BaseChatModel {\n _combineLLMOutput(): never[];\n _llmType(): string;\n _generate(messages: BaseMessage[], options?: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n}\nexport declare class FakeStreamingChatModel extends BaseChatModel<FakeStreamingChatModelCallOptions> {\n sleep: number;\n responses: BaseMessage[];\n chunks: AIMessageChunk[];\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n thrownErrorString?: string;\n private tools;\n constructor({ sleep, responses, chunks, toolStyle, thrownErrorString, ...rest }: FakeStreamingChatModelFields & BaseLLMParams);\n _llmType(): string;\n bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<import(\"../../messages/message.js\").MessageStructure>, FakeStreamingChatModelCallOptions>;\n _generate(messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n _streamResponseChunks(_messages: BaseMessage[], options: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;\n}\n/**\n * Interface for the input parameters specific to the Fake List Chat model.\n */\nexport interface FakeChatInput extends BaseChatModelParams {\n /** Responses to return */\n responses: string[];\n /** Time to sleep in milliseconds between responses */\n sleep?: number;\n emitCustomEvent?: boolean;\n /**\n * Generation info to include on the last chunk during streaming.\n * This gets merged into response_metadata by the base chat model.\n * Useful for testing response_metadata propagation (e.g., finish_reason).\n */\n generationInfo?: Record<string, unknown>;\n}\nexport interface FakeListChatModelCallOptions extends BaseChatModelCallOptions {\n thrownErrorString?: string;\n}\n/**\n * A fake Chat Model that returns a predefined list of responses. It can be used\n * for testing purposes.\n * @example\n * ```typescript\n * const chat = new FakeListChatModel({\n * responses: [\"I'll callback later.\", \"You 'console' them!\"]\n * });\n *\n * const firstMessage = new HumanMessage(\"You want to hear a JavaScript joke?\");\n * const secondMessage = new HumanMessage(\"How do you cheer up a JavaScript developer?\");\n *\n * // Call the chat model with a message and log the response\n * const firstResponse = await chat.call([firstMessage]);\n * console.log({ firstResponse });\n *\n * const secondResponse = await chat.call([secondMessage]);\n * console.log({ secondResponse });\n * ```\n */\nexport declare class FakeListChatModel extends BaseChatModel<FakeListChatModelCallOptions> {\n static lc_name(): string;\n lc_serializable: boolean;\n responses: string[];\n i: number;\n sleep?: number;\n emitCustomEvent: boolean;\n generationInfo?: Record<string, unknown>;\n private tools;\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n constructor(params: FakeChatInput);\n _combineLLMOutput(): never[];\n _llmType(): string;\n _generate(_messages: BaseMessage[], options?: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n _formatGeneration(text: string): {\n message: AIMessage<import(\"../../messages/message.js\").MessageStructure>;\n text: string;\n };\n _streamResponseChunks(_messages: BaseMessage[], options: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;\n _sleepIfRequested(): Promise<void>;\n _sleep(): Promise<void>;\n _createResponseChunk(text: string, generationInfo?: Record<string, any>): ChatGenerationChunk;\n _currentResponse(): string;\n _incrementResponse(): void;\n bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<import(\"../../messages/message.js\").MessageStructure>, FakeListChatModelCallOptions>;\n withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_params: StructuredOutputMethodParams<RunOutput, false> | InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;\n withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_params: StructuredOutputMethodParams<RunOutput, true> | InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {\n raw: BaseMessage;\n parsed: RunOutput;\n }>;\n}\n//# sourceMappingURL=chat_models.d.ts.map"],"mappings":";;;;;;;;;;;;;;UAUiBgB,QAAAA;;;EAAAA,MAAAA,EAGLD,cAHa,GAGIE,MAAjBF,CAAAA,MAAAA,EAAiBE,OAAM,CAAA;AAKnC;AAKA;;;AAAsDd,UALrCe,iCAAAA,SAA0ChB,wBAKLC,CAAAA,CAAmB;AAYzE;;;AAG4HK,UAf3GW,4BAAAA,SAAqChB,mBAesEK,CAAAA;EAARa;EAHzEpB,KAAAA,CAAAA,EAAAA,MAAAA;EAAa;EAKnCqB,SAAAA,CAAAA,EAbLjB,WAaKiB,EAAsB;EAAuBJ;EAEnDb,MAAAA,CAAAA,EAbFE,cAaEF,EAAAA;EACHE;EAIMgB,SAAAA,CAAAA,EAAAA,QAAAA,GAAAA,WAAAA,GAAAA,SAAAA,GAAAA,QAAAA;EAAOC;EAAWC,iBAAAA,CAAAA,EAAAA,MAAAA;;AAAmBE,cAZlCP,aAAAA,SAAsBnB,aAAAA,CAYY0B;EAA8BR,iBAAAA,CAAAA,CAAAA,EAAAA,KAAAA,EAAAA;EAA+Bf,QAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAE9FO,SAAAA,CAAAA,QAAAA,EAXEN,WAWFM,EAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA,CAAAA,mBAAAA,CAAAA,EAAAA,UAAAA,CAAAA,EAXmEX,wBAWnEW,CAAAA,EAX8FU,OAW9FV,CAXsGH,UAWtGG,CAAAA;;AAAwCE,cATzCS,sBAAAA,SAA+BrB,aASUY,CATIK,iCASJL,CAAAA,CAAAA;;EAAwBN,SAAAA,EAPvEF,WAOuEE,EAAAA;EA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B,sBAAsBA,8BAA8BL,6BAA6BsB,mBAAmBnB,eAAemB,aAAajB,8BAA8BH,sCAAsCJ,SAASG;SAC3OR;YACG6B"}
|
|
1
|
+
{"version":3,"file":"chat_models.d.cts","names":["CallbackManagerForLLMRun","BaseChatModel","BaseChatModelCallOptions","BaseChatModelParams","BaseLLMParams","BaseMessage","AIMessage","AIMessageChunk","ChatResult","ChatGenerationChunk","Runnable","StructuredTool","StructuredOutputMethodParams","BaseLanguageModelInput","StructuredOutputMethodOptions","InteropZodType","ToolSpec","Record","FakeStreamingChatModelCallOptions","FakeStreamingChatModelFields","FakeChatModel","Promise","FakeStreamingChatModel","sleep","responses","chunks","toolStyle","thrownErrorString","______messages_message_js0","MessageToolSet","MessageStructure","AsyncGenerator","FakeChatInput","FakeListChatModelCallOptions","FakeListChatModel","RunOutput"],"sources":["../../../src/utils/testing/chat_models.d.ts"],"sourcesContent":["import { CallbackManagerForLLMRun } from \"../../callbacks/manager.js\";\nimport { BaseChatModel, BaseChatModelCallOptions, BaseChatModelParams } from \"../../language_models/chat_models.js\";\nimport { BaseLLMParams } from \"../../language_models/llms.js\";\nimport { BaseMessage, AIMessage, AIMessageChunk } from \"../../messages/index.js\";\nimport { type ChatResult, ChatGenerationChunk } from \"../../outputs.js\";\nimport { Runnable } from \"../../runnables/base.js\";\nimport { StructuredTool } from \"../../tools/index.js\";\nimport { StructuredOutputMethodParams, BaseLanguageModelInput, StructuredOutputMethodOptions } from \"../../language_models/base.js\";\nimport { InteropZodType } from \"../types/zod.js\";\n/** Minimal shape actually needed by `bindTools` */\nexport interface ToolSpec {\n name: string;\n description?: string;\n schema: InteropZodType | Record<string, unknown>;\n}\n/**\n * Interface specific to the Fake Streaming Chat model.\n */\nexport interface FakeStreamingChatModelCallOptions extends BaseChatModelCallOptions {\n}\n/**\n * Interface for the Constructor-field specific to the Fake Streaming Chat model (all optional because we fill in defaults).\n */\nexport interface FakeStreamingChatModelFields extends BaseChatModelParams {\n /** Milliseconds to pause between fallback char-by-char chunks */\n sleep?: number;\n /** Full AI messages to fall back to when no `chunks` supplied */\n responses?: BaseMessage[];\n /** Exact chunks to emit (can include tool-call deltas) */\n chunks?: AIMessageChunk[];\n /** How tool specs are formatted in `bindTools` */\n toolStyle?: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n /** Throw this error instead of streaming (useful in tests) */\n thrownErrorString?: string;\n}\nexport declare class FakeChatModel extends BaseChatModel {\n _combineLLMOutput(): never[];\n _llmType(): string;\n _generate(messages: BaseMessage[], options?: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n}\nexport declare class FakeStreamingChatModel extends BaseChatModel<FakeStreamingChatModelCallOptions> {\n sleep: number;\n responses: BaseMessage[];\n chunks: AIMessageChunk[];\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n thrownErrorString?: string;\n private tools;\n constructor({ sleep, responses, chunks, toolStyle, thrownErrorString, ...rest }: FakeStreamingChatModelFields & BaseLLMParams);\n _llmType(): string;\n bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<import(\"../../messages/message.js\").MessageStructure<import(\"../../messages/message.js\").MessageToolSet>>, FakeStreamingChatModelCallOptions>;\n _generate(messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n _streamResponseChunks(_messages: BaseMessage[], options: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;\n}\n/**\n * Interface for the input parameters specific to the Fake List Chat model.\n */\nexport interface FakeChatInput extends BaseChatModelParams {\n /** Responses to return */\n responses: string[];\n /** Time to sleep in milliseconds between responses */\n sleep?: number;\n emitCustomEvent?: boolean;\n /**\n * Generation info to include on the last chunk during streaming.\n * This gets merged into response_metadata by the base chat model.\n * Useful for testing response_metadata propagation (e.g., finish_reason).\n */\n generationInfo?: Record<string, unknown>;\n}\nexport interface FakeListChatModelCallOptions extends BaseChatModelCallOptions {\n thrownErrorString?: string;\n}\n/**\n * A fake Chat Model that returns a predefined list of responses. It can be used\n * for testing purposes.\n * @example\n * ```typescript\n * const chat = new FakeListChatModel({\n * responses: [\"I'll callback later.\", \"You 'console' them!\"]\n * });\n *\n * const firstMessage = new HumanMessage(\"You want to hear a JavaScript joke?\");\n * const secondMessage = new HumanMessage(\"How do you cheer up a JavaScript developer?\");\n *\n * // Call the chat model with a message and log the response\n * const firstResponse = await chat.call([firstMessage]);\n * console.log({ firstResponse });\n *\n * const secondResponse = await chat.call([secondMessage]);\n * console.log({ secondResponse });\n * ```\n */\nexport declare class FakeListChatModel extends BaseChatModel<FakeListChatModelCallOptions> {\n static lc_name(): string;\n lc_serializable: boolean;\n responses: string[];\n i: number;\n sleep?: number;\n emitCustomEvent: boolean;\n generationInfo?: Record<string, unknown>;\n private tools;\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n constructor(params: FakeChatInput);\n _combineLLMOutput(): never[];\n _llmType(): string;\n _generate(_messages: BaseMessage[], options?: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n _formatGeneration(text: string): {\n message: AIMessage<import(\"../../messages/message.js\").MessageStructure<import(\"../../messages/message.js\").MessageToolSet>>;\n text: string;\n };\n _streamResponseChunks(_messages: BaseMessage[], options: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;\n _sleepIfRequested(): Promise<void>;\n _sleep(): Promise<void>;\n _createResponseChunk(text: string, generationInfo?: Record<string, any>): ChatGenerationChunk;\n _currentResponse(): string;\n _incrementResponse(): void;\n bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<import(\"../../messages/message.js\").MessageStructure<import(\"../../messages/message.js\").MessageToolSet>>, FakeListChatModelCallOptions>;\n withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_params: StructuredOutputMethodParams<RunOutput, false> | InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;\n withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_params: StructuredOutputMethodParams<RunOutput, true> | InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {\n raw: BaseMessage;\n parsed: RunOutput;\n }>;\n}\n//# sourceMappingURL=chat_models.d.ts.map"],"mappings":";;;;;;;;;;;;;;UAUiBgB,QAAAA;;;EAAAA,MAAAA,EAGLD,cAHa,GAGIE,MAAjBF,CAAAA,MAAAA,EAAiBE,OAAM,CAAA;AAKnC;AAKA;;;AAAsDd,UALrCe,iCAAAA,SAA0ChB,wBAKLC,CAAAA,CAAmB;AAYzE;;;AAG4HK,UAf3GW,4BAAAA,SAAqChB,mBAesEK,CAAAA;EAARa;EAHzEpB,KAAAA,CAAAA,EAAAA,MAAAA;EAAa;EAKnCqB,SAAAA,CAAAA,EAbLjB,WAaKiB,EAAsB;EAAuBJ;EAEnDb,MAAAA,CAAAA,EAbFE,cAaEF,EAAAA;EACHE;EAIMgB,SAAAA,CAAAA,EAAAA,QAAAA,GAAAA,WAAAA,GAAAA,SAAAA,GAAAA,QAAAA;EAAOC;EAAWC,iBAAAA,CAAAA,EAAAA,MAAAA;;AAAmBE,cAZlCP,aAAAA,SAAsBnB,aAAAA,CAYY0B;EAA8BR,iBAAAA,CAAAA,CAAAA,EAAAA,KAAAA,EAAAA;EAA+Bf,QAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAE9FO,SAAAA,CAAAA,QAAAA,EAXEN,WAWFM,EAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA,CAAAA,mBAAAA,CAAAA,EAAAA,UAAAA,CAAAA,EAXmEX,wBAWnEW,CAAAA,EAX8FU,OAW9FV,CAXsGH,UAWtGG,CAAAA;;AAAwCE,cATzCS,sBAAAA,SAA+BrB,a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8BAA8BL,6BAA6BuB,oBAAoBpB,eAAeoB,aAAalB,8BAA8BH,uCAAuCJ,SAASG,wBAAwBsB;yCACvOlB,sBAAsBA,8BAA8BL,6BAA6BuB,mBAAmBpB,eAAeoB,aAAalB,8BAA8BH,sCAAsCJ,SAASG;SAC3OR;YACG8B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseMessage } from "../../messages/base.js";
|
|
2
2
|
import { AIMessage, AIMessageChunk } from "../../messages/ai.js";
|
|
3
|
-
import { MessageStructure } from "../../messages/message.js";
|
|
3
|
+
import { MessageStructure, MessageToolSet } from "../../messages/message.js";
|
|
4
4
|
import { ChatGenerationChunk, ChatResult } from "../../outputs.js";
|
|
5
5
|
import { InteropZodType } from "../types/zod.js";
|
|
6
6
|
import { CallbackManagerForLLMRun } from "../../callbacks/manager.js";
|
|
@@ -58,7 +58,7 @@ declare class FakeStreamingChatModel extends BaseChatModel<FakeStreamingChatMode
|
|
|
58
58
|
...rest
|
|
59
59
|
}: FakeStreamingChatModelFields & BaseLLMParams);
|
|
60
60
|
_llmType(): string;
|
|
61
|
-
bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<MessageStructure
|
|
61
|
+
bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<MessageStructure<MessageToolSet>>, FakeStreamingChatModelCallOptions>;
|
|
62
62
|
_generate(messages: BaseMessage[], _options: this["ParsedCallOptions"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
63
63
|
_streamResponseChunks(_messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
|
|
64
64
|
}
|
|
@@ -116,7 +116,7 @@ declare class FakeListChatModel extends BaseChatModel<FakeListChatModelCallOptio
|
|
|
116
116
|
_llmType(): string;
|
|
117
117
|
_generate(_messages: BaseMessage[], options?: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
118
118
|
_formatGeneration(text: string): {
|
|
119
|
-
message: AIMessage<MessageStructure
|
|
119
|
+
message: AIMessage<MessageStructure<MessageToolSet>>;
|
|
120
120
|
text: string;
|
|
121
121
|
};
|
|
122
122
|
_streamResponseChunks(_messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
|
|
@@ -125,7 +125,7 @@ declare class FakeListChatModel extends BaseChatModel<FakeListChatModelCallOptio
|
|
|
125
125
|
_createResponseChunk(text: string, generationInfo?: Record<string, any>): ChatGenerationChunk;
|
|
126
126
|
_currentResponse(): string;
|
|
127
127
|
_incrementResponse(): void;
|
|
128
|
-
bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<MessageStructure
|
|
128
|
+
bindTools(tools: (StructuredTool | ToolSpec)[]): Runnable<BaseLanguageModelInput, AIMessageChunk<MessageStructure<MessageToolSet>>, FakeListChatModelCallOptions>;
|
|
129
129
|
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_params: StructuredOutputMethodParams<RunOutput, false> | InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
130
130
|
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_params: StructuredOutputMethodParams<RunOutput, true> | InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
131
131
|
raw: BaseMessage;
|