-
Notifications
You must be signed in to change notification settings - Fork 645
fix(translator): honor APIKeyPassthrough for Gemini provider #2042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mesutoezdil
wants to merge
18
commits into
kagent-dev:main
Choose a base branch
from
mesutoezdil:fix/gemini-api-key-passthrough
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+379
−11
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4a2fc83
fix(translator): honor APIKeyPassthrough for Gemini provider
mesutoezdil 2c5f4a9
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil adba18b
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil c587c00
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil 6c21e96
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil a7644bd
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil 3ca9822
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil 5961abc
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil a3ab3d1
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil 6992312
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil 1ea9f5d
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil c5a670d
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil d88c382
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil e844032
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil 843b4b2
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil 4431ba5
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil 4397763
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil ad46eef
Merge branch 'main' into fix/gemini-api-key-passthrough
mesutoezdil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...e/internal/controller/translator/agent/testdata/inputs/agent_with_gemini_passthrough.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| operation: translateAgent | ||
| targetObject: gemini-passthrough-agent | ||
| namespace: test | ||
| objects: | ||
| - apiVersion: kagent.dev/v1alpha2 | ||
| kind: ModelConfig | ||
| metadata: | ||
| name: gemini-passthrough-model | ||
| namespace: test | ||
| spec: | ||
| provider: Gemini | ||
| model: gemini-2.0-flash | ||
| apiKeyPassthrough: true | ||
| - apiVersion: kagent.dev/v1alpha2 | ||
| kind: Agent | ||
| metadata: | ||
| name: gemini-passthrough-agent | ||
| namespace: test | ||
| spec: | ||
| type: Declarative | ||
| declarative: | ||
| description: A Gemini agent using API key passthrough | ||
| systemMessage: You are a helpful assistant. | ||
| modelConfig: gemini-passthrough-model | ||
| tools: [] |
285 changes: 285 additions & 0 deletions
285
.../internal/controller/translator/agent/testdata/outputs/agent_with_gemini_passthrough.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,285 @@ | ||
| { | ||
| "agentCard": { | ||
| "capabilities": { | ||
| "streaming": true | ||
| }, | ||
| "defaultInputModes": [ | ||
| "text" | ||
| ], | ||
| "defaultOutputModes": [ | ||
| "text" | ||
| ], | ||
| "description": "", | ||
| "name": "gemini_passthrough_agent", | ||
| "skills": null, | ||
| "supportedInterfaces": [ | ||
| { | ||
| "protocolBinding": "JSONRPC", | ||
| "protocolVersion": "0.3", | ||
| "url": "http://gemini-passthrough-agent.test:8080" | ||
| }, | ||
| { | ||
| "protocolBinding": "JSONRPC", | ||
| "protocolVersion": "1.0", | ||
| "url": "http://gemini-passthrough-agent.test:8080" | ||
| } | ||
| ], | ||
| "version": "" | ||
| }, | ||
| "config": { | ||
| "description": "", | ||
| "instruction": "You are a helpful assistant.", | ||
| "model": { | ||
| "api_key_passthrough": true, | ||
| "model": "gemini-2.0-flash", | ||
| "type": "gemini" | ||
| }, | ||
| "stream": false | ||
| }, | ||
| "manifest": [ | ||
| { | ||
| "apiVersion": "v1", | ||
| "kind": "Secret", | ||
| "metadata": { | ||
| "labels": { | ||
| "app": "kagent", | ||
| "app.kubernetes.io/managed-by": "kagent", | ||
| "app.kubernetes.io/name": "gemini-passthrough-agent", | ||
| "app.kubernetes.io/part-of": "kagent", | ||
| "kagent": "gemini-passthrough-agent" | ||
| }, | ||
| "name": "gemini-passthrough-agent", | ||
| "namespace": "test", | ||
| "ownerReferences": [ | ||
| { | ||
| "apiVersion": "kagent.dev/v1alpha2", | ||
| "blockOwnerDeletion": true, | ||
| "controller": true, | ||
| "kind": "Agent", | ||
| "name": "gemini-passthrough-agent", | ||
| "uid": "" | ||
| } | ||
| ] | ||
| }, | ||
| "stringData": { | ||
| "agent-card.json": "{\n \"defaultInputModes\": [\n \"text\"\n ],\n \"defaultOutputModes\": [\n \"text\"\n ],\n \"description\": \"\",\n \"name\": \"gemini_passthrough_agent\",\n \"version\": \"\",\n \"skills\": [],\n \"capabilities\": {\n \"streaming\": true\n },\n \"supportedInterfaces\": [\n {\n \"url\": \"http://gemini-passthrough-agent.test:8080\",\n \"protocolBinding\": \"JSONRPC\",\n \"protocolVersion\": \"0.3\"\n },\n {\n \"url\": \"http://gemini-passthrough-agent.test:8080\",\n \"protocolBinding\": \"JSONRPC\",\n \"protocolVersion\": \"1.0\"\n }\n ],\n \"url\": \"http://gemini-passthrough-agent.test:8080\",\n \"protocolVersion\": \"0.3\",\n \"preferredTransport\": \"JSONRPC\"\n}", | ||
| "config.json": "{\"model\":{\"type\":\"gemini\",\"model\":\"gemini-2.0-flash\",\"api_key_passthrough\":true},\"description\":\"\",\"instruction\":\"You are a helpful assistant.\",\"stream\":false}" | ||
| } | ||
| }, | ||
| { | ||
| "apiVersion": "v1", | ||
| "kind": "ServiceAccount", | ||
| "metadata": { | ||
| "labels": { | ||
| "app": "kagent", | ||
| "app.kubernetes.io/managed-by": "kagent", | ||
| "app.kubernetes.io/name": "gemini-passthrough-agent", | ||
| "app.kubernetes.io/part-of": "kagent", | ||
| "kagent": "gemini-passthrough-agent" | ||
| }, | ||
| "name": "gemini-passthrough-agent", | ||
| "namespace": "test", | ||
| "ownerReferences": [ | ||
| { | ||
| "apiVersion": "kagent.dev/v1alpha2", | ||
| "blockOwnerDeletion": true, | ||
| "controller": true, | ||
| "kind": "Agent", | ||
| "name": "gemini-passthrough-agent", | ||
| "uid": "" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "apiVersion": "apps/v1", | ||
| "kind": "Deployment", | ||
| "metadata": { | ||
| "labels": { | ||
| "app": "kagent", | ||
| "app.kubernetes.io/managed-by": "kagent", | ||
| "app.kubernetes.io/name": "gemini-passthrough-agent", | ||
| "app.kubernetes.io/part-of": "kagent", | ||
| "kagent": "gemini-passthrough-agent" | ||
| }, | ||
| "name": "gemini-passthrough-agent", | ||
| "namespace": "test", | ||
| "ownerReferences": [ | ||
| { | ||
| "apiVersion": "kagent.dev/v1alpha2", | ||
| "blockOwnerDeletion": true, | ||
| "controller": true, | ||
| "kind": "Agent", | ||
| "name": "gemini-passthrough-agent", | ||
| "uid": "" | ||
| } | ||
| ] | ||
| }, | ||
| "spec": { | ||
| "selector": { | ||
| "matchLabels": { | ||
| "app": "kagent", | ||
| "kagent": "gemini-passthrough-agent" | ||
| } | ||
| }, | ||
| "strategy": { | ||
| "rollingUpdate": { | ||
| "maxSurge": 1, | ||
| "maxUnavailable": 0 | ||
| }, | ||
| "type": "RollingUpdate" | ||
| }, | ||
| "template": { | ||
| "metadata": { | ||
| "annotations": { | ||
| "kagent.dev/config-hash": "4255145495309256999" | ||
| }, | ||
| "labels": { | ||
| "app": "kagent", | ||
| "app.kubernetes.io/managed-by": "kagent", | ||
| "app.kubernetes.io/name": "gemini-passthrough-agent", | ||
| "app.kubernetes.io/part-of": "kagent", | ||
| "kagent": "gemini-passthrough-agent" | ||
| } | ||
| }, | ||
| "spec": { | ||
| "containers": [ | ||
| { | ||
| "args": [ | ||
| "--host", | ||
| "0.0.0.0", | ||
| "--port", | ||
| "8080", | ||
| "--filepath", | ||
| "/config" | ||
| ], | ||
| "env": [ | ||
| { | ||
| "name": "KAGENT_NAMESPACE", | ||
| "valueFrom": { | ||
| "fieldRef": { | ||
| "fieldPath": "metadata.namespace" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "KAGENT_NAME", | ||
| "value": "gemini-passthrough-agent" | ||
| }, | ||
| { | ||
| "name": "KAGENT_URL", | ||
| "value": "http://kagent-controller.kagent:8083" | ||
| } | ||
| ], | ||
| "image": "cr.kagent.dev/kagent-dev/kagent/app@sha256:test-app", | ||
| "imagePullPolicy": "IfNotPresent", | ||
| "name": "kagent", | ||
| "ports": [ | ||
| { | ||
| "containerPort": 8080, | ||
| "name": "http" | ||
| } | ||
| ], | ||
| "readinessProbe": { | ||
| "httpGet": { | ||
| "path": "/.well-known/agent-card.json", | ||
| "port": "http" | ||
| }, | ||
| "initialDelaySeconds": 15, | ||
| "periodSeconds": 15, | ||
| "timeoutSeconds": 15 | ||
| }, | ||
| "resources": { | ||
| "limits": { | ||
| "cpu": "2", | ||
| "memory": "1Gi" | ||
| }, | ||
| "requests": { | ||
| "cpu": "100m", | ||
| "memory": "384Mi" | ||
| } | ||
| }, | ||
| "volumeMounts": [ | ||
| { | ||
| "mountPath": "/config", | ||
| "name": "config" | ||
| }, | ||
| { | ||
| "mountPath": "/var/run/secrets/tokens", | ||
| "name": "kagent-token" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "serviceAccountName": "gemini-passthrough-agent", | ||
| "volumes": [ | ||
| { | ||
| "name": "config", | ||
| "secret": { | ||
| "secretName": "gemini-passthrough-agent" | ||
| } | ||
| }, | ||
| { | ||
| "name": "kagent-token", | ||
| "projected": { | ||
| "sources": [ | ||
| { | ||
| "serviceAccountToken": { | ||
| "audience": "kagent", | ||
| "expirationSeconds": 3600, | ||
| "path": "kagent-token" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "status": {} | ||
| }, | ||
| { | ||
| "apiVersion": "v1", | ||
| "kind": "Service", | ||
| "metadata": { | ||
| "labels": { | ||
| "app": "kagent", | ||
| "app.kubernetes.io/managed-by": "kagent", | ||
| "app.kubernetes.io/name": "gemini-passthrough-agent", | ||
| "app.kubernetes.io/part-of": "kagent", | ||
| "kagent": "gemini-passthrough-agent" | ||
| }, | ||
| "name": "gemini-passthrough-agent", | ||
| "namespace": "test", | ||
| "ownerReferences": [ | ||
| { | ||
| "apiVersion": "kagent.dev/v1alpha2", | ||
| "blockOwnerDeletion": true, | ||
| "controller": true, | ||
| "kind": "Agent", | ||
| "name": "gemini-passthrough-agent", | ||
| "uid": "" | ||
| } | ||
| ] | ||
| }, | ||
| "spec": { | ||
| "ports": [ | ||
| { | ||
| "name": "http", | ||
| "port": 8080, | ||
| "targetPort": 8080 | ||
| } | ||
| ], | ||
| "selector": { | ||
| "app": "kagent", | ||
| "kagent": "gemini-passthrough-agent" | ||
| }, | ||
| "type": "ClusterIP" | ||
| }, | ||
| "status": { | ||
| "loadBalancer": {} | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.