Documentation
¶
Overview ¶
Package openai implements the OpenAI-compatible HTTP execution boundary. It classifies transport/protocol failures into stable load error codes and never returns response bodies, request bodies, URLs, or credentials in an Observation.
Index ¶
- Constants
- Variables
- type Client
- func (client *Client) Close() error
- func (client *Client) Executor(request domain.TestRequest) (load.Executor, error)
- func (Client) GoString() string
- func (Client) MarshalJSON() ([]byte, error)
- func (client *Client) ProbeExecutor(request domain.TestRequest, classifier ProbeClassifier) (load.Executor, error)
- func (Client) String() string
- type FailureResponseEvidence
- type FailureResponseEvidenceSink
- type Option
- type ProbeClassifier
Constants ¶
const ( // MaxSSELineBytes and MaxSSEEventBytes cap transient parser allocations // independently of the total response limit. MaxSSELines caps parser work. MaxSSELineBytes int64 = 64 << 10 MaxSSEEventBytes int64 = 256 << 10 MaxSSELines int64 = 32_768 )
Variables ¶
var ( ErrSecretSerialization = errors.New("openai client contains credential material and cannot be serialized") ErrInvalidChannel = errors.New("invalid OpenAI channel configuration") ErrUnsupportedProtocol = errors.New("unsupported OpenAI channel protocol") ErrCredentialRequired = errors.New("OpenAI credential lease is required") ErrInvalidTransport = errors.New("invalid OpenAI HTTP transport") ErrInvalidOption = errors.New("invalid OpenAI client option") ErrInvalidRequest = errors.New("invalid OpenAI request definition") ErrClientClosed = errors.New("OpenAI client is closed") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(channel domain.ChannelSnapshot, lease *credentials.Lease, transport http.RoundTripper, options ...Option) (*Client, error)
NewClient constructs an executor-owned HTTP client. Callers may supply a transport (for proxy/TLS/test configuration), but never an http.Client, so redirect behavior remains under this package's control.
func (*Client) Close ¶
Close is a revocation barrier: it blocks new executions, clears the retained credential, cancels active requests, and waits until their executor frames have completed before returning.
func (Client) MarshalJSON ¶
func (*Client) ProbeExecutor ¶
func (client *Client) ProbeExecutor(request domain.TestRequest, classifier ProbeClassifier) (load.Executor, error)
type FailureResponseEvidence ¶
type FailureResponseEvidence struct {
RequestIndex uint64
HTTPStatus int
ContentType string
RequestID string
Body string
BodyBytes uint64
Truncated bool
}
FailureResponseEvidence contains only bounded response metadata and a redacted body; it never includes request headers or credentials.
type FailureResponseEvidenceSink ¶
type FailureResponseEvidenceSink func(FailureResponseEvidence)
FailureResponseEvidenceSink receives one safe response snapshot for each request that fails after an HTTP response is available.
type Option ¶
func WithFailureResponseEvidence ¶
func WithFailureResponseEvidence(limit int64, sink FailureResponseEvidenceSink) Option
WithFailureResponseEvidence enables opt-in, bounded, redacted capture for failed HTTP responses. The default executor behavior does not retain bodies.