# phil-custom-ai

> The Vercel AI SDK is **a library for building AI-powered streaming text and chat UIs**.

Latest version **2.2.12** (published 2023-09-07) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install phil-custom-ai
pnpm add phil-custom-ai
yarn add phil-custom-ai
bun add phil-custom-ai
```

## Health

**Score 50/100 (C)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score; popular repo.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.2.12 |
| Published | 2023-09-07 |
| First published | 2023-09-07 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.6 |
| Dependencies | 8 |
| Unpacked size | 241.9 KB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 27933 |
| Maintainers | philentropy |
| Keywords | ai, nextjs, svelte, react, vue |

## Links

- npm: https://www.npmjs.com/package/phil-custom-ai
- Repository: https://github.com/vercel/ai
- Homepage: https://sdk.vercel.ai/docs
- Issues: https://github.com/vercel/ai/issues
- npm.io page: https://npm.io/package/phil-custom-ai

## Dependencies (8)

- [swr](https://npm.io/package/swr.md) 2.2.0
- [sswr](https://npm.io/package/sswr.md) 2.0.0
- [swrv](https://npm.io/package/swrv.md) 1.0.4
- [nanoid](https://npm.io/package/nanoid.md) 3.3.6
- [openai](https://npm.io/package/openai.md) 4.2.0
- [swr-store](https://npm.io/package/swr-store.md) 0.10.6
- [solid-swr-store](https://npm.io/package/solid-swr-store.md) 0.10.7
- [eventsource-parser](https://npm.io/package/eventsource-parser.md) 1.0.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.2.12 (latest) — 2023-09-07
- 2.2.11 — 2023-09-07
- 0.0.1 — 2023-09-07

## README

# Vercel AI SDK

The Vercel AI SDK is **a library for building AI-powered streaming text and chat UIs**.

## Features

- [SWR](https://swr.vercel.app)-powered React, Svelte, Vue and Solid helpers for streaming text responses and building chat and completion UIs
- First-class support for [LangChain](https://js.langchain.com/docs) and [OpenAI](https://openai.com), [Anthropic](https://www.anthropic.com), [Cohere](https://cohere.com), [Hugging Face](https://huggingface.co), [Fireworks](https://app.fireworks.ai) and [Replicate](https://replicate.com)
- Node.js, Serverless, and [Edge Runtime](https://edge-runtime.vercel.app/) support
- Callbacks for saving completed streaming responses to a database (in the same request)

## Installation

```sh
pnpm install ai
```

View the full documentation and examples on [sdk.vercel.ai/docs](https://sdk.vercel.ai/docs)

## Example: An AI Chatbot with Next.js and OpenAI

With the Vercel AI SDK, you can build a ChatGPT-like app in just a few lines of code:

```tsx
// ./app/api/chat/route.js
import OpenAI from 'openai';
import { OpenAIStream, StreamingTextResponse } from 'ai';

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

export const runtime = 'edge';

export async function POST(req) {
  const { messages } = await req.json();
  const response = await openai.chat.completions.create({
    model: 'gpt-4',
    stream: true,
    messages,
  });
  const stream = OpenAIStream(response);
  return new StreamingTextResponse(stream);
}
```

```tsx
// ./app/page.js
'use client';

import { useChat } from 'ai/react';

export default function Chat() {
  const { messages, input, handleInputChange, handleSubmit } = useChat();

  return (
    <div>
      {messages.map(m => (
        <div key={m.id}>
          {m.role}: {m.content}
        </div>
      ))}

      <form onSubmit={handleSubmit}>
        <input
          value={input}
          placeholder="Say something..."
          onChange={handleInputChange}
        />
      </form>
    </div>
  );
}
```

---

View the full documentation and examples on [sdk.vercel.ai/docs](https://sdk.vercel.ai/docs).

## Authors

This library is created by [Vercel](https://vercel.com) and [Next.js](https://nextjs.org) team members, with contributions from:

- Jared Palmer ([@jaredpalmer](https://twitter.com/jaredpalmer)) - [Vercel](https://vercel.com)
- Shu Ding ([@shuding\_](https://twitter.com/shuding_)) - [Vercel](https://vercel.com)
- Max Leiter ([@max_leiter](https://twitter.com/max_leiter)) - [Vercel](https://vercel.com)
- Malte Ubl ([@cramforce](https://twitter.com/cramforce)) - [Vercel](https://vercel.com)
- Justin Ridgewell ([@jridgewell](https://github.com/jridgewell)) - [Vercel](https://vercel.com)

[Contributors](https://github.com/vercel/ai/graphs/contributors)

---
_Source: https://npm.io/package/phil-custom-ai · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
