Documentation
¶
Index ¶
- Variables
- type AccountingStore
- type Authenticator
- type AuthenticatorFunc
- type Authorizer
- type CatalogSource
- type Clock
- type CounterStore
- type Dependencies
- type DisabledResponseCache
- type DiscardTelemetrySink
- type Engine
- func (e *Engine) Authorize(ctx context.Context, principal contract.Principal, publicModel string) error
- func (e *Engine) Drain(ctx context.Context) error
- func (e *Engine) Handler(options HTTPOptions) (http.Handler, error)
- func (e *Engine) Invoke(ctx context.Context, principal contract.Principal, request contract.Request) (contract.Response, error)
- func (e *Engine) Probe(ctx context.Context) (HealthReport, error)
- func (e *Engine) Reload(ctx context.Context) error
- func (e *Engine) Snapshot() (*catalog.Snapshot, error)
- func (e *Engine) Status() Status
- func (e *Engine) Stream(ctx context.Context, principal contract.Principal, request contract.Request) (EventStream, error)
- type EventStream
- type FallbackCounterStore
- func (s FallbackCounterStore) Acquire(ctx context.Context, key string, maximum int64, ttl time.Duration) (string, error)
- func (s FallbackCounterStore) Add(ctx context.Context, key string, delta int64, ttl time.Duration) (int64, error)
- func (s FallbackCounterStore) Delete(ctx context.Context, key string) error
- func (s FallbackCounterStore) Get(ctx context.Context, key string) (int64, bool, error)
- func (s FallbackCounterStore) Release(ctx context.Context, token string) error
- type GatewayStream
- type HTTPOptions
- type HealthReport
- type LocalCounterStore
- func (s *LocalCounterStore) Acquire(ctx context.Context, key string, maximum int64, ttl time.Duration) (string, error)
- func (s *LocalCounterStore) Add(ctx context.Context, key string, delta int64, ttl time.Duration) (int64, error)
- func (s *LocalCounterStore) Delete(ctx context.Context, key string) error
- func (s *LocalCounterStore) Get(ctx context.Context, key string) (int64, bool, error)
- func (s *LocalCounterStore) Release(ctx context.Context, token string) error
- type Options
- type RandomSelector
- type ResponseCache
- type SecretResolver
- type Selector
- type Status
- type SystemClock
- type TelemetryEvent
- type TelemetrySink
- type Timer
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AccountingStore ¶
type Authenticator ¶
type AuthenticatorFunc ¶
func (AuthenticatorFunc) Authenticate ¶
type Authorizer ¶
type CatalogSource ¶
type CounterStore ¶
type Dependencies ¶
type Dependencies struct {
Catalog CatalogSource
Secrets SecretResolver
Adapters *adapter.Registry
Authorizer Authorizer
Accounting AccountingStore
Counters CounterStore
Cache ResponseCache
Guardrails *guardrail.Registry
Telemetry TelemetrySink
Selector Selector
Clock Clock
}
type DisabledResponseCache ¶
type DisabledResponseCache struct{}
DisabledResponseCache is an explicit cache opt-out.
func (DisabledResponseCache) Delete ¶
func (DisabledResponseCache) Delete(context.Context, string) error
type DiscardTelemetrySink ¶
type DiscardTelemetrySink struct{}
DiscardTelemetrySink is an explicit opt-out for hosts that do not emit gateway telemetry.
func (DiscardTelemetrySink) Record ¶
func (DiscardTelemetrySink) Record(context.Context, TelemetryEvent)
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) Authorize ¶
func (e *Engine) Authorize(ctx context.Context, principal contract.Principal, publicModel string) error
Authorize evaluates model visibility through the same host policy used by invocation. Protocol handlers use it for discovery without duplicating ACLs.
func (*Engine) Handler ¶
func (e *Engine) Handler(options HTTPOptions) (http.Handler, error)
Handler exposes the engine's supported OpenAI-compatible HTTP routes.
type EventStream ¶
type EventStream = contract.EventStream
type FallbackCounterStore ¶
type FallbackCounterStore struct {
// contains filtered or unexported fields
}
FallbackCounterStore keeps disposable deployment protection available when distributed coordination fails. Durable budgets remain the responsibility of AccountingStore and never use this fallback.
func NewFallbackCounterStore ¶
func NewFallbackCounterStore(primary, fallback CounterStore, onError func(error)) (*FallbackCounterStore, error)
func (FallbackCounterStore) Delete ¶
func (s FallbackCounterStore) Delete(ctx context.Context, key string) error
type GatewayStream ¶
type GatewayStream struct {
// contains filtered or unexported fields
}
func (*GatewayStream) Next ¶
func (s *GatewayStream) Next(ctx context.Context) (contract.StreamEvent, error)
Next hands the first validated event to the caller and irrevocably commits this stream to its selected deployment. Provider switching is impossible after this method returns an event.
type HTTPOptions ¶
type HTTPOptions struct {
Authenticator Authenticator
Protocol openai.Options
}
HTTPOptions configures the strict OpenAI-compatible HTTP surface. The authenticator is supplied here so hosts that invoke the engine directly do not need to configure an unused HTTP authentication path.
type HealthReport ¶
type LocalCounterStore ¶
type LocalCounterStore struct {
// contains filtered or unexported fields
}
LocalCounterStore is a bounded-process fallback for transient counters and leases. Expired entries are discarded opportunistically on access.
func NewLocalCounterStore ¶
func NewLocalCounterStore() *LocalCounterStore
func (*LocalCounterStore) Delete ¶
func (s *LocalCounterStore) Delete(ctx context.Context, key string) error
type Options ¶
type Options struct {
MaxAttempts int
FinalizationTimeout time.Duration
BaseRetryDelay time.Duration
MaxRetryDelay time.Duration
CircuitFailures int64
CircuitWindow time.Duration
CircuitCooldown time.Duration
CacheTTL time.Duration
CacheTimeout time.Duration
MaxCacheEntryBytes int
FirstEventTimeout time.Duration
StreamIdleTimeout time.Duration
RequestTimeout time.Duration
HealthProbeTimeout time.Duration
HealthProbeWorkers int
}
type RandomSelector ¶
type RandomSelector struct{}
RandomSelector is the production weighted-route selector. Tests should use an injected deterministic selector instead.
func (RandomSelector) Intn ¶
func (RandomSelector) Intn(limit int) int
type ResponseCache ¶
type SecretResolver ¶
type Status ¶
type Status struct {
Ready bool `json:"ready"`
Draining bool `json:"draining"`
Degraded bool `json:"degraded"`
Revision uint64 `json:"revision"`
RejectedRevision uint64 `json:"rejected_revision,omitempty"`
ReloadStage string `json:"reload_stage,omitempty"`
}
Status is a redacted, point-in-time view of engine lifecycle and catalog readiness. Failure stages are stable categories and never contain host or provider error text.
type SystemClock ¶
type SystemClock struct{}
SystemClock is the production wall clock implementation.
func (SystemClock) Now ¶
func (SystemClock) Now() time.Time
type TelemetryEvent ¶
type TelemetrySink ¶
type TelemetrySink interface {
Record(context.Context, TelemetryEvent)
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
openaicompat
Package openaicompat implements a strict OpenAI-compatible upstream adapter.
|
Package openaicompat implements a strict OpenAI-compatible upstream adapter. |
|
examples
|
|
|
basic
command
|
|
|
internal
|
|
|
protocol
|
|