Skip to content

Conversation

Pouyanpi
Copy link
Collaborator

@Pouyanpi Pouyanpi commented Sep 3, 2025

Enhance streaming in RunnableRails to include generation metadata in streamed chunks. Skips END_OF_STREAM markers and updates chunk formatting to support metadata for AIMessageChunk outputs. This improves compatibility with consumers expecting metadata in streaming responses.

@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-streaming-metadata branch from 78d5038 to 2ddc4f3 Compare September 3, 2025 09:25
@Pouyanpi Pouyanpi changed the title feat(langchain): stream metadata in RunnableRails output feat(runnable-rails): stream metadata in RunnableRails output Sep 3, 2025
@Pouyanpi Pouyanpi added enhancement New feature or request runnable labels Sep 3, 2025
@Pouyanpi Pouyanpi added this to the v0.17.0 milestone Sep 3, 2025
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-ai-message branch from 8e1033c to 1c5837e Compare September 3, 2025 10:13
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-streaming-metadata branch from 2ddc4f3 to 22b4d89 Compare September 3, 2025 10:14
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-ai-message branch from 1c5837e to 6a6050b Compare September 3, 2025 10:29
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-streaming-metadata branch from 22b4d89 to 8238039 Compare September 3, 2025 10:31
@Pouyanpi Pouyanpi self-assigned this Sep 3, 2025
@Pouyanpi Pouyanpi marked this pull request as draft September 3, 2025 10:52
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-ai-message branch from 6a6050b to ce4d6c1 Compare September 9, 2025 09:27
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-streaming-metadata branch from 8238039 to eb2d49c Compare September 9, 2025 09:37
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-ai-message branch from ce4d6c1 to 0b114ba Compare September 9, 2025 09:40
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-streaming-metadata branch from eb2d49c to f8004f8 Compare September 9, 2025 09:41
@Pouyanpi Pouyanpi requested a review from Copilot September 9, 2025 09:42
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the RunnableRails streaming functionality to include generation metadata in streamed chunks and improves compatibility with consumers expecting metadata in streaming responses. The changes focus on filtering out END_OF_STREAM markers and updating chunk formatting to properly support metadata for AIMessageChunk outputs.

  • Updates streaming methods to include generation metadata in chunks
  • Adds logic to skip END_OF_STREAM markers during streaming
  • Enhances chunk formatting to handle metadata alongside text content

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/runnable_rails/test_streaming.py Removes outdated comments and adds new tests for metadata preservation and chunk type validation
tests/runnable_rails/test_metadata.py Adds comprehensive test coverage for streaming metadata preservation in both sync and async scenarios
nemoguardrails/integrations/langchain/runnable_rails.py Updates streaming implementation to handle metadata and filter END_OF_STREAM markers

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Pouyanpi Pouyanpi marked this pull request as ready for review September 10, 2025 12:47
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-ai-message branch from 0b114ba to 0e0ea4f Compare September 15, 2025 09:38
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-streaming-metadata branch 4 times, most recently from a0c0e24 to d256fe3 Compare September 15, 2025 09:53
@Pouyanpi Pouyanpi requested a review from tgasser-nv September 15, 2025 10:35
Copy link
Collaborator

@tgasser-nv tgasser-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, just a couple of nits

@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-ai-message branch from 0e0ea4f to 00589c2 Compare September 22, 2025 08:33
Base automatically changed from feat/runnable-rails-ai-message to develop September 22, 2025 08:45
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-streaming-metadata branch from d256fe3 to 3ac1414 Compare September 22, 2025 08:50
Enhance streaming in RunnableRails to include generation metadata in
streamed chunks. Skips END_OF_STREAM markers and updates chunk
formatting
to support metadata for AIMessageChunk outputs. This improves
compatibility
with consumers expecting metadata in streaming responses.
@Pouyanpi Pouyanpi force-pushed the feat/runnable-rails-streaming-metadata branch from 3ac1414 to 1e2f0eb Compare September 22, 2025 08:52
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 75.00000% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...uardrails/integrations/langchain/runnable_rails.py 75.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Pouyanpi Pouyanpi merged commit f9b63e4 into develop Sep 22, 2025
14 checks passed
@Pouyanpi Pouyanpi deleted the feat/runnable-rails-streaming-metadata branch September 22, 2025 09:00
tgasser-nv pushed a commit that referenced this pull request Sep 22, 2025
Enhance streaming in RunnableRails to include generation metadata in
streamed chunks. Skips END_OF_STREAM markers and updates chunk
formatting to support metadata for AIMessageChunk outputs. This improves
compatibility with consumers expecting metadata in streaming responses.
tgasser-nv pushed a commit that referenced this pull request Sep 22, 2025
Enhance streaming in RunnableRails to include generation metadata in
streamed chunks. Skips END_OF_STREAM markers and updates chunk
formatting to support metadata for AIMessageChunk outputs. This improves
compatibility with consumers expecting metadata in streaming responses.
Pouyanpi added a commit that referenced this pull request Oct 1, 2025
Enhance streaming in RunnableRails to include generation metadata in
streamed chunks. Skips END_OF_STREAM markers and updates chunk
formatting to support metadata for AIMessageChunk outputs. This improves
compatibility with consumers expecting metadata in streaming responses.
tgasser-nv pushed a commit that referenced this pull request Oct 14, 2025
Enhance streaming in RunnableRails to include generation metadata in
streamed chunks. Skips END_OF_STREAM markers and updates chunk
formatting to support metadata for AIMessageChunk outputs. This improves
compatibility with consumers expecting metadata in streaming responses.
tgasser-nv pushed a commit that referenced this pull request Oct 14, 2025
Enhance streaming in RunnableRails to include generation metadata in
streamed chunks. Skips END_OF_STREAM markers and updates chunk
formatting to support metadata for AIMessageChunk outputs. This improves
compatibility with consumers expecting metadata in streaming responses.
tgasser-nv pushed a commit that referenced this pull request Oct 14, 2025
Enhance streaming in RunnableRails to include generation metadata in
streamed chunks. Skips END_OF_STREAM markers and updates chunk
formatting to support metadata for AIMessageChunk outputs. This improves
compatibility with consumers expecting metadata in streaming responses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request runnable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants