Documentation
¶
Index ¶
- type Auth
- type Config
- 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) MaterializeScopedSecrets(ctx context.Context, access base.ScopedSecretAccess) 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()
- func (p *Plugin) ValidatePreMaterialization() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 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 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) MaterializeScopedSecrets ¶
func (*Plugin) RunExclusiveProtocol ¶
func (p *Plugin) RunExclusiveProtocol( w http.ResponseWriter, r *http.Request, next http.Handler, ) (base.ProtocolDisposition, *http.Request, apisixctx.ResponseSource, error)
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.