Skip to content

Commit 52d6974

Browse files
Merge pull request #308 from ibuildthecloud/main
bug: handle empty llm response
2 parents c8b4d57 + 2deda5a commit 52d6974

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/engine/engine.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@ func (e *Engine) complete(ctx context.Context, state *State) (*Return, error) {
321321
}
322322
}
323323

324+
if len(resp.Content) == 0 {
325+
// This can happen if the LLM return no content at all. You can reproduce by just saying, "return an empty response"
326+
empty := ""
327+
ret.Result = &empty
328+
}
329+
324330
return &ret, nil
325331
}
326332

0 commit comments

Comments
 (0)