langchain 0.0.146 → 0.0.148

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.
Files changed (168) hide show
  1. package/chat_models/googlevertexai/web.cjs +1 -0
  2. package/chat_models/googlevertexai/web.d.ts +1 -0
  3. package/chat_models/googlevertexai/web.js +1 -0
  4. package/chat_models/googlevertexai.cjs +1 -1
  5. package/chat_models/googlevertexai.d.ts +1 -1
  6. package/chat_models/googlevertexai.js +1 -1
  7. package/dist/base_language/index.cjs +2 -2
  8. package/dist/base_language/index.d.ts +2 -1
  9. package/dist/base_language/index.js +1 -1
  10. package/dist/chains/base.d.ts +1 -1
  11. package/dist/chains/constitutional_ai/constitutional_principle.cjs +272 -1
  12. package/dist/chains/constitutional_ai/constitutional_principle.js +272 -1
  13. package/dist/chains/openai_functions/openapi.cjs +32 -27
  14. package/dist/chains/openai_functions/openapi.d.ts +9 -0
  15. package/dist/chains/openai_functions/openapi.js +31 -27
  16. package/dist/chat_models/base.d.ts +1 -1
  17. package/dist/chat_models/{googlevertexai.cjs → googlevertexai/common.cjs} +14 -26
  18. package/dist/chat_models/{googlevertexai.d.ts → googlevertexai/common.d.ts} +13 -22
  19. package/dist/chat_models/{googlevertexai.js → googlevertexai/common.js} +12 -24
  20. package/dist/chat_models/googlevertexai/index.cjs +36 -0
  21. package/dist/chat_models/googlevertexai/index.d.ts +21 -0
  22. package/dist/chat_models/googlevertexai/index.js +31 -0
  23. package/dist/chat_models/googlevertexai/web.cjs +33 -0
  24. package/dist/chat_models/googlevertexai/web.d.ts +19 -0
  25. package/dist/chat_models/googlevertexai/web.js +28 -0
  26. package/dist/chat_models/openai.cjs +1 -1
  27. package/dist/chat_models/openai.js +1 -1
  28. package/dist/document_loaders/web/notionapi.cjs +93 -70
  29. package/dist/document_loaders/web/notionapi.d.ts +33 -1
  30. package/dist/document_loaders/web/notionapi.js +89 -71
  31. package/dist/embeddings/googlevertexai.cjs +5 -1
  32. package/dist/embeddings/googlevertexai.d.ts +2 -1
  33. package/dist/embeddings/googlevertexai.js +5 -1
  34. package/dist/evaluation/agents/index.cjs +17 -0
  35. package/dist/evaluation/agents/index.d.ts +1 -0
  36. package/dist/evaluation/agents/index.js +1 -0
  37. package/dist/evaluation/agents/prompt.cjs +132 -0
  38. package/dist/evaluation/agents/prompt.d.ts +6 -0
  39. package/dist/evaluation/agents/prompt.js +129 -0
  40. package/dist/evaluation/agents/trajectory.cjs +189 -0
  41. package/dist/evaluation/agents/trajectory.d.ts +54 -0
  42. package/dist/evaluation/agents/trajectory.js +184 -0
  43. package/dist/evaluation/base.cjs +274 -0
  44. package/dist/evaluation/base.d.ts +232 -0
  45. package/dist/evaluation/base.js +263 -0
  46. package/dist/evaluation/comparison/index.cjs +17 -0
  47. package/dist/evaluation/comparison/index.d.ts +1 -0
  48. package/dist/evaluation/comparison/index.js +1 -0
  49. package/dist/evaluation/comparison/pairwise.cjs +244 -0
  50. package/dist/evaluation/comparison/pairwise.d.ts +50 -0
  51. package/dist/evaluation/comparison/pairwise.js +238 -0
  52. package/dist/evaluation/comparison/prompt.cjs +74 -0
  53. package/dist/evaluation/comparison/prompt.d.ts +21 -0
  54. package/dist/evaluation/comparison/prompt.js +71 -0
  55. package/dist/evaluation/criteria/criteria.cjs +259 -0
  56. package/dist/evaluation/criteria/criteria.d.ts +73 -0
  57. package/dist/evaluation/criteria/criteria.js +253 -0
  58. package/dist/evaluation/criteria/index.cjs +17 -0
  59. package/dist/evaluation/criteria/index.d.ts +1 -0
  60. package/dist/evaluation/criteria/index.js +1 -0
  61. package/dist/evaluation/criteria/prompt.cjs +36 -0
  62. package/dist/evaluation/criteria/prompt.d.ts +12 -0
  63. package/dist/evaluation/criteria/prompt.js +33 -0
  64. package/dist/evaluation/embedding_distance/base.cjs +163 -0
  65. package/dist/evaluation/embedding_distance/base.d.ts +78 -0
  66. package/dist/evaluation/embedding_distance/base.js +156 -0
  67. package/dist/evaluation/embedding_distance/index.cjs +17 -0
  68. package/dist/evaluation/embedding_distance/index.d.ts +1 -0
  69. package/dist/evaluation/embedding_distance/index.js +1 -0
  70. package/dist/evaluation/index.cjs +6 -0
  71. package/dist/evaluation/index.d.ts +6 -0
  72. package/dist/evaluation/index.js +6 -0
  73. package/dist/evaluation/loader.cjs +60 -0
  74. package/dist/evaluation/loader.d.ts +27 -0
  75. package/dist/evaluation/loader.js +56 -0
  76. package/dist/evaluation/types.cjs +2 -0
  77. package/dist/evaluation/types.d.ts +35 -0
  78. package/dist/evaluation/types.js +1 -0
  79. package/dist/experimental/llms/bittensor.cjs +141 -0
  80. package/dist/experimental/llms/bittensor.d.ts +33 -0
  81. package/dist/experimental/llms/bittensor.js +137 -0
  82. package/dist/experimental/multimodal_embeddings/googlevertexai.cjs +5 -1
  83. package/dist/experimental/multimodal_embeddings/googlevertexai.d.ts +2 -1
  84. package/dist/experimental/multimodal_embeddings/googlevertexai.js +5 -1
  85. package/dist/hub.d.ts +1 -1
  86. package/dist/llms/base.d.ts +1 -1
  87. package/dist/llms/{googlevertexai.js → googlevertexai/common.cjs} +21 -17
  88. package/dist/llms/{googlevertexai.d.ts → googlevertexai/common.d.ts} +13 -23
  89. package/dist/llms/{googlevertexai.cjs → googlevertexai/common.js} +17 -21
  90. package/dist/llms/googlevertexai/index.cjs +34 -0
  91. package/dist/llms/googlevertexai/index.d.ts +26 -0
  92. package/dist/llms/googlevertexai/index.js +30 -0
  93. package/dist/llms/googlevertexai/web.cjs +31 -0
  94. package/dist/llms/googlevertexai/web.d.ts +24 -0
  95. package/dist/llms/googlevertexai/web.js +27 -0
  96. package/dist/llms/openai-chat.cjs +1 -1
  97. package/dist/llms/openai-chat.js +1 -1
  98. package/dist/llms/openai.cjs +1 -1
  99. package/dist/llms/openai.js +1 -1
  100. package/dist/load/import_constants.cjs +3 -0
  101. package/dist/load/import_constants.js +3 -0
  102. package/dist/load/import_map.cjs +3 -2
  103. package/dist/load/import_map.d.ts +2 -1
  104. package/dist/load/import_map.js +2 -1
  105. package/dist/load/index.cjs +2 -1
  106. package/dist/load/index.js +2 -1
  107. package/dist/load/serializable.cjs +23 -4
  108. package/dist/load/serializable.js +23 -4
  109. package/dist/prompts/base.cjs +2 -2
  110. package/dist/prompts/base.d.ts +1 -1
  111. package/dist/prompts/base.js +1 -1
  112. package/dist/prompts/chat.cjs +2 -2
  113. package/dist/prompts/chat.d.ts +1 -1
  114. package/dist/prompts/chat.js +1 -1
  115. package/dist/retrievers/multi_query.cjs +140 -0
  116. package/dist/retrievers/multi_query.d.ts +33 -0
  117. package/dist/retrievers/multi_query.js +136 -0
  118. package/dist/schema/document.cjs +2 -2
  119. package/dist/schema/document.d.ts +1 -1
  120. package/dist/schema/document.js +1 -1
  121. package/dist/schema/output_parser.cjs +2 -2
  122. package/dist/schema/output_parser.d.ts +2 -1
  123. package/dist/schema/output_parser.js +1 -1
  124. package/dist/schema/retriever.cjs +2 -2
  125. package/dist/schema/retriever.d.ts +2 -1
  126. package/dist/schema/retriever.js +1 -1
  127. package/dist/schema/runnable/config.cjs +8 -0
  128. package/dist/schema/runnable/config.d.ts +3 -0
  129. package/dist/schema/runnable/config.js +4 -0
  130. package/dist/schema/{runnable.cjs → runnable/index.cjs} +290 -101
  131. package/dist/schema/{runnable.d.ts → runnable/index.d.ts} +127 -41
  132. package/dist/schema/{runnable.js → runnable/index.js} +284 -99
  133. package/dist/tools/base.d.ts +1 -1
  134. package/dist/types/googlevertexai-types.d.ts +11 -4
  135. package/dist/util/async_caller.cjs +35 -25
  136. package/dist/util/async_caller.d.ts +8 -0
  137. package/dist/util/async_caller.js +35 -25
  138. package/dist/util/googlevertexai-connection.cjs +14 -15
  139. package/dist/util/googlevertexai-connection.d.ts +7 -7
  140. package/dist/util/googlevertexai-connection.js +14 -15
  141. package/dist/util/googlevertexai-webauth.cjs +56 -0
  142. package/dist/util/googlevertexai-webauth.d.ts +25 -0
  143. package/dist/util/googlevertexai-webauth.js +52 -0
  144. package/dist/vectorstores/googlevertexai.cjs +9 -8
  145. package/dist/vectorstores/googlevertexai.d.ts +8 -7
  146. package/dist/vectorstores/googlevertexai.js +9 -8
  147. package/dist/vectorstores/pinecone.cjs +30 -22
  148. package/dist/vectorstores/pinecone.d.ts +3 -1
  149. package/dist/vectorstores/pinecone.js +30 -22
  150. package/dist/vectorstores/vectara.cjs +20 -23
  151. package/dist/vectorstores/vectara.d.ts +9 -2
  152. package/dist/vectorstores/vectara.js +20 -23
  153. package/experimental/llms/bittensor.cjs +1 -0
  154. package/experimental/llms/bittensor.d.ts +1 -0
  155. package/experimental/llms/bittensor.js +1 -0
  156. package/llms/googlevertexai/web.cjs +1 -0
  157. package/llms/googlevertexai/web.d.ts +1 -0
  158. package/llms/googlevertexai/web.js +1 -0
  159. package/llms/googlevertexai.cjs +1 -1
  160. package/llms/googlevertexai.d.ts +1 -1
  161. package/llms/googlevertexai.js +1 -1
  162. package/package.json +40 -3
  163. package/retrievers/multi_query.cjs +1 -0
  164. package/retrievers/multi_query.d.ts +1 -0
  165. package/retrievers/multi_query.js +1 -0
  166. package/schema/runnable.cjs +1 -1
  167. package/schema/runnable.d.ts +1 -1
  168. package/schema/runnable.js +1 -1
