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

feat: Add reduceOutputStream option to StringOutputParser #368

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

davidmigloz
Copy link
Owner

@davidmigloz davidmigloz commented Apr 8, 2024

When invoking this parser with Runnable.stream, every item from the input stream will be parsed and emitted by default. If reduceOutputStream is set to true, the parser will reduce the output stream into a single String and emit it as a single item. This is useful when the next Runnable in a chain expects a single String as input.

Visual example:

- reduceOutputStream = false
'A', 'B', 'C' -> 'A', 'B', 'C'
- reduceOutputStream = true
'A', 'B', 'C' -> 'ABC'

@davidmigloz davidmigloz self-assigned this Apr 8, 2024
@davidmigloz davidmigloz added t:enhancement New feature or request c:output-parsers Output parsers. labels Apr 8, 2024
@davidmigloz davidmigloz added this to the v0.5.0 milestone Apr 8, 2024
@davidmigloz davidmigloz merged commit 7f9a9fa into main Apr 8, 2024
1 check passed
@davidmigloz davidmigloz deleted the string-output-parser branch April 8, 2024 21:23
KennethKnudsen97 pushed a commit to KennethKnudsen97/langchain_dart that referenced this pull request Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:output-parsers Output parsers. t:enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

1 participant