llmproxyclient

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package llmproxyclient provides an HTTP client for llm-proxy JSON POST requests.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidClientConfig reports invalid llm-proxy client configuration.
	ErrInvalidClientConfig = errors.New("llm_proxy_client_invalid_config")
	// ErrInvalidClientRequest reports invalid llm-proxy request input.
	ErrInvalidClientRequest = errors.New("llm_proxy_client_invalid_request")
	// ErrClientHTTPFailure reports an unsuccessful llm-proxy HTTP response.
	ErrClientHTTPFailure = errors.New("llm_proxy_client_http_failure")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client calls llm-proxy using a configured HTTP transport.

func NewClient

func NewClient(config Config, httpClient HTTPDoer) (Client, error)

NewClient creates a client from validated config and an injected HTTP transport.

func (Client) Post

func (client Client) Post(contextValue context.Context, request Request) (string, error)

Post sends a JSON POST prompt request and returns the response text.

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is validated llm-proxy client configuration.

func NewConfig

func NewConfig(input ConfigInput) (Config, error)

NewConfig validates external client configuration.

func (Config) PostURL

func (config Config) PostURL() string

PostURL builds the authenticated JSON POST URL for this config.

func (Config) Timeout

func (config Config) Timeout() time.Duration

Timeout returns the validated client timeout.

type ConfigInput

type ConfigInput struct {
	BaseURL  string
	Secret   string
	Provider string
	Timeout  time.Duration
}

ConfigInput is the unvalidated external configuration for an llm-proxy client.

type HTTPDoer

type HTTPDoer interface {
	Do(request *http.Request) (*http.Response, error)
}

HTTPDoer performs one HTTP request.

type Request

type Request struct {
	// contains filtered or unexported fields
}

Request is a validated llm-proxy JSON POST request.

func NewRequest

func NewRequest(input RequestInput) (Request, error)

NewRequest validates external request input.

type RequestInput

type RequestInput struct {
	Prompt       string
	Model        string
	WebSearch    bool
	SystemPrompt string
	MaxTokens    *int
}

RequestInput is the unvalidated external input for a JSON POST request.

Jump to

Keyboard shortcuts

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