projectrules.ai

Vercel AI SDK

AISDKError HandlingStreamingVercel

Description

Vercel AI SDK Implementation

Globs

route.ts
---
description: Vercel AI SDK Implementation
globs: route.ts
---

# Vercel AI SDK
- Always check the latest Vercel AI SDK documentation to avoid decrepatated code and syntax
- Use the Vercel AI SDK UI for implementing streaming chat UI.
- Use the Vercel AI SDK Core to interact with language models.
- Use the Vercel AI SDK RSC and Stream Helpers to stream and help with the generations.
- Implement proper error handling for AI responses and model switching.
- Implement fallback mechanisms for when an AI model is unavailable.
- Handle rate limiting and quota exceeded scenarios gracefully.
- Provide clear error messages to users when AI interactions fail.
- Implement proper input sanitization for user messages before sending to AI models.
- Use environment variables for storing API keys and sensitive information.