Skip to content

Conversation

@Tehnix
Copy link
Contributor

@Tehnix Tehnix commented Nov 24, 2025

Problem

I ran into an issue instrumenting the Gemini SDK with PostHog since I'm using Vertex AI and that doesn't support authentication via API Key, but instead via googleAuthOptions.

This config option wasn't exposed, so typescript would fail, but since all options are already passed directly into the Gemini client for initialization, it was really just a type issue and not any other code changes required.

I've extended the config options using the client's GoogleGenAIOptions, which should ensure that changes to the Gemini SDK in the future are immediately exposed and available to consumers using the @posthog/ai wrapper.

Relevant thread in the PostHog docs https://posthog.com/questions/vertex-ai-support

NOTE: #2497 got closed prematurely, so this PR replaces the other one, since I cannot reopen the original one.

Changes

Extended the Gemini wrappers MonitoringGeminiConfig config with GoogleGenAIOptions which ensures all client configuration is available, and unblocks Vertex AI usage.

Release info Sub-libraries affected

Libraries affected

  • All of them
  • posthog-js (web)
  • posthog-js-lite (web lite)
  • posthog-node
  • posthog-react-native
  • @posthog/react
  • @posthog/ai
  • @posthog/nextjs-config

Checklist

  • Tests for new code
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
  • Took care not to unnecessarily increase the bundle size

If releasing new changes

  • Ran pnpm changeset to generate a changeset file
  • Added the "release" label to the PR to indicate we're publishing new versions for the affected packages

@Tehnix
Copy link
Contributor Author

Tehnix commented Nov 24, 2025

@PostHog/team-llm-analytics just looping you in here as well. This one is quite minor diff, but let me know if you have any questions. It's unblocked me from using Gemini with Vertex AI locally, and I've been running with it in production with LLM traces for a couple of weeks now :)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@posthog-bot
Copy link
Collaborator

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@Tehnix
Copy link
Contributor Author

Tehnix commented Dec 5, 2025

@posthog-bot yup, please don't close this!

@posthog-bot posthog-bot removed the stale label Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants