Documentation
¶
Overview ¶
Package openaiprovider provides the instance-owned OpenAI Responses client used by the Spice Agent model adapter.
Index ¶
Constants ¶
const MetadataNamespace = "github.com/spice-framework/spice-agent-provider-openai"
MetadataNamespace is the exact provider extension namespace applications may allowlist in agent.EngineOptions. Its values never contain content, credentials, headers, URLs, or raw provider payloads.
Variables ¶
This section is empty.
Functions ¶
func Manifest ¶
func Manifest() spicestarter.Manifest
Manifest returns OpenAI provider compatibility and review metadata.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client owns one configured OpenAI Responses service. Construction performs no network I/O and never consults ambient OpenAI environment variables.
func New ¶
func New(config Config, options ...ClientOption) (*Client, error)
New validates configuration and constructs an instance-owned Responses client without making a request.
type ClientOption ¶
type ClientOption func(*clientOptions) error
ClientOption customizes client construction without adding hidden globals.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ClientOption
WithHTTPClient supplies an instance-owned HTTP client, typically for tests or application-specific transport policy.
type Config ¶
type Config struct {
APIKey string `spice:"api-key,required,secret,env=OPENAI_API_KEY"`
BaseURL string `spice:"base-url,default=https://api.openai.com/v1,env=OPENAI_BASE_URL"`
Organization string `spice:"organization,env=OPENAI_ORGANIZATION"`
Project string `spice:"project,env=OPENAI_PROJECT"`
Timeout time.Duration `spice:"timeout,default=2m,env=OPENAI_TIMEOUT"`
MaxRetries int `spice:"max-retries,default=0,env=OPENAI_MAX_RETRIES"`
}
Config is the typed, secret-aware configuration for one provider instance. APIKey is deliberately excluded from String output and validation errors. BaseURL requires HTTPS except for explicit localhost or IP-loopback HTTP test bridges; loopback HTTP provides no transport security. A zero Timeout selects two minutes; explicit values must not exceed thirty minutes.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is bounded, redacted OpenAI failure metadata. It deliberately excludes response bodies, prompts, tool data, request URLs, and authorization headers.
func (*Error) Retryable ¶
Retryable reports whether a failure happened before an observed stream and is safe to retry with the operation's stable idempotency key.
func (*Error) StatusCode ¶
StatusCode returns an HTTP status, or zero when no response was received.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package autoconfigure contributes the default OpenAI client only when an application explicitly blank-imports this package.
|
Package autoconfigure contributes the default OpenAI client only when an application explicitly blank-imports this package. |
|
internal
|
|
|
qualitygate
command
Command qualitygate runs this repository's cross-platform quality contract.
|
Command qualitygate runs this repository's cross-platform quality contract. |