diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index da3395cb..c3b9474e 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -321,6 +321,12 @@ func (e *Engine) complete(ctx context.Context, state *State) (*Return, error) { } } + if len(resp.Content) == 0 { + // This can happen if the LLM return no content at all. You can reproduce by just saying, "return an empty response" + empty := "" + ret.Result = &empty + } + return &ret, nil }