base

package
v1.140.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package base provides compatibility aliases for shared provider state.

Index

Constants

View Source
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

func VerifyDockerGatewayAuth(ctx context.Context, env environment.Provider, gateway string) error

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 Config

type Config = contracts.Config

Config is the common configuration embedded by provider clients.

type EmbeddingResult

type EmbeddingResult = contracts.EmbeddingResult

EmbeddingResult contains an embedding and its usage.

type GatewayClient added in v1.140.0

type GatewayClient struct {
	HTTPClient *http.Client
	BaseURL    string
	AuthToken  string
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL