Skip to content

Commit a05f4e9

Browse files
refactor: remove unused chain variables in example 1
Change-Id: I1fcd725de100d42d7c496fb3ea2e8701c72af42f
1 parent c5df2f1 commit a05f4e9

1 file changed

Lines changed: 0 additions & 34 deletions

File tree

  • adk/common/tool/graphtool/examples/1_chain_summarize

adk/common/tool/graphtool/examples/1_chain_summarize/main.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -64,40 +64,6 @@ The summary should flow naturally and capture the essence of the original conten
6464
6565
Create a summary in approximately {max_words} words:`))
6666

67-
chain := compose.NewChain[map[string]any, *SummarizeOutput]()
68-
69-
chain.
70-
AppendChatTemplate(extractKeyPointsPrompt).
71-
AppendChatModel(cm).
72-
AppendLambda(compose.InvokableLambda(func(ctx context.Context, msg *schema.Message) (map[string]any, error) {
73-
return map[string]any{
74-
"key_points": msg.Content,
75-
"max_words": ctx.Value("max_words"),
76-
}, nil
77-
})).
78-
AppendChatTemplate(condenseSummaryPrompt).
79-
AppendChatModel(cm).
80-
AppendLambda(compose.InvokableLambda(func(ctx context.Context, msg *schema.Message) (*SummarizeOutput, error) {
81-
keyPoints := ctx.Value("key_points_list").([]string)
82-
return &SummarizeOutput{
83-
Summary: msg.Content,
84-
KeyPoints: keyPoints,
85-
WordCount: countWords(msg.Content),
86-
}, nil
87-
}))
88-
89-
inputTransformChain := compose.NewChain[*SummarizeInput, map[string]any]()
90-
inputTransformChain.AppendLambda(compose.InvokableLambda(func(ctx context.Context, input *SummarizeInput) (map[string]any, error) {
91-
maxWords := input.MaxWords
92-
if maxWords <= 0 {
93-
maxWords = 100
94-
}
95-
return map[string]any{
96-
"document": input.Document,
97-
"max_words": maxWords,
98-
}, nil
99-
}))
100-
10167
fullChain := compose.NewChain[*SummarizeInput, *SummarizeOutput]()
10268
fullChain.
10369
AppendLambda(compose.InvokableLambda(func(ctx context.Context, input *SummarizeInput) (map[string]any, error) {

0 commit comments

Comments
 (0)