@@ -1,11 +1,20 @@
1
- import { BaseCallbackConfig, CallbackManager, CallbackManagerForChainRun } from "../callbacks/manager.js";
2
- import { Serializable } from "../load/serializable.js";
3
- import { IterableReadableStream } from "../util/stream.js";
4
- export type RunnableConfig = BaseCallbackConfig;
1
+ import { CallbackManager, CallbackManagerForChainRun, BaseCallbackConfig } from "../../callbacks/manager.js";
2
+ import { Serializable } from "../../load/serializable.js";
3
+ import { IterableReadableStream } from "../../util/stream.js";
4
+ import { RunnableConfig as _RunnableConfig } from "./config.js";
5
+ export type RunnableConfig = _RunnableConfig;
5
6
  export type RunnableFunc<RunInput, RunOutput> = (input: RunInput) => RunOutput | Promise<RunOutput>;
6
7
  export type RunnableLike<RunInput = any, RunOutput = any> = Runnable<RunInput, RunOutput> | RunnableFunc<RunInput, RunOutput> | {
7
8
  [key: string]: RunnableLike<RunInput, RunOutput>;
8
9
  };
10
+ export type RunnableBatchOptions = {
11
+ maxConcurrency?: number;
12
+ returnExceptions?: boolean;
13
+ };
14
+ export type RunnableRetryFailedAttemptHandler = (error: any) => any;
15
+ type RunnableConfigAndOptions = RunnableConfig & {
16
+ runType?: string;
17
+ };
9
18
  /**
10
19
  * A Runnable is a generic unit of work that can be invoked, batched, streamed, and/or
11
20
  * transformed.
@@ -19,6 +28,15 @@ export declare abstract class Runnable<RunInput = any, RunOutput = any, CallOpti
19
28
  * @returns A new RunnableBinding that, when invoked, will apply the bound args.
20
29
  */
