npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yh-ui/ai-sdk

v1.0.30

Published

YH-UI AI SDK integration for Vercel AI SDK and LangChain

Readme

@yh-ui/ai-sdk

YH-UI 的 AI 交互工具包,负责把模型请求、流式输出、会话状态、工具调用和 Provider 适配整理成 Vue 项目更容易消费的 API。它可以和 @yh-ui/components 的 AI 组件直接配合,也可以独立用于自研界面。

AI Components | Releases

Highlights

  • Vue 响应式会话:useAIChatuseAIStreamuseConversationuseConversations 管理消息、输入、加载、停止、错误和历史。
  • 流式请求:XRequestcreateXRequestcreateStreamableValue 支持增量内容消费,适合 AI 打字机、代码生成和长文本输出。
  • Provider 适配:内置 OpenAI、Anthropic、Google、DeepSeek、Ollama、Azure、Moonshot、MiniMax、Zhipu、SiliconFlow、Together、Novita 等 provider preset。
  • 工具调用:createYHFunctionTool 统一描述工具名称、参数和执行函数,方便把 Function Calling 结果映射回业务动作。
  • 中间件和缓存:支持请求中间件、内存缓存、localStorage/sessionStorage 缓存,便于做审计、重试和复用。
  • Agent 扩展:包含 chain、parallel chain、Reflexion、ReWOO、Plan-Execute 等实验型 agent 组织能力。

Install

pnpm add @yh-ui/ai-sdk

When building a ready-made AI UI, also install the component package:

pnpm add @yh-ui/components

Chat Hook

<script setup lang="ts">
import { YhAiBubble, YhAiSender } from '@yh-ui/components'
import { useAIChat } from '@yh-ui/ai-sdk/vue'

const { messages, input, isLoading, sendMessage, stop } = useAIChat({
  api: '/api/chat',
  onError: (error) => console.error(error)
})
</script>

<template>
  <YhAiBubble
    v-for="message in messages"
    :key="message.id"
    :role="message.role"
    :content="message.content"
    streaming
  />
  <YhAiSender v-model="input" :loading="isLoading" @send="sendMessage" @cancel="stop" />
</template>

Provider Adapter

import { createProviderAdapter, getProviderPreset } from '@yh-ui/ai-sdk/vue'

const preset = getProviderPreset('deepseek')

const provider = createProviderAdapter({
  ...preset,
  apiKey: process.env.DEEPSEEK_API_KEY,
  defaultModel: 'deepseek-chat'
})

Function Tool

import { createYHFunctionTool } from '@yh-ui/ai-sdk/vue'

const weatherTool = createYHFunctionTool({
  name: 'get_weather',
  description: 'Get weather by city',
  parameters: {
    type: 'object',
    properties: {
      city: { type: 'string' }
    },
    required: ['city']
  },
  execute: async ({ city }) => fetch(`/api/weather?city=${city}`).then((res) => res.json())
})

Notes

Do not expose model API keys in browser code. Keep provider credentials in a server route and stream the result to the client.

License

MIT