Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(aio): document vertex ai and default trace ids for gemini (#120612)

jake sciotto09c63a6ba136
diff --git a/docs/onboarding/ai-observability/google.tsx b/docs/onboarding/ai-observability/google.tsx
index ef07209d2b5a..e981af063a25 100644
--- a/docs/onboarding/ai-observability/google.tsx
+++ b/docs/onboarding/ai-observability/google.tsx
@@ -93,6 +93,42 @@ export const getGoogleSteps = (ctx: OnboardingComponentsContext): StepDefinition
},
]}
/>
+
+ <Markdown>
+ {dedent`
+ To call Gemini through Vertex AI, pass your Google Cloud project and location instead of an
+ API key. The Google Gen AI client then authenticates with your Google Cloud credentials.
+ `}
+ </Markdown>
+
+ <CodeBlock
+ blocks={[
+ {
+ language: 'python',
+ file: 'Python',
+ code: dedent`
+ client = Client(
+ vertexai=True,
+ project="your_gcp_project_id",
+ location="us-central1",
+ posthog_client=posthog,
+ )
+ `,
+ },
+ {
+ language: 'typescript',
+ file: 'Node',
+ code: dedent`
+ const client = new GoogleGenAI({
+ vertexai: true,
+ project: 'your_gcp_project_id',
+ location: 'us-central1',
+ posthog,
+ })
+ `,
+ },
+ ]}
+ />
</>
),
},
@@ -160,6 +196,15 @@ export const getGoogleSteps = (ctx: OnboardingComponentsContext): StepDefinition
]}
/>
+ <Markdown>
+ {dedent`
+ Calls that share a \`posthog_trace_id\` (\`posthogTraceId\` in Node) appear as one trace.
+ If you omit it, the wrapper creates a new trace ID for each call, so each call appears as
+ its own trace. To see a multi-step task as one trace, create one trace ID for the task and
+ pass it to every call in that task.
+ `}
+ </Markdown>
+
<Blockquote>
<Markdown>
**Note:** If you want to capture LLM events anonymously, omit `posthog_distinct_id` from the