21
30
  bind(kwargs: Partial<CallOptions>): RunnableBinding<RunInput, RunOutput, CallOptions>;
31
+ /**
32
+ * Bind arguments to a Runnable, returning a new Runnable.
33
+ * @param kwargs
34
+ * @returns A new RunnableBinding that, when invoked, will apply the bound args.
35
+ */
36
+ withRetry(fields?: {
37
+ stopAfterAttempt?: number;
38
+ onFailedAttempt?: RunnableRetryFailedAttemptHandler;
39
+ }): RunnableRetry<RunInput, RunOutput, CallOptions>;
22
40
  /**
23
41
  * Create a new runnable from the current one that will try invoking
24
42
  * other passed fallback runnables if the initial invocation fails.
@@ -35,11 +53,16 @@ export declare abstract class Runnable<RunInput = any, RunOutput = any, CallOpti
35
53
  * @param inputs Array of inputs to each batch call.
36
54
  * @param options Either a single call options object to apply to each batch call or an array for each call.
37
55
  * @param batchOptions.maxConcurrency Maximum number of calls to run at once.
38
- * @returns An array of RunOutputs
56
+ * @param batchOptions.returnExceptions Whether to return errors rather than throwing on the first one
57
+ * @returns An array of RunOutputs, or mixed RunOutputs and errors if batchOptions.returnExceptions is set
39
58
  */
