package llm import ( "context" ) // RunTranslate renders a short explanation out of the language it was written // in and into the other half of the writer's pair. It is a one-shot Complete // (the result seeds the Ask Petal bubble), kept at a low temperature so the // translation is faithful rather than creative. Output is trimmed of any stray // surrounding quotes the model may add. func RunTranslate(ctx context.Context, client LLMClient, text string, from, to Lang) (string, error) { out, err := client.Complete(ctx, CompletionRequest{ Messages: TranslateMessages(text, from, to), MaxTokens: 512, Temperature: 0.2, TopP: 0.9, RepetitionPenalty: 1.1, }) if err != nil { return "", err } return cleanRewrite(out), nil }