Documentation
¶
Index ¶
- Variables
- func ContextWithLogger(ctx context.Context, logger *zap.Logger) context.Context
- func LoggerFromContext(ctx context.Context) *zap.Logger
- func NewLogger(level zapcore.Level, format LogFormat) (*zap.Logger, error)
- type AnthropicLLMClient
- type Column
- type Connection
- type LLMClient
- type LLMResponse
- type LogFormat
- type OpenAILLMClient
- type ResultSet
- type Server
Constants ¶
This section is empty.
Variables ¶
var DefaultSystemPrompt string
DefaultSystemPrompt is used when no custom --prompt file is provided.
Functions ¶
func ContextWithLogger ¶
ContextWithLogger adds a logger to the context
func LoggerFromContext ¶
LoggerFromContext extracts the logger from the context
Types ¶
type AnthropicLLMClient ¶
type AnthropicLLMClient struct {
// contains filtered or unexported fields
}
AnthropicLLMClient handles communication with the Anthropic API
func NewAnthropicLLMClient ¶
func NewAnthropicLLMClient(apiKey string, model string, opts map[string]string, systemPrompt string) *AnthropicLLMClient
NewAnthropicLLMClient creates a new Anthropic LLM client. Supported options:
- "effort": output effort level (low, medium, high, max). Defaults to "low".
- "thinking": extended thinking budget in tokens (e.g. "10000"). Minimum 1024.
func (*AnthropicLLMClient) Query ¶
func (c *AnthropicLLMClient) Query(ctx context.Context, queryString string) (*LLMResponse, error)
Query sends a query to the Anthropic API and returns the structured response
type Column ¶
type Column struct {
Name string `json:"name" jsonschema:"column name"`
Type string `json:"type" jsonschema:"PostgreSQL type name: text, int4, int8, float8, float4, int2, bool, timestamp, date, uuid, varchar"`
Length int `` /* 140-byte string literal not displayed */
}
Column represents a column definition
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a single client connection
func NewConnection ¶
NewConnection creates a new Connection instance
type LLMClient ¶
type LLMClient interface {
Query(ctx context.Context, queryString string) (*LLMResponse, error)
}
LLMClient is the interface for all LLM provider clients.
type LLMResponse ¶
type LLMResponse struct {
Results []ResultSet `json:"results" jsonschema:"array of result sets, one per SQL statement"`
}
LLMResponse represents the structured output from the LLM
type LogFormat ¶
type LogFormat string
LogFormat represents the output format for the logger.
func (LogFormat) MarshalText ¶
func (*LogFormat) UnmarshalText ¶
type OpenAILLMClient ¶
type OpenAILLMClient struct {
// contains filtered or unexported fields
}
OpenAILLMClient handles communication with the OpenAI API
func NewOpenAILLMClient ¶
func NewOpenAILLMClient(apiKey string, model string, opts map[string]string, systemPrompt string) *OpenAILLMClient
NewOpenAILLMClient creates a new OpenAI LLM client. It reads the "reasoning_effort" option from opts; if absent, defaults to the lowest supported effort for the model.
func (*OpenAILLMClient) Query ¶
func (c *OpenAILLMClient) Query(ctx context.Context, queryString string) (*LLMResponse, error)
Query sends a query to the OpenAI API and returns the structured response
type ResultSet ¶
type ResultSet struct {
Columns []Column `json:"columns" jsonschema:"column definitions; empty for non-SELECT statements"`
Rows [][]*string `` /* 198-byte string literal not displayed */
CommandTag string `json:"command_tag" jsonschema:"PostgreSQL command tag like SELECT 3, INSERT 0 1, UPDATE 2, DELETE 1, CREATE TABLE"`
}
ResultSet represents a single SQL statement's result
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles incoming TCP connections and manages connection lifecycle
func NewServer ¶
NewServer creates a new Server instance. If tlsConfig is non-nil, the server will accept SSL upgrades during the PostgreSQL startup handshake.