You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shentong.martin 82cc9a471d feat(compose): async node example
Change-Id: I1e5af39c3ac197017ef809d7e68eb4911266925d
5 months ago
..
README.md feat(compose): async node example 5 months ago
main.go feat(compose): async node example 5 months ago
service.go feat(compose): async node example 5 months ago

README.md

Async Lambda Node in Eino Graph

This example demonstrates an "async node" implemented as a normal lambda in an Eino graph. It covers two realistic business scenarios:

  • Report Generation (invokable): a long-running background job that produces a document URL.
  • Live Transcription (streamable): a stream of tokens produced over time and converted via StreamReaderWithConvert.

Files

  • service.go: mocked services (generateReport, transcribeLive).
  • main.go: graph wiring, lambda nodes, and run flows.

How It Works

  • The invokable lambda starts generateReport in a goroutine and blocks on a channel until completion or cancellation.
  • The streamable lambda obtains a live StreamReader[string] and wraps it with StreamReaderWithConvert to transform tokens.

Run

cd compose/graph/async_node
go run .

You will see:

  • A report URL logged from the invokable path.
  • A stream of uppercase tokens from the transcription path until EOF.

Notes

  • The services inject errors when inputs contain the word error, to showcase error propagation.
  • Cancellation is respected via context.Context.