40
- batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: {
41
- maxConcurrency?: number;
59
+ batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
60
+ returnExceptions?: false;
42
61
  }): Promise<RunOutput[]>;
62
+ batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
63
+ returnExceptions: true;
64
+ }): Promise<(RunOutput | Error)[]>;
65
+ batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
43
66
  /**
44
67
  * Default streaming implementation.
45
68
  * Subclasses should override this method if they support streaming output.
@@ -55,9 +78,17 @@ export declare abstract class Runnable<RunInput = any, RunOutput = any, CallOpti
55
78
  */
56
79
  stream(input: RunInput, options?: Partial<CallOptions>): Promise<IterableReadableStream<RunOutput>>;
57
80
  protected _separateRunnableConfigFromCallOptions(options?: Partial<CallOptions>): [RunnableConfig, Omit<Partial<CallOptions>, keyof RunnableConfig>];
58
- protected _callWithConfig<T extends RunInput>(func: (input: T) => Promise<RunOutput>, input: T, options?: RunnableConfig & {
59
- runType?: string;
60
- }): Promise<RunOutput>;
81
+ protected _callWithConfig<T extends RunInput>(func: ((input: T) => Promise<RunOutput>) | ((input: T, config?: RunnableConfig, runManager?: CallbackManagerForChainRun) => Promise<RunOutput>), input: T, options?: RunnableConfigAndOptions): Promise<RunOutput>;
82
+ /**
83
+ * Internal method that handles batching and configuration for a runnable
84
+ * It takes a function, input values, and optional configuration, and
85
+ * returns a promise that resolves to the output values.
86
+ * @param func The function to be executed for each input value.
87
+ * @param input The input values to be processed.
88
+ * @param config Optional configuration for the function execution.
89
+ * @returns A promise that resolves to the output values.
90
+ */
91
+ _batchWithConfig<T extends RunInput>(func: (inputs: T[], configs?: RunnableConfig[], runManagers?: (CallbackManagerForChainRun | undefined)[], batchOptions?: RunnableBatchOptions) => Promise<(RunOutput | Error)[]>, inputs: T[], options?: Partial<RunnableConfigAndOptions> | Partial<RunnableConfigAndOptions>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
61
92
  /**
62
93
  * Helper method to transform an Iterator of Input values into an Iterator of
63
94
  * Output values, with callbacks.
@@ -73,7 +104,7 @@ export declare abstract class Runnable<RunInput = any, RunOutput = any, CallOpti
73
104
  * @param coerceable A runnable, function, or object whose values are functions or runnables.
74
105
  * @returns A new runnable sequence.
75
106
  */
76
- pipe<NewRunOutput>(coerceable: RunnableLike<RunOutput, NewRunOutput>): RunnableSequence<RunInput, NewRunOutput>;
107
+ pipe<NewRunOutput>(coerceable: RunnableLike<RunOutput, NewRunOutput>): RunnableSequence<RunInput, Exclude<NewRunOutput, Error>>;
77
108
  /**
78
109
  * Default implementation of transform, which buffers input and then calls stream.
79
110
  * Subclasses should override this method if they can start producing output while
@@ -81,9 +112,72 @@ export declare abstract class Runnable<RunInput = any, RunOutput = any, CallOpti
81
112
  * @param generator
82
113
  * @param options
83
114
  */
84
- transform?(generator: AsyncGenerator<RunInput>, options: Partial<CallOptions>): AsyncGenerator<RunOutput>;
115
+ transform(generator: AsyncGenerator<RunInput>, options: Partial<CallOptions>): AsyncGenerator<RunOutput>;
85
116
  static isRunnable(thing: any): thing is Runnable;
86
117
  }
