Expose structured generation errors to consumers

This commit is contained in:
2026-08-23 19:01:38 +00:00
parent e5b7adfb49
commit 159b02116f
9 changed files with 263 additions and 22 deletions

View File

@@ -665,10 +665,10 @@ type StructuredOutputJSONSpec struct {
// and retained copies. It is responsible for the cancellation behavior of any
// work it starts and for synchronizing access to retained or shared data.
//
// A returned error makes Run or RunPrepared return ErrLLMGenerate while
// preserving the client error through errors.Is. A nil response with a nil
// error also produces ErrLLMGenerate. Promptkit copies the non-nil response
// before returning from either method.
// An arbitrary returned error makes Run or RunPrepared return ErrLLMGenerate
// while preserving the client error through errors.Is rather than translating
// it. A nil response with a nil error also produces ErrLLMGenerate. Promptkit
// copies the non-nil response before returning from either method.
type LLMClient interface {
Generate(context.Context, GenerateRequest) (*GenerateResponse, error)
}