Documentation
¶
Overview ¶
Package coretransport hands the surface requests Compa's chat client makes to an llmgw-core provider. Transport is an http.RoundTripper: it reads the surface from the request path and the model and stream flag from the body, calls the provider's Invoke or Stream, and turns a successful answer back into an HTTP response - a JSON body or an SSE body built from the provider's frames.
A failure is never turned into an HTTP error response. RoundTrip returns the provider's own error, a classified core error that carries its routing metadata (core.ClassifyError), and a stream that fails later fails its body's Read with that error. The client unwraps the *url.Error http.Client adds, so errors.As finds the core error. Once the request's context ends, the error is the context's, so cancellation stays distinct from a provider failure.
Index ¶
Constants ¶
const BaseURL = "http://core.invalid/v1"
BaseURL is the placeholder base the chat client addresses: the transport keeps only the request path's surface.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CredentialSource ¶
type CredentialSource func(ctx context.Context) (*core.Credential, error)
CredentialSource returns the credential for one request, or nil for a provider that needs none. It runs per request, so a refreshable credential is always current.
func StaticCredential ¶
func StaticCredential(credential *core.Credential) CredentialSource
StaticCredential returns a source for a credential that never changes. A nil credential yields none.
type Transport ¶
type Transport struct {
// Provider serves the requests.
Provider core.Provider
// Credential returns each request's credential. Nil sends none.
Credential CredentialSource
}
Transport sends surface requests to one core provider.