Skip to content

Conversation

@andrewm4894
Copy link
Member

@andrewm4894 andrewm4894 commented Dec 8, 2025

Summary

Adds support for testing with both Vercel AI SDK 5 (stable) and SDK 6 (beta) when using local @posthog/ai packages.

Changes

  • Add AI_SDK_VERSION env var to .env.example (default: 6)
  • Add make targets for SDK version switching:
    • make run-node-sdk5 - Run with AI SDK 5 (stable)
    • make run-node-sdk6 - Run with AI SDK 6 (beta)
  • Update node/run.sh to:
    • Install appropriate AI SDK packages based on AI_SDK_VERSION
    • Preserve command-line env var override (takes precedence over .env)
    • Deduplicate packages to avoid type conflicts with local packages
    • Remove nested AI SDK packages from @posthog/ai node_modules

Usage

# Use SDK 6 (default)
make run-node

# Use SDK 5
make run-node-sdk5

# Use SDK 6 explicitly
make run-node-sdk6

# Or set env var directly
AI_SDK_VERSION=5 make run-node

Test plan

  • make run-node-sdk5 works with local @posthog/ai
  • make run-node-sdk6 works with local @posthog/ai
  • Weather tool tests pass for both SDK versions

Related

Updates dependencies for AI SDK 6 compatibility:
- ai: ^6.0.0-beta.138
- @ai-sdk/anthropic: ^3.0.0-beta.77
- @ai-sdk/openai: ^3.0.0-beta.88
- @ai-sdk/provider: ^3.0.0-beta.25
- @ai-sdk/provider-utils: ^4.0.0-beta.44

This enables testing with the new @posthog/ai SDK 6 support.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@andrewm4894 andrewm4894 self-assigned this Dec 8, 2025
- Add AI_SDK_VERSION env var to switch between SDK versions
- Add make targets: run-node-sdk5 and run-node-sdk6
- Update run.sh to install appropriate AI SDK packages based on version
- Add deduplication step to avoid type conflicts with local packages
- Command-line AI_SDK_VERSION takes precedence over .env

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@andrewm4894 andrewm4894 changed the title feat(node): Update to Vercel AI SDK 6 beta feat(node): Support both Vercel AI SDK 5 and 6 Dec 11, 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