Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions api/applyconfiguration/api/v1alpha1/authheaderoverride.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions api/applyconfiguration/api/v1alpha1/llmprovider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions api/applyconfiguration/api/v1alpha1/pathoverride.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions api/applyconfiguration/internal/internal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/applyconfiguration/utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions api/v1alpha1/ai_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,37 @@ type LLMProvider struct {
// Send requests to a custom host and port, such as to proxy the request,
// or to use a different backend that is API-compliant with the Backend version.
HostOverride *Host `json:"hostOverride,omitempty"`

// TODO: Consolidate all Override options into ProviderOverride.
// Overrides the default API path for the LLM provider.
// Allows routing requests to a custom API endpoint path.
PathOverride *PathOverride `json:"pathOverride,omitempty"`

// Customizes the Authorization header sent to the LLM provider.
// Allows changing the header name and/or the prefix (e.g., "Bearer").
// Note: Not all LLM providers use the Authorization header and prefix.
// For example, OpenAI uses header: "Authorization" and prefix: "Bearer" But Azure OpenAI uses header: "api-key"
//and no Bearer.
AuthHeaderOverride *AuthHeaderOverride `json:"authHeaderOverride,omitempty"`
}

// PathOverride configures the AI gateway to use a custom path for LLM provider chat-completion API requests.
// It allows overriding the default API path with a custom one.
// This is useful when you need to route requests to a different API endpoint while maintaining
// compatibility with the original provider's API structure.
// +kubebuilder:validation:MinProperties=1
type PathOverride struct {
// FullPath specifies the custom API path to use for the LLM provider requests.
// This path will replace the default API path for the provider.
FullPath *string `json:"fullPath"`
}

// AuthHeaderOverride allows customization of the default Authorization header sent to the LLM Provider.
// The default header is `Authorization: Bearer <token>`. HeaderName can change the Authorization
// header name and Prefix can change the Bearer prefix
type AuthHeaderOverride struct {
Prefix *string `json:"prefix,omitempty"`
HeaderName *string `json:"headerName,omitempty"`
}

// SupportedLLMProvider configures the AI gateway to use a single LLM provider backend.
Expand Down
55 changes: 55 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ spec:
properties:
llm:
properties:
authHeaderOverride:
properties:
headerName:
type: string
prefix:
type: string
type: object
hostOverride:
properties:
host:
Expand All @@ -62,6 +69,14 @@ spec:
- host
- port
type: object
pathOverride:
minProperties: 1
properties:
fullPath:
type: string
required:
- fullPath
type: object
provider:
maxProperties: 1
minProperties: 1
Expand Down Expand Up @@ -250,6 +265,13 @@ spec:
pool:
items:
properties:
authHeaderOverride:
properties:
headerName:
type: string
prefix:
type: string
type: object
hostOverride:
properties:
host:
Expand All @@ -266,6 +288,14 @@ spec:
- host
- port
type: object
pathOverride:
minProperties: 1
properties:
fullPath:
type: string
required:
- fullPath
type: object
provider:
maxProperties: 1
minProperties: 1
Expand Down
Loading