feat(schema): add streaming programming examples#169
Open
shentongmartin wants to merge 2 commits intomainfrom
Open
feat(schema): add streaming programming examples#169shentongmartin wants to merge 2 commits intomainfrom
shentongmartin wants to merge 2 commits intomainfrom
Conversation
Add comprehensive examples demonstrating Eino's four streaming paradigms: - 1_invoke: InvokableLambda (Ping-Pong mode) - Text summarizer - 2_stream: StreamableLambda (Server-Streaming) - Word-by-word generator - 3_collect: CollectableLambda (Client-Streaming) - Log aggregator - 4_transform: TransformableLambda (Bidirectional-Streaming) - Text processor - 5_auto_streaming: Auto streaming/concat between nodes - 6_stream_reader_utils: StreamReader utilities (Pipe, Convert, etc.) - 7_merge_stream_readers: MergeStreamReaders for fan-in pattern Each example is self-contained, runnable, and uses mock data without external dependencies.~ Change-Id: I430c7e75fe2c3c8221bf0515ea7ebfaf19a9a17c
Change-Id: I98ad53b35743d67a9b775358042e916be5e239d6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive examples demonstrating Eino's streaming programming capabilities, covering all four streaming paradigms documented in the CloudWeGo documentation.
Changes
1_invokeInvokableLambda2_streamStreamableLambda3_collectCollectableLambda4_transformTransformableLambda5_auto_streaming6_stream_reader_utils7_merge_stream_readersKey Insights
Streaming Paradigm Coverage
The examples cover all four streaming paradigms in Eino:
Practical Use Cases
Each example uses realistic, self-contained scenarios without external dependencies:
StreamReader Utilities
Example 6 demonstrates essential StreamReader utilities:
schema.Pipe[T]: Create producer-consumer stream pairsschema.StreamReaderFromArray: Convert arrays to streamsschema.StreamReaderWithConvert: Transform stream element typesschema.ErrNoValue: Filter elements from streamsAuto Streaming/Concat
Example 5 shows how Eino automatically handles type conversion between nodes with mismatched stream types.
Testing
All examples compile and run successfully:
概要
本 PR 添加了全面的示例,展示 Eino 的流式编程能力,涵盖 CloudWeGo 文档中记录的所有四种流式范式。
变更
1_invokeInvokableLambda2_streamStreamableLambda3_collectCollectableLambda4_transformTransformableLambda5_auto_streaming6_stream_reader_utils7_merge_stream_readers关键洞察
流式范式覆盖
示例涵盖了 Eino 中的所有四种流式范式:
实用场景
每个示例使用真实的、自包含的场景,无需外部依赖:
StreamReader 工具函数
示例 6 展示了必要的 StreamReader 工具函数:
schema.Pipe[T]:创建生产者-消费者流对schema.StreamReaderFromArray:将数组转换为流schema.StreamReaderWithConvert:转换流元素类型schema.ErrNoValue:从流中过滤元素自动流化/合包
示例 5 展示了 Eino 如何自动处理流类型不匹配的节点之间的类型转换。
测试
所有示例编译和运行成功: