Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support for concatSupported = false for OpenAI models #7299

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}