118
+ export type RunnableBindingArgs<RunInput, RunOutput, CallOptions extends RunnableConfig> = {
119
+ bound: Runnable<RunInput, RunOutput, CallOptions>;
120
+ kwargs: Partial<CallOptions>;
121
+ };
122
+ /**
123
+ * A runnable that delegates calls to another runnable with a set of kwargs.
124
+ */
125
+ export declare class RunnableBinding<RunInput, RunOutput, CallOptions extends BaseCallbackConfig> extends Runnable<RunInput, RunOutput, CallOptions> {
126
+ static lc_name(): string;
127
+ lc_namespace: string[];
128
+ lc_serializable: boolean;
129
+ bound: Runnable<RunInput, RunOutput, CallOptions>;
130
+ protected kwargs: Partial<CallOptions>;
131
+ constructor(fields: RunnableBindingArgs<RunInput, RunOutput, CallOptions>);
132
+ bind(kwargs: Partial<CallOptions>): RunnableBinding<RunInput, RunOutput, CallOptions>;
133
+ invoke(input: RunInput, options?: Partial<CallOptions>): Promise<RunOutput>;
134
+ batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
135
+ returnExceptions?: false;
136
+ }): Promise<RunOutput[]>;
137
+ batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
138
+ returnExceptions: true;
139
+ }): Promise<(RunOutput | Error)[]>;
140
+ batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
141
+ _streamIterator(input: RunInput, options?: Partial<CallOptions> | undefined): AsyncGenerator<Awaited<RunOutput>, void, unknown>;
142
+ stream(input: RunInput, options?: Partial<CallOptions> | undefined): Promise<IterableReadableStream<RunOutput>>;
143
+ transform(generator: AsyncGenerator<RunInput>, options: Partial<CallOptions>): AsyncGenerator<RunOutput>;
144
+ static isRunnableBinding(thing: any): thing is RunnableBinding<any, any, any>;
145
+ }
146
+ /**
147
+ * Base class for runnables that can be retried a
148
+ * specified number of times.
149
+ */
150
+ export declare class RunnableRetry<RunInput = any, RunOutput = any, CallOptions extends RunnableConfig = RunnableConfig> extends RunnableBinding<RunInput, RunOutput, CallOptions> {
151
+ static lc_name(): string;
152
+ lc_namespace: string[];
153
+ protected maxAttemptNumber: number;
154
+ onFailedAttempt?: RunnableRetryFailedAttemptHandler;
155
+ constructor(fields: RunnableBindingArgs<RunInput, RunOutput, CallOptions> & {
156
+ maxAttemptNumber?: number;
157
+ onFailedAttempt?: RunnableRetryFailedAttemptHandler;
158
+ });
159
+ _patchConfigForRetry(attempt: number, config?: Partial<CallOptions>, runManager?: CallbackManagerForChainRun): Partial<CallOptions>;
160
+ protected _invoke(input: RunInput, config?: CallOptions, runManager?: CallbackManagerForChainRun): Promise<RunOutput>;
161
+ /**
162
+ * Method that invokes the runnable with the specified input, run manager,
163
+ * and config. It handles the retry logic by catching any errors and
164
+ * recursively invoking itself with the updated config for the next retry
165
+ * attempt.
166
+ * @param input The input for the runnable.
167
+ * @param runManager The run manager for the runnable.
168
+ * @param config The config for the runnable.
169
+ * @returns A promise that resolves to the output of the runnable.
170
+ */
171
+ invoke(input: RunInput, config?: CallOptions): Promise<RunOutput>;
172
+ _batch<ReturnExceptions extends boolean = false>(inputs: RunInput[], configs?: RunnableConfig[], runManagers?: (CallbackManagerForChainRun | undefined)[], batchOptions?: RunnableBatchOptions): Promise<ReturnExceptions extends false ? RunOutput[] : (Error | RunOutput)[]>;
173
+ batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
174
+ returnExceptions?: false;
175
+ }): Promise<RunOutput[]>;
176
+ batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
177
+ returnExceptions: true;
178
+ }): Promise<(RunOutput | Error)[]>;
179
+ batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
180
+ }
87
181
  /**
88
182
  * A sequence of runnables, where the output of each is the input of the next.
89
183
  */
