Repository navigation
Clean up contrib/python; move llm-auditor to contrib; add retail plugin README #2756
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
Merged
happyhuman
merged 8 commits into
google:main
from
pierpaolo28:remove-undeployable-and-move-llm-auditor
Oct 2, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d02aae1
Remove 4 non-deployable python recipes; move llm-auditor to contrib
pierpaolo28 d41f0c9
Add plugins/retail/README.md
pierpaolo28 2da3e8e
Drop redundant path from retail-virtual-tryon README header
pierpaolo28 0d0d0c2
Make contrib/kotlin/llm-auditor deployable
pierpaolo28 bddc1eb
Populate llm-auditor .env.example so the agent can initialize
pierpaolo28 c600895
llm-auditor: lazy model init so container boots without creds
pierpaolo28 7bd512b
llm-auditor: align Gradle build with contrib/kotlin/financial-advisor
pierpaolo28 893e5a8
Merge branch 'main' into remove-undeployable-and-move-llm-auditor
happyhuman 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Copy this file to .env and fill it in. Real environment variables take | ||
| # precedence over .env. | ||
|
|
||
| # Gemini via Vertex AI. Set GOOGLE_GENAI_USE_VERTEXAI=False and GOOGLE_API_KEY | ||
| # instead to use the Gemini API. | ||
| GOOGLE_GENAI_USE_VERTEXAI=True | ||
| GOOGLE_CLOUD_PROJECT=<TODO: update-this-value> | ||
| GOOGLE_CLOUD_LOCATION=global | ||
| GOOGLE_API_KEY=<TODO: update-this-value> | ||
|
|
||
| MODEL_NAME=gemini-flash-latest | ||
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
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,50 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Build: compile the agent and collect its runtime dependencies. | ||
| FROM gradle:9.5.1-jdk17 AS build | ||
|
|
||
| WORKDIR /build | ||
|
|
||
| COPY settings.gradle.kts build.gradle.kts ./ | ||
| COPY src ./src | ||
| RUN gradle installDist --no-daemon --quiet | ||
|
|
||
| # Run: JRE only, no Gradle. | ||
| FROM eclipse-temurin:17-jre | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY --from=build /build/build/install/llm-auditor/lib ./lib | ||
|
|
||
| # Operators supply .env or environment variables at deploy time. The agent reads | ||
| # them lazily via Models.fromEnvironment(), so the server starts without creds | ||
| # and surfaces missing config on the first request instead of at boot. | ||
|
|
||
| RUN useradd --create-home --uid 10001 appuser && \ | ||
| chown -R appuser:appuser /app | ||
|
|
||
| USER appuser | ||
|
|
||
| # WebMain binds HOST:PORT. 0.0.0.0 makes the dev server reachable from | ||
| # outside the container; it defaults to 127.0.0.1 otherwise. | ||
| ENV HOST=0.0.0.0 | ||
| ENV PORT=8080 | ||
| # MODEL_NAME is required at startup. Not a credential — just the recipe's | ||
| # default model identifier (matches .env.example). Operators override with | ||
| # `-e MODEL_NAME=...` at deploy time. | ||
| ENV MODEL_NAME=gemini-flash-latest | ||
| EXPOSE 8080 | ||
|
|
||
| CMD ["java", "-cp", "lib/*", "com.google.adk.samples.agents.llmauditor.WebMainKt"] |
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
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,52 @@ | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
|
||
| plugins { | ||
| kotlin("jvm") version "2.3.20" | ||
| application | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| // Both adk-kotlin artifacts must resolve to the same version, so they are | ||
| // pinned together. | ||
| val adkVersion = "1.2.0" | ||
|
|
||
| dependencies { | ||
| implementation("com.google.adk:google-adk-kotlin-core:$adkVersion") | ||
| implementation("com.google.adk:google-adk-kotlin-webserver:$adkVersion") | ||
|
|
||
| testImplementation(kotlin("test")) | ||
| } | ||
|
|
||
| // Target Java 17 bytecode without pinning a toolchain, so the build runs on | ||
| // any JDK 17 or later. | ||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 | ||
| } | ||
|
|
||
| kotlin { | ||
| compilerOptions { | ||
| jvmTarget.set(JvmTarget.JVM_17) | ||
| } | ||
| } | ||
|
|
||
| application { | ||
| mainClass.set( | ||
| project.findProperty("mainClass") as? String | ||
| ?: "com.google.adk.samples.agents.llmauditor.MainKt", | ||
| ) | ||
| } | ||
|
|
||
| tasks.test { | ||
| useJUnitPlatform() | ||
| // The test never calls the model; it only needs MODEL_NAME to build the | ||
| // agent graph. | ||
| environment("MODEL_NAME", "gemini-flash-latest") | ||
|
Check notice on line 47 in contrib/kotlin/llm-auditor/build.gradle.kts
|
||
| } | ||
|
|
||
| tasks.named<JavaExec>("run") { | ||
| standardInput = System.`in` | ||
| } | ||
File renamed without changes
1 change: 1 addition & 0 deletions
1
core/kotlin/llm-auditor/manifest.yaml → contrib/kotlin/llm-auditor/manifest.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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
81 changes: 81 additions & 0 deletions
81
...rib/kotlin/llm-auditor/src/main/kotlin/com/google/adk/samples/agents/llmauditor/Models.kt
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,81 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.google.adk.samples.agents.llmauditor | ||
|
|
||
| import com.google.adk.kt.models.Gemini | ||
| import com.google.adk.kt.models.LlmRequest | ||
| import com.google.adk.kt.models.LlmResponse | ||
| import com.google.adk.kt.models.Model | ||
| import com.google.adk.kt.models.VertexCredentials | ||
| import kotlinx.coroutines.flow.Flow | ||
| import java.io.File | ||
|
|
||
| /** Resolves the Gemini model shared by every agent from the environment or `.env`. */ | ||
| internal object Models { | ||
| /** | ||
| * Returns the model named by `MODEL_NAME`. Its client is created on first use: creating a | ||
| * Vertex AI client looks up credentials, so doing it while the agent loads would fail the whole | ||
| * server when credentials are missing, instead of the first request. | ||
| */ | ||
| fun fromEnvironment(): Model { | ||
| val name = | ||
| env("MODEL_NAME") | ||
| ?: error("MODEL_NAME is not set. Copy .env.example to .env and fill it in, or export MODEL_NAME.") | ||
| return LazyModel(name) { | ||
| if (env("GOOGLE_GENAI_USE_VERTEXAI").toBoolean()) { | ||
| val project = | ||
| env("GOOGLE_CLOUD_PROJECT") | ||
| ?: error("GOOGLE_CLOUD_PROJECT is not set. Set it in .env or the environment to use Vertex AI.") | ||
| // A null location lets the SDK use its default, "global". | ||
| Gemini(name, VertexCredentials(project, env("GOOGLE_CLOUD_LOCATION"))) | ||
| } else { | ||
| Gemini(name, env("GOOGLE_API_KEY")) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Reads .env from the working directory. Real environment variables take | ||
| // precedence, and a missing .env is fine (e.g. on Cloud Run). | ||
| private val dotenv: Map<String, String> by lazy { | ||
| val file = File(".env") | ||
| if (!file.isFile) return@lazy emptyMap() | ||
| file | ||
| .readLines() | ||
| .map { it.substringBefore(" #").trim() } | ||
| .filter { it.isNotEmpty() && !it.startsWith("#") && "=" in it } | ||
| .associate { it.substringBefore("=").trim() to it.substringAfter("=").trim() } | ||
| } | ||
|
|
||
| /** | ||
| * Returns a variable from the environment or `.env`, or null if it is unset, blank, or still an | ||
| * unfilled `.env.example` placeholder. | ||
| */ | ||
| private fun env(key: String): String? = | ||
| (System.getenv(key) ?: dotenv[key])?.trim()?.takeUnless { it.isEmpty() || it.startsWith("<TODO") } | ||
|
|
||
| private class LazyModel( | ||
| override val name: String, | ||
| create: () -> Model, | ||
| ) : Model { | ||
| private val delegate by lazy(create) | ||
|
|
||
| override fun generateContent( | ||
| request: LlmRequest, | ||
| stream: Boolean, | ||
| ): Flow<LlmResponse> = delegate.generateContent(request, stream) | ||
| } | ||
| } |
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
File renamed without changes.
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[MAJOR] Perhaps we should use the default
gemini-3.7-flashinstead ofgemini-flash-latesthere and in two other places, as recommended inAGENTS.md:40?