Skip to content

Commit

Permalink
Move concatSupported to RunnableConfig and handle when it is false
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahCristino committed Nov 30, 2024
1 parent 983acd2 commit b605406
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion langchain-core/src/runnables/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ export class RunnableSequence<
otherOptions?.runName
);
const steps = [this.first, ...this.middle, this.last];
let concatSupported = true;
let concatSupported = options?.concatSupported ?? true;
let finalOutput;
async function* inputGenerator() {
yield input;
Expand Down Expand Up @@ -2029,6 +2029,8 @@ export class RunnableSequence<
concatSupported = false;
}
}
} else {
finalOutput = chunk;
}
}
} catch (e) {
Expand Down
5 changes: 5 additions & 0 deletions langchain-core/src/runnables/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,9 @@ export interface RunnableConfig<
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
signal?: AbortSignal;

/**
* Whether to concatenate the stream of outputs into a single output or not.
*/
concatSupported?: boolean;
}

0 comments on commit b605406

Please sign in to comment.