Documentation
¶
Overview ¶
Package openai provides the OpenAI-compatible protocol handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface {
Authenticate(context.Context, Credential) (Principal, error)
}
Authenticator validates an OpenAI-compatible credential.
type AuthenticatorFunc ¶
type AuthenticatorFunc func(context.Context, Credential) (Principal, error)
AuthenticatorFunc adapts a function to Authenticator.
func (AuthenticatorFunc) Authenticate ¶
func (f AuthenticatorFunc) Authenticate(ctx context.Context, credential Credential) (Principal, error)
type Credential ¶
Credential is a redaction-safe authentication input. Token must never be logged or retained after Authenticate returns.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements the frozen OpenAI M1 protocol profile.
func NewHandler ¶
NewHandler constructs an independently mountable OpenAI http.Handler.
type Option ¶
type Option func(*settings) error
Option configures an OpenAI handler.
func WithAuthenticator ¶
func WithAuthenticator(authenticator Authenticator) Option
WithAuthenticator installs application-owned credential validation. Without this option the handler accepts requests and supplies an anonymous principal.
func WithBasePath ¶
WithBasePath changes the default /v1 route prefix.
func WithMaxBodyBytes ¶
WithMaxBodyBytes sets the maximum buffered request body size.
func WithOriginPatterns ¶
WithOriginPatterns authorizes browser WebSocket origins.
func WithoutSchemaValidation ¶
func WithoutSchemaValidation() Option
WithoutSchemaValidation disables OpenAPI request/response validation. It is intended only for diagnostics and forward-compatibility experiments.