Documentation
¶
Overview ¶
Package base provides compatibility aliases for shared provider state.
Index ¶
- Constants
- func GatewayAuthRetry(env environment.Provider, gateway string) []httpclient.Opt
- func GatewayAuthToken(ctx context.Context, env environment.Provider, gateway string) (string, error)
- func GatewayHTTPOptions(gatewayURL *url.URL, defaultBaseURL string, cfg *latest.ModelConfig, ...) []httpclient.Opt
- func VerifyDockerGatewayAuth(ctx context.Context, env environment.Provider, gateway string) error
- type BatchEmbeddingResult
- type Config
- type EmbeddingResult
- type GatewayClient
- type RebuildProviderFunc
Constants ¶
const NoDesktopTokenErrorMessage = "failed to get Docker Desktop token for Gateway. Is Docker Desktop running and are you signed in?"
Variables ¶
This section is empty.
Functions ¶
func GatewayAuthRetry ¶ added in v1.125.0
func GatewayAuthRetry(env environment.Provider, gateway string) []httpclient.Opt
GatewayAuthRetry lets a client recover from a gateway that rejects the Docker token it presented: the token is forgotten and the request replayed once with a fresh one. Empty for gateways that don't authenticate with a Docker login, and a no-op when the token comes from a static source (an explicitly set DOCKER_TOKEN can't be refreshed, and must not be second-guessed).
func GatewayAuthToken ¶ added in v1.94.0
func GatewayAuthToken(ctx context.Context, env environment.Provider, gateway string) (string, error)
GatewayAuthToken returns a fresh Docker Desktop auth token for trusted gateways. Docker domains require a token; loopback gateways may proceed without one. Other gateways receive no Docker token.
func GatewayHTTPOptions ¶ added in v1.94.0
func GatewayHTTPOptions(gatewayURL *url.URL, defaultBaseURL string, cfg *latest.ModelConfig, modelOpts *options.ModelOptions) []httpclient.Opt
GatewayHTTPOptions builds the httpclient options shared by all gateway-mode provider clients: the proxied base URL (the provider's public endpoint unless the model overrides base_url), provider/model identity, the gateway's query parameters, and the title-generation / compaction markers. A nil modelOpts is treated as zero options (no markers).
func VerifyDockerGatewayAuth ¶ added in v1.94.0
VerifyDockerGatewayAuth fails fast when gateway targets a Docker domain but Docker Desktop's auth token is unavailable. Provider clients call it at construction time so a missing sign-in surfaces before the first request. Loopback and non-Docker gateways need no Desktop token and always pass.
Types ¶
type BatchEmbeddingResult ¶
type BatchEmbeddingResult = contracts.BatchEmbeddingResult
BatchEmbeddingResult contains embeddings and their aggregate usage.
type EmbeddingResult ¶
type EmbeddingResult = contracts.EmbeddingResult
EmbeddingResult contains an embedding and its usage.
type GatewayClient ¶ added in v1.140.0
GatewayClient holds the per-request HTTP client and SDK connection settings. Each provider remains responsible for applying AuthToken to its SDK.
func NewGatewayClient ¶ added in v1.140.0
func NewGatewayClient(ctx context.Context, env environment.Provider, gateway, defaultBaseURL, pathSuffix string, cfg *latest.ModelConfig, modelOpts *options.ModelOptions, extra ...httpclient.Opt) (*GatewayClient, error)
NewGatewayClient refreshes gateway auth and builds a transport for one SDK call. Call it inside the provider's clientFn, not at provider construction time.
type RebuildProviderFunc ¶ added in v1.140.0
type RebuildProviderFunc = contracts.RebuildProviderFunc
RebuildProviderFunc reconstructs a provider with adjusted options.