Documentation
¶
Overview ¶
Package llmclient provides LLMClientI implementations for the orchestrator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var PackageProps = packageprops.Props{ WASMWASI: packageprops.WASMBlocked, WASMJS: packageprops.WASMBlocked, WASMFreestanding: packageprops.WASMBlocked, }
PackageProps records this package's curated properties (ADR-0080). Seeded by `boxer code analysis golang wasmsurvey props generate`; curate by hand. The same group's `props verify` reconciles it.
Functions ¶
This section is empty.
Types ¶
type OllamaClient ¶
type OllamaClient struct {
// contains filtered or unexported fields
}
OllamaClient implements orchestrator.LLMClientI using the Ollama HTTP API.
func NewOllamaClient ¶
func NewOllamaClient(endpoint string, opts ...OllamaOption) *OllamaClient
NewOllamaClient creates an OllamaClient.
client := llmclient.NewOllamaClient("http://localhost:11434",
llmclient.WithTemperature(0.1),
llmclient.WithNumCtx(8192),
)
func (*OllamaClient) Chat ¶
func (inst *OllamaClient) Chat(ctx context.Context, model string, messages []orchestrator.Message) (response string, err error)
Chat sends a conversation to Ollama and returns the assistant's response text.
type OllamaOption ¶
type OllamaOption func(*OllamaClient)
OllamaOption configures an OllamaClient.
func WithLogger ¶
func WithLogger(logger zerolog.Logger) OllamaOption
WithLogger sets the zerolog logger for request/response logging.
func WithNumCtx ¶
func WithNumCtx(n int) OllamaOption
WithNumCtx sets the context window size (default: 8192).
func WithTemperature ¶
func WithTemperature(t float64) OllamaOption
WithTemperature sets the sampling temperature (default: 0.1).
func WithTimeout ¶
func WithTimeout(d time.Duration) OllamaOption
WithTimeout sets the HTTP client timeout (default: 120s).
type OpenAIChatClient ¶
type OpenAIChatClient struct {
// contains filtered or unexported fields
}
OpenAIChatClient adapts openaichat.Client to orchestrator.LLMClientI. Use it to drive text2sql2 against any OpenAI-compatible endpoint — LM Studio, Gemini's OpenAI shim, or a litellm bridge — while keeping the existing OllamaClient for /api/chat servers.
Zero-value usage is invalid; construct via NewOpenAIChatClient.
func NewOpenAIChatClient ¶
func NewOpenAIChatClient(client openaichat.ClientI, opts ...OpenAIChatOption) (inst *OpenAIChatClient, err error)
NewOpenAIChatClient wraps an existing openaichat.ClientI for text2sql2. The caller owns the underlying client's lifetime; Close is not delegated here so multiple wrappers can share one transport pool.
func (*OpenAIChatClient) Chat ¶
func (inst *OpenAIChatClient) Chat(ctx context.Context, model string, messages []orchestrator.Message) (response string, err error)
type OpenAIChatOption ¶
type OpenAIChatOption func(*OpenAIChatClient)
OpenAIChatOption configures an OpenAIChatClient.
func WithOpenAIChatNumCtx ¶
func WithOpenAIChatNumCtx(n int32) OpenAIChatOption
WithOpenAIChatNumCtx forwards options.num_ctx to Ollama. Leave zero (the default) for OpenAI / Gemini endpoints, which reject the field.
func WithOpenAIChatResponseFormat ¶ added in v0.0.9
func WithOpenAIChatResponseFormat(rf *openaichat.ResponseFormat) OpenAIChatOption
WithOpenAIChatResponseFormat constrains the model's output — e.g. openaichat.JSONObjectFormat() to force valid JSON, or JSONSchemaFormat(...) to pin a schema. Unset by default (free-form text). The orchestrator's prompt must request a shape consistent with the format.
func WithOpenAIChatSeed ¶ added in v0.0.9
func WithOpenAIChatSeed(seed int64) OpenAIChatOption
WithOpenAIChatSeed sets the sampling seed for reproducible output where the provider honors it. Pair with WithOpenAIChatTemperature(0) for deterministic SQL generation. Unset by default (the provider seeds randomly).
func WithOpenAIChatTemperature ¶
func WithOpenAIChatTemperature(t float32) OpenAIChatOption
WithOpenAIChatTemperature sets the sampling temperature (default: 0.1). Pass 0 for deterministic / greedy decoding — the adapter always forwards an explicit temperature, so 0 reaches the provider rather than being dropped.