@@ -101,17 +195,21 @@ export declare class RunnableSequence<RunInput = any, RunOutput = any> extends R
101
195
  });
102
196
  get steps(): Runnable<RunInput, any, BaseCallbackConfig>[];
103
197
  invoke(input: RunInput, options?: RunnableConfig): Promise<RunOutput>;
104
- batch(inputs: RunInput[], options?: RunnableConfig | RunnableConfig[], batchOptions?: {
105
- maxConcurrency?: number;
198
+ batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
199
+ returnExceptions?: false;
106
200
  }): Promise<RunOutput[]>;
201
+ batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
202
+ returnExceptions: true;
203
+ }): Promise<(RunOutput | Error)[]>;
204
+ batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
107
205
  _streamIterator(input: RunInput, options?: RunnableConfig): AsyncGenerator<RunOutput>;
108
- pipe<NewRunOutput>(coerceable: RunnableLike<RunOutput, NewRunOutput>): RunnableSequence<RunInput, NewRunOutput>;
206
+ pipe<NewRunOutput>(coerceable: RunnableLike<RunOutput, NewRunOutput>): RunnableSequence<RunInput, Exclude<NewRunOutput, Error>>;
109
207
  static isRunnableSequence(thing: any): thing is RunnableSequence;
110
208
  static from<RunInput, RunOutput>([first, ...runnables]: [
111
209
  RunnableLike<RunInput>,
112
210
  ...RunnableLike[],
113
211
  RunnableLike<any, RunOutput>
114
- ]): RunnableSequence<RunInput, RunOutput>;
212
+ ]): RunnableSequence<RunInput, Exclude<RunOutput, Error>>;
115
213
  }
