Skip to content

Commit f2c03c3

Browse files
fix(adk): improve instruction formatting error handling (#688)
1 parent a0a346a commit f2c03c3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ output/*
4545
.DS_Store
4646
*.log
4747
CLAUDE.md
48+
49+
# Specs directories
50+
*/specs

adk/chatmodel.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ func defaultGenModelInput(ctx context.Context, instruction string, input *AgentI
125125
ct := prompt.FromMessages(schema.FString, sp)
126126
ms, err := ct.Format(ctx, vs)
127127
if err != nil {
128-
return nil, err
128+
return nil, fmt.Errorf("defaultGenModelInput: failed to format instruction using FString template. "+
129+
"This formatting is triggered automatically when SessionValues are present. "+
130+
"If your instruction contains literal curly braces (e.g., JSON), provide a custom GenModelInput that uses another format. If you are using "+
131+
"SessionValues for purposes other than instruction formatting, provide a custom GenModelInput that does no formatting at all: %w", err)
129132
}
130133

131134
sp = ms[0]

0 commit comments

Comments
 (0)