MCPcopy Create free account
hub / github.com/cloudwego/eino-examples / createSimpleReviewWorkflow

Function createSimpleReviewWorkflow

compose/batch/main.go:150–171  ·  view source on GitHub ↗

createSimpleReviewWorkflow creates a basic document review workflow that simulates automated review with random scoring

()

Source from the content-addressed store, hash-verified

148// createSimpleReviewWorkflow creates a basic document review workflow
149// that simulates automated review with random scoring
150func createSimpleReviewWorkflow() *compose.Workflow[ReviewRequest, ReviewResult] {
151 workflow := compose.NewWorkflow[ReviewRequest, ReviewResult]()
152
153 workflow.AddLambdaNode("analyze", compose.InvokableLambda(func(ctx context.Context, req ReviewRequest) (ReviewResult, error) {
154 time.Sleep(50 * time.Millisecond) // Simulate processing time
155
156 score := 0.5 + rand.Float64()*0.5
157 approved := score >= 0.7
158
159 return ReviewResult{
160 DocumentID: req.DocumentID,
161 Approved: approved,
162 Score: score,
163 Comments: fmt.Sprintf("Auto-reviewed document %s with priority %s", req.DocumentID, req.Priority),
164 ReviewedAt: time.Now(),
165 }, nil
166 })).AddInput(compose.START)
167
168 workflow.End().AddInput("analyze")
169
170 return workflow
171}
172
173// Scenario 1: Basic Sequential Processing
174// Demonstrates: MaxConcurrency=0 for sequential execution

Callers 5

runBasicSequentialFunction · 0.85
runConcurrentFunction · 0.85
runWithCompileOptionsFunction · 0.85
runWithInvokeOptionsFunction · 0.85
runParentGraphWithReduceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected