Skip to content
Open
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
22 changes: 22 additions & 0 deletions api/v1alpha1/llmprovider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ type AnthropicConfig struct {
URL string `json:"url,omitempty"`
}

// GoogleCloudVertexModelProvider selects which model provider stack talks to Vertex AI.
//
// +kubebuilder:validation:Enum=Anthropic;Google;OpenAI
type GoogleCloudVertexModelProvider string

const (
// GoogleCloudVertexModelProviderAnthropic uses Anthropic models on Vertex (Claude SDK).
GoogleCloudVertexModelProviderAnthropic GoogleCloudVertexModelProvider = "Anthropic"
// GoogleCloudVertexModelProviderGoogle uses Google models on Vertex (GenAI SDK).
GoogleCloudVertexModelProviderGoogle GoogleCloudVertexModelProvider = "Google"
// GoogleCloudVertexModelProviderOpenAI uses OpenAI-compatible models on Vertex (OpenAI SDK).
GoogleCloudVertexModelProviderOpenAI GoogleCloudVertexModelProvider = "OpenAI"
)

// GoogleCloudVertexConfig contains configuration for the Google Cloud Vertex AI provider.
type GoogleCloudVertexConfig struct {
// credentialsSecret references a Secret in the operator namespace
Expand Down Expand Up @@ -100,6 +114,13 @@ type GoogleCloudVertexConfig struct {
// +kubebuilder:validation:XValidation:rule="self.matches('^[a-z][a-z0-9-]*[a-z0-9]$')",message="region must contain only lowercase letters, digits, and hyphens, start with a letter, and not end with a hyphen"
Region string `json:"region,omitempty"`

// modelProvider selects which model provider stack talks to Vertex AI (required).
// "Anthropic" uses Anthropic models on Vertex; "Google" uses Google models on Vertex;
// "OpenAI" uses OpenAI-compatible models on Vertex.
// Enum is defined on GoogleCloudVertexModelProvider.
// +required
ModelProvider GoogleCloudVertexModelProvider `json:"modelProvider"`

// url is an optional override for the Vertex AI API endpoint.
// Only needed for custom deployments or API proxies.
// Must be a valid HTTP or HTTPS URL with a hostname. Paths and query
Expand Down Expand Up @@ -312,6 +333,7 @@ type LLMProviderSpec struct {
// name: llm-credentials
// projectID: my-gcp-project
// region: us-central1
// modelProvider: Anthropic
type LLMProvider struct {
metav1.TypeMeta `json:",inline"`

Expand Down
15 changes: 14 additions & 1 deletion config/crd/bases/agentic.openshift.io_llmproviders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ spec:
AI provider (model specified on Agent, not here):\n\n\tapiVersion: agentic.openshift.io/v1alpha1\n\tkind:
LLMProvider\n\tmetadata:\n\t name: vertex-ai\n\tspec:\n\t type: GoogleCloudVertex\n\t
\ googleCloudVertex:\n\t credentialsSecret:\n\t name: llm-credentials\n\t
\ projectID: my-gcp-project\n\t region: us-central1"
\ projectID: my-gcp-project\n\t region: us-central1\n\t modelProvider:
Anthropic"
properties:
apiVersion:
description: |-
Expand Down Expand Up @@ -268,6 +269,17 @@ spec:
required:
- name
type: object
modelProvider:
description: |-
modelProvider selects which model provider stack talks to Vertex AI (required).
"Anthropic" uses Anthropic models on Vertex; "Google" uses Google models on Vertex;
"OpenAI" uses OpenAI-compatible models on Vertex.
Enum is defined on GoogleCloudVertexModelProvider.
enum:
- Anthropic
- Google
- OpenAI
type: string
projectID:
description: |-
projectID is the Google Cloud Project ID where Vertex AI is enabled.
Expand Down Expand Up @@ -316,6 +328,7 @@ spec:
rule: '!self.contains(''#'')'
required:
- credentialsSecret
- modelProvider
- projectID
- region
type: object
Expand Down
1 change: 1 addition & 0 deletions controller/proposal/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func testLLM(name string) *agenticv1alpha1.LLMProvider {
CredentialsSecret: agenticv1alpha1.SecretReference{Name: "llm-secret"},
ProjectID: "test-project",
Region: "us-central1",
ModelProvider: agenticv1alpha1.GoogleCloudVertexModelProviderAnthropic,
},
},
}
Expand Down
1 change: 1 addition & 0 deletions examples/setup/00-llm-providers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ spec:
name: llm-credentials
projectID: my-gcp-project
region: us-central1
modelProvider: Anthropic
1 change: 1 addition & 0 deletions test/e2e/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func createFixtures(t *testing.T, c client.Client) *e2eFixtures {
CredentialsSecret: agenticv1alpha1.SecretReference{Name: "e2e-llm-secret"},
ProjectID: "e2e-project",
Region: "us-central1",
ModelProvider: agenticv1alpha1.GoogleCloudVertexModelProviderAnthropic,
},
},
},
Expand Down