Documentation
¶
Index ¶
- type ActiveHealthCheck
- type Auth
- type Balancer
- type Config
- type HealthChecks
- type HealthyCheckPolicy
- type Instance
- type LLMOptions
- type Logging
- type Override
- type Plugin
- func (p *Plugin) Config() any
- func (p *Plugin) Handler(next http.Handler) http.Handler
- func (p *Plugin) Init() error
- func (p *Plugin) PostInit() error
- func (p *Plugin) RunExclusiveProtocol(w http.ResponseWriter, r *http.Request, next http.Handler) (base.ProtocolDisposition, *http.Request, apisixctx.ResponseSource, error)
- func (p *Plugin) RunRequestPhase(w http.ResponseWriter, r *http.Request) base.RequestPhaseResult
- func (p *Plugin) Stop()
- type UnhealthyCheckPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveHealthCheck ¶
type ActiveHealthCheck struct {
Type string `json:"type,omitempty"`
Timeout float64 `json:"timeout,omitempty"`
Concurrency int `json:"concurrency,omitempty"`
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
HTTPPath string `json:"http_path,omitempty"`
HTTPSVerifyCertificate *bool `json:"https_verify_certificate,omitempty"`
Healthy HealthyCheckPolicy `json:"healthy"`
Unhealthy UnhealthyCheckPolicy `json:"unhealthy"`
ReqHeaders []string `json:"req_headers,omitempty"`
}
type Config ¶
type Config struct {
Balancer Balancer `json:"balancer"`
Instances []Instance `json:"instances"`
Logging Logging `json:"logging"`
FallbackStrategy any `json:"fallback_strategy,omitempty"`
MaxRetries *int `json:"max_retries,omitempty"`
RetryOnFailureWithinMS int `json:"retry_on_failure_within_ms,omitempty"`
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 includes bounded and streaming modes; each selected provider instance may choose SSE at request time.
type HealthChecks ¶
type HealthChecks struct {
Active ActiveHealthCheck `json:"active"`
}
type HealthyCheckPolicy ¶
type Instance ¶
type Instance struct {
Name string `json:"name"`
Provider string `json:"provider"`
ProviderConf map[string]any `json:"provider_conf,omitempty"`
Priority int `json:"priority,omitempty"`
Weight int `json:"weight"`
Auth Auth `json:"auth"`
Options map[string]any `json:"options,omitempty"`
Override Override `json:"override"`
Checks *HealthChecks `json:"checks,omitempty"`
}
type LLMOptions ¶
type LLMOptions struct {
MaxTokens int `json:"max_tokens,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) Handler ¶
Handler is retained only for direct callers that have not installed the explicit request/response phases. Route assembly uses the interfaces above.
func (*Plugin) RunExclusiveProtocol ¶
func (p *Plugin) RunExclusiveProtocol( w http.ResponseWriter, r *http.Request, next http.Handler, ) (base.ProtocolDisposition, *http.Request, apisixctx.ResponseSource, error)
RunExclusiveProtocol executes the selected AI instance once and marks its response as upstream-owned before any provider bytes can be committed.
func (*Plugin) RunRequestPhase ¶
func (p *Plugin) RunRequestPhase(w http.ResponseWriter, r *http.Request) base.RequestPhaseResult
RunRequestPhase parses the client document, selects the initial provider instance, and publishes one request-local execution state. Provider I/O is deferred to RunExclusiveProtocol until all before-proxy hooks have run.