ai_proxy

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 31 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Header map[string]string  `json:"header,omitempty"`
	Query  map[string]string  `json:"query,omitempty"`
	AWS    *ai_auth.AWSConfig `json:"aws,omitempty"`
	GCP    *ai_auth.GCPConfig `json:"gcp,omitempty"`
}

type Config

type Config struct {
	Provider                 string         `json:"provider"`
	ProviderConf             map[string]any `json:"provider_conf,omitempty"`
	Auth                     Auth           `json:"auth"`
	Options                  map[string]any `json:"options,omitempty"`
	Override                 Override       `json:"override"`
	Logging                  Logging        `json:"logging"`
	Timeout                  int            `json:"timeout,omitempty"`
	MaxReqBodySize           int64          `json:"max_req_body_size,omitempty"`
	MaxStreamDurationMS      int            `json:"max_stream_duration_ms,omitempty"`
	MaxResponseBytes         int64          `json:"max_response_bytes,omitempty"`
	Keepalive                *bool          `json:"keepalive,omitempty"`
	KeepaliveTimeout         int            `json:"keepalive_timeout,omitempty"`
	KeepalivePool            int            `json:"keepalive_pool,omitempty"`
	StreamingFlushIntervalMS *int           `json:"streaming_flush_interval_ms,omitempty"`
	SSLVerify                *bool          `json:"ssl_verify,omitempty"`
}

func (*Config) DescribeResponseMode

func (*Config) DescribeResponseMode() (base.ResponseModeDescriptor, error)

DescribeResponseMode conservatively advertises both bounded and streaming responses because the request document selects SSE at runtime.

type LLMOptions

type LLMOptions struct {
	MaxTokens int `json:"max_tokens,omitempty"`
}

type Logging

type Logging struct {
	Summaries bool `json:"summaries,omitempty"`
	Payloads  bool `json:"payloads,omitempty"`
}

type Override

type Override struct {
	Endpoint                 string         `json:"endpoint,omitempty"`
	LLMOptions               LLMOptions     `json:"llm_options"`
	RequestBody              map[string]any `json:"request_body,omitempty"`
	RequestBodyForceOverride *bool          `json:"request_body_force_override,omitempty"`
}

type Plugin

type Plugin struct {
	base.BasePlugin
	// contains filtered or unexported fields
}

func (*Plugin) Config

func (p *Plugin) Config() any

func (*Plugin) Handler

func (p *Plugin) Handler(next http.Handler) http.Handler

Handler remains a narrow compatibility seam for callers that have not yet installed the request/terminal phases. The route pipeline uses the explicit interfaces above and never enters this legacy next-aware path.

func (*Plugin) Init

func (p *Plugin) Init() error

func (*Plugin) MaterializeScopedSecrets

func (p *Plugin) MaterializeScopedSecrets(
	ctx context.Context, access base.ScopedSecretAccess,
) error

func (*Plugin) PostInit

func (p *Plugin) PostInit() error

func (*Plugin) RunExclusiveProtocol

RunExclusiveProtocol consumes the prepared provider operation exactly once. AI responses are upstream-owned, so the response source is selected before the provider operation can write, flush, or return a streaming body.

func (*Plugin) RunRequestPhase

func (p *Plugin) RunRequestPhase(w http.ResponseWriter, r *http.Request) base.RequestPhaseResult

RunRequestPhase validates and prepares the request-local AI execution. It never contacts the provider or invokes a downstream handler; the explicit protocol owner consumes the published operation after before-proxy hooks.

func (*Plugin) Stop

func (p *Plugin) Stop()

func (*Plugin) ValidatePreMaterialization

func (p *Plugin) ValidatePreMaterialization() error

Jump to

Keyboard shortcuts

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