generateTitle calls the model with a title-generation system prompt and returns the normalized result. It retries transient LLM errors (rate limits, overloaded, etc.) with exponential backoff.
( ctx context.Context, model fantasy.LanguageModel, input string, )
| 428 | // and returns the normalized result. It retries transient LLM errors |
| 429 | // (rate limits, overloaded, etc.) with exponential backoff. |
| 430 | func generateTitle( |
| 431 | ctx context.Context, |
| 432 | model fantasy.LanguageModel, |
| 433 | input string, |
| 434 | ) (string, error) { |
| 435 | title, err := generateStructuredTitle(ctx, model, titleGenerationPrompt, input) |
| 436 | if err != nil { |
| 437 | return "", err |
| 438 | } |
| 439 | return title, nil |
| 440 | } |
| 441 | |
| 442 | func generateStructuredTitle( |
| 443 | ctx context.Context, |
no test coverage detected