Files
Richard SolomouandGitHub 52a3005fdf docs: add AI provider integration examples (#3263)
* feat: Add AI provider integration examples

Add self-contained examples for each AI provider supported by @posthog/ai:
- OpenAI (Chat Completions, Responses, streaming, embeddings, transcription, image generation)
- Anthropic (chat, streaming)
- Google Gemini (chat, streaming, image generation)
- Vercel AI SDK (generateText, streamText, generateObject, streamObject, Anthropic, Google backends)
- LangChain (callback handler)
- Mastra (manual instrumentation workflow)
- OpenTelemetry (PostHogTraceExporter)

Each example directory follows the existing example-* convention with its
own package.json, pnpm-workspace.yaml, tsconfig.json, and README. Files
are designed to be copy-pasted by users as starting points.

* fix: use subpath imports for @posthog/ai

Use provider-specific subpath imports (e.g. @posthog/ai/openai instead
of @posthog/ai) to avoid pulling in the OTEL dependency which fails at
import time when @opentelemetry/exporter-trace-otlp-http is not installed.

* fix: fix image gen, transcription, mastra, and vercel middleware

- Use images.generate API instead of responses API for image generation
- Gracefully skip transcription when audio file is missing
- Update Mastra to v1 with correct model ID and execute signature
- Fix vercel middleware crash when result.content is undefined

* revert: remove vercel middleware fix from examples branch

Moving this fix to a separate PR.

* Add comment about incomplete tool-calling loop in examples
2026-03-20 14:22:45 +02:00

11 lines
187 B
JSON

{
"compilerOptions": {
"target": "ES2022",
"module": "node16",
"moduleResolution": "node16",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}