116
214
  /**
117
215
  * A runnable that runs a mapping of runnables in parallel,
@@ -148,27 +246,6 @@ export declare class RunnablePassthrough<RunInput> extends Runnable<RunInput, Ru
148
246
  lc_serializable: boolean;
149
247
  invoke(input: RunInput, options?: Partial<BaseCallbackConfig>): Promise<RunInput>;
150
248
  }
151
- /**
152
- * A runnable that delegates calls to another runnable with a set of kwargs.
153
- */
154
- export declare class RunnableBinding<RunInput, RunOutput, CallOptions extends BaseCallbackConfig> extends Runnable<RunInput, RunOutput, CallOptions> {
155
- static lc_name(): string;
156
- lc_namespace: string[];
157
- lc_serializable: boolean;
158
- protected bound: Runnable<RunInput, RunOutput, CallOptions>;
159
- protected kwargs: Partial<CallOptions>;
160
- constructor(fields: {
161
- bound: Runnable<RunInput, RunOutput, CallOptions>;
162
- kwargs: Partial<CallOptions>;
163
- });
164
- bind(kwargs: Partial<CallOptions>): RunnableBinding<RunInput, RunOutput, CallOptions>;
165
- invoke(input: RunInput, options?: Partial<CallOptions>): Promise<RunOutput>;
166
- batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: {
167
- maxConcurrency?: number;
168
- }): Promise<RunOutput[]>;
169
- _streamIterator(input: RunInput, options?: Partial<CallOptions> | undefined): AsyncGenerator<Awaited<RunOutput>, void, unknown>;
170
- stream(input: RunInput, options?: Partial<CallOptions> | undefined): Promise<IterableReadableStream<RunOutput>>;
171
- }
172
249
  export type RouterInput = {
173
250
  key: string;
174
251
  input: any;
@@ -186,9 +263,13 @@ export declare class RouterRunnable<RunInput extends RouterInput, RunnableInput,
186
263
  runnables: Record<string, Runnable<RunnableInput, RunOutput>>;
187
264
  });
188
265
  invoke(input: RunInput, options?: Partial<BaseCallbackConfig>): Promise<RunOutput>;
189
- batch(inputs: RunInput[], options?: Partial<BaseCallbackConfig> | Partial<BaseCallbackConfig>[], batchOptions?: {
190
- maxConcurrency?: number;
266
+ batch(inputs: RunInput[], options?: Partial<BaseCallbackConfig> | Partial<BaseCallbackConfig>[], batchOptions?: RunnableBatchOptions & {
267
+ returnExceptions?: false;
191
268
  }): Promise<RunOutput[]>;
269
+ batch(inputs: RunInput[], options?: Partial<BaseCallbackConfig> | Partial<BaseCallbackConfig>[], batchOptions?: RunnableBatchOptions & {
270
+ returnExceptions: true;
271
+ }): Promise<(RunOutput | Error)[]>;
272
+ batch(inputs: RunInput[], options?: Partial<BaseCallbackConfig> | Partial<BaseCallbackConfig>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
192
273
  stream(input: RunInput, options?: Partial<BaseCallbackConfig>): Promise<IterableReadableStream<RunOutput>>;
193
274
  }
194
275
  /**
@@ -206,7 +287,12 @@ export declare class RunnableWithFallbacks<RunInput, RunOutput> extends Runnable
206
287
  });
207
288
  runnables(): Generator<Runnable<RunInput, RunOutput, BaseCallbackConfig>, void, unknown>;
208
289
  invoke(input: RunInput, options?: Partial<BaseCallbackConfig>): Promise<RunOutput>;
209
- batch(inputs: RunInput[], options?: Partial<BaseCallbackConfig> | Partial<BaseCallbackConfig>[], batchOptions?: {
210
- maxConcurrency?: number;
290
+ batch(inputs: RunInput[], options?: Partial<BaseCallbackConfig> | Partial<BaseCallbackConfig>[], batchOptions?: RunnableBatchOptions & {
291
+ returnExceptions?: false;
211
292
  }): Promise<RunOutput[]>;
293
+ batch(inputs: RunInput[], options?: Partial<BaseCallbackConfig> | Partial<BaseCallbackConfig>[], batchOptions?: RunnableBatchOptions & {
294
+ returnExceptions: true;
295
+ }): Promise<(RunOutput | Error)[]>;
296
+ batch(inputs: RunInput[], options?: Partial<BaseCallbackConfig> | Partial<BaseCallbackConfig>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
212
297
  }
298
+ export {};