Help us shape the future of Go! Take the 2026 Go Developer Survey

ai

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package ai provides AI-powered PromQL query suggestions using various LLM providers.

Code generated by tools/genmodels at 2025-09-22T20:17:53Z; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanCandidate

func CleanCandidate(in string) string

CleanCandidate removes surrounding quotes/backticks/fences and trims spaces.

func ConfigureAIComposite

func ConfigureAIComposite(kv map[string]string)

ConfigureAIComposite merges AI configuration from, in precedence order: 1) Composite --ai key=val pairs (CLI) 2) PROMQL_CLI_AI env (key=val pairs) 3) Profile file (~/.config/promql-cli/ai.toml) selected by --ai profile= or PROMQL_CLI_AI_PROFILE 4) Provider defaults The result populates global ai*Flag variables used by providers.

func ConfigureAIFromFlags

func ConfigureAIFromFlags(provider string, openaiModel, openaiBase, claudeModel, claudeBase, xaiModel, xaiBase, ollamaModel, ollamaHost string)

Types

type AIConfig

type AIConfig map[string]string

AIConfig implements flag.Value to parse key=value pairs for --ai. Example: --ai "provider=claude model=opus base=https://... answers=3 profile=work" Multiple --ai flags merge; values later override earlier ones.

func (*AIConfig) Set

func (a *AIConfig) Set(s string) error

func (*AIConfig) String

func (a *AIConfig) String() string

type AISuggestion

type AISuggestion struct {
	Query   string
	Explain string
}

func AISuggestQueries

func AISuggestQueries(storage *sstorage.SimpleStorage, intent string) ([]AISuggestion, error)

func AISuggestQueriesCtx

func AISuggestQueriesCtx(ctx context.Context, storage *sstorage.SimpleStorage, intent string) ([]AISuggestion, error)

AISuggestQueriesCtx is like AISuggestQueries but allows cancellation via context.

type ModelInfo

type ModelInfo struct {
	ID          string
	Display     string
	Family      string
	ContextK    int
	Description string
}

ModelInfo describes an AI model entry used for help listings.

Jump to

Keyboard shortcuts

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