mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
* refactor(examples): migrate gemini example to opentelemetry Switch example-ai-gemini from the @posthog/ai wrapper SDK to the OpenTelemetry + Traceloop GenAIInstrumentation pattern, matching the structure of example-ai-openai. Adds an image generation script. * fix(examples): unblock @posthog/ai for gemini example Exclude @posthog/ai from pnpm's minimumReleaseAge so the example picks up 7.15.0+, which re-introduced PostHogSpanProcessor. Without this the install resolves to 7.12.1 and the OTel setup fails with a missing-export error. * fix(examples): exclude @posthog/ai from minimumReleaseAge everywhere Apply the same pnpm policy carve-out used for example-ai-gemini to every other example that depends on @posthog/ai, so fresh installs always pick up the latest published version instead of the 7-day-old one. * chore(examples): regenerate lockfiles with latest @posthog/ai Run pnpm update @posthog/ai --latest across all examples now that the minimumReleaseAge exclude lets them pick up 7.16.0 instead of 7.12.1, which is required for PostHogSpanProcessor to exist at runtime. pnpm also pins the specifier to ^7.16.0 and sorts dependencies alphabetically. * Revert "chore(examples): regenerate lockfiles with latest @posthog/ai" This reverts commit 42932a8082e8fcf4a45f24dcaf51932af404c8ae. * Revert "fix(examples): exclude @posthog/ai from minimumReleaseAge everywhere" This reverts commit 6c679d0d7b2cafad8c1f035a16771a17ba2df7f4.
427 B
427 B
Google Gemini + PostHog AI Examples
Track Google Gemini API calls with PostHog via OpenTelemetry.
Setup
pnpm install
cp .env.example .env
# Fill in your API keys in .env
Examples
- chat.ts - Chat with tool calling
- streaming.ts - Chat with streaming
- image-generation.ts - Image generation
Run
source .env
npx tsx chat.ts
npx tsx streaming.ts
npx tsx image-generation.ts