suggest

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package suggest provides opt-in LLM-assisted query repair hints. Suggestions are printed to STDERR only and never alter deterministic generate output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	// SQL is the raw query text that triggered diagnostics.
	SQL string
	// Diagnostics is a list of human-readable diagnostic strings.
	Diagnostics []string
	// SchemaSummary is a short, text representation of relevant schema tables.
	SchemaSummary string
}

Input holds the context needed to generate a suggestion.

type Suggester

type Suggester interface {
	Suggest(ctx context.Context, in Input) (string, error)
}

Suggester generates a repair hint for a query.

func Anthropic

func Anthropic() (Suggester, bool)

Anthropic returns a Suggester backed by the Anthropic Messages API if ANTHROPIC_API_KEY is set; returns (nil, false) when unconfigured.

func AnthropicWithBaseURL

func AnthropicWithBaseURL(baseURL string) (Suggester, bool)

AnthropicWithBaseURL returns a Suggester using the given base URL instead of the default Anthropic API endpoint. This allows tests to inject a local httptest.Server without making real network calls.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL