Skip to content

AI SDK

@yh-ui/ai-sdk is the official AI capability integration package from YH-UI, seamlessly integrating Vercel AI SDK and LangChain for out-of-the-box usage.

Features

  • 🌐 Multi-Provider Support - OpenAI / Anthropic / Google / DeepSeek / Tongyi / Wenxin Yiyan, etc.
  • 🔄 Streaming Output - Complete streaming text/object generation support
  • 🛠️ Function Calling - Easily define and execute tool functions
  • 🔗 LangChain Integration - Deep integration with LangChain.js ecosystem
  • 🖥️ Native Vue 3 - Full Composition API support
  • 💾 Conversation Management - Built-in history persistence
  • 🤖 Agent Orchestration - ReAct / ReWOO / Reflexion modes
  • 📦 Vector Storage - In-memory + Pinecone/Weaviate/Qdrant interfaces
  • 💨 Caching System - Memory / localStorage / sessionStorage / Redis
  • 🚀 Rate Limiting - Token bucket / sliding window rate limiter
  • 📊 Observability - OTel / LangSmith export
  • 🔌 MCP Protocol - Complete Client + Server support
  • 🎯 SSR Support - Server-side rendering compatible

Comparison with Mainstream SDKs

FeatureVercel AI SDKLangChainYH AI-SDK
Streaming
Multi-Provider40+100+10+ (presets) + custom
Agent FrameworkToolLoopAgentLangGraph✅ ReAct/ReWOO/Reflexion
MCP Support✅ Complete
RAGBasicComplete✅ Production-ready
Vector Storage✅ Abstraction + memory
Caching✅ Multi-level
Rate Limiting✅ Complete
ObservabilityBasic✅ OTel + LangSmith
Vue/SSR✅ Deep support

YH AI-SDK Differentiated Advantages

  • 🔥 Deep Vue Integration - Unique Vue Composable + SSR support
  • 🔥 Multi-level Caching - Memory + localStorage + sessionStorage + Redis interface
  • 🔥 Rate Limiting Middleware - Seamless integration with XRequest
  • 🔥 Cost Tracking - Budget control + usage statistics
  • 🔥 Safety Guardrails - Content filtering + input validation + output filtering

Documentation

ChapterDescription
InstallationRequirements, installation, quick setup
Quick StartMinimal examples and complete demos
Vercel AI SDKgenerateText, streamText, useChat
LangChain IntegrationuseLangChainChat, useLangChainStream
ToolscreateYHFunctionTool
Vue ComposablesuseConversation, createStreamableValue
MCP ProtocolMCP Client & Server
Agent OrchestrationReAct, Reflexion, ReWOO, createChain
Vector Storage & RAGcreateInMemoryVectorStore, createProductionRAG
CachingMulti-level cache adapters
Rate LimitingcreateRateLimiter
ObservabilityOTel, LangSmith
Future FeaturesMultimodal, CoT, cost control, safety
API ReferenceTypes and interfaces
Notes & FAQCommon issues and considerations

Released under the MIT License.