Skip to content

feat(gemini): add WithLabels option for request-level metadata#769

Open
jredl-va wants to merge 1 commit intocloudwego:mainfrom
jredl-va:feat/gemini-labels-support
Open

feat(gemini): add WithLabels option for request-level metadata#769
jredl-va wants to merge 1 commit intocloudwego:mainfrom
jredl-va:feat/gemini-labels-support

Conversation

@jredl-va
Copy link
Copy Markdown

@jredl-va jredl-va commented Apr 9, 2026

What type of PR is this?

feat: A new feature

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
The underlying google.golang.org/genai SDK supports a Labels map[string]string field on GenerateContentConfig for billing attribution, request tracking, and filtering in Cloud Logging and Monitoring. This field was not exposed through the eino-ext Gemini ChatModel wrapper.

This PR adds:

  1. A Labels field to the per-request options struct
  2. A WithLabels(labels map[string]string) option constructor
  3. Wiring in genInputAndConf() to pass labels through to the GenerateContentConfig

This allows callers to tag Vertex AI requests with custom metadata (e.g. service name, tenant ID, agent type) for cost attribution and observability without modifying the SDK internals.

(Optional) Which issue(s) this PR fixes:

N/A

The underlying genai SDK supports a Labels field on GenerateContentConfig
for billing attribution, request tracking, and Cloud Logging filtering.
This was not exposed through the eino-ext Gemini wrapper.

Add WithLabels() option that passes user-defined key-value labels through
to the Vertex AI API on each GenerateContent request.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant