gitlab

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package gitlab provides GitLab Duo's documented AI Gateway proxy endpoints. It exchanges the caller's GitLab PAT/OAuth access token for the short-lived direct-access token required by the proxy before forwarding inference calls.

Index

Constants

View Source
const (
	DefaultOpenAIBaseURL    = "https://cloud.gitlab.com/ai/v1/proxy/openai/v1"
	DefaultAnthropicBaseURL = "https://cloud.gitlab.com/ai/v1/proxy/anthropic"
)

Variables

This section is empty.

Functions

func New

func New(selected model.Model, key auth.APIKey, providerOptions ...Option) (inference.Client, error)

Types

type CounterSupportError

type CounterSupportError = llm.CounterSupportError

type DirectAccessError

type DirectAccessError struct {
	Status int
	Reason string
	Err    error
}

func (*DirectAccessError) Error

func (e *DirectAccessError) Error() string

func (*DirectAccessError) Unwrap

func (e *DirectAccessError) Unwrap() error

type ModelMappingError

type ModelMappingError struct {
	Alias  string
	Format model.APIFormat
	Reason string
}

func (*ModelMappingError) Error

func (e *ModelMappingError) Error() string

type Option

type Option func(*options)

func WithAIGatewayHeader

func WithAIGatewayHeader(name, value string) Option

func WithAIGatewayURL

func WithAIGatewayURL(baseURL string) Option

WithAIGatewayURL overrides the GitLab AI Gateway proxy base URL. An instance URL is intentionally not sent as a made-up inference header: GitLab uses it for control-plane discovery, while this package owns only the inference proxy transport.

func WithFeatureFlag

func WithFeatureFlag(name string, enabled bool) Option

WithFeatureFlag includes one documented GitLab AI feature flag in the direct-access-token exchange request.

func WithHeader

func WithHeader(name, value string) Option

func WithInstanceURL

func WithInstanceURL(baseURL string) Option

WithInstanceURL overrides the GitLab instance used for direct-access-token exchange. It is useful for self-managed GitLab and deterministic tests.

func WithReasoningEffort

func WithReasoningEffort(value string) Option

func WithThinkingBudget

func WithThinkingBudget(budget int) Option

func WithUpstreamModelID

func WithUpstreamModelID(id string, apiFormat model.APIFormat) Option

WithUpstreamModelID explicitly selects a documented upstream model ID for a custom or newer GitLab alias. The API format must match the selected model so a Chat/Responses/Anthropic request cannot be sent to the wrong upstream API.

Jump to

Keyboard shortcuts

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