Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
ai-hjki2n3iu
Advanced tools
The Vercel AI SDK is **a library for building AI-powered streaming text and chat UIs**.
The Vercel AI SDK is a library for building AI-powered streaming text and chat UIs.
pnpm install ai
View the full documentation and examples on sdk.vercel.ai/docs
With the Vercel AI SDK, you can build a ChatGPT-like app in just a few lines of code:
// ./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);
}
// ./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.
This library is created by Vercel and Next.js team members, with contributions from:
FAQs
The Vercel AI SDK is **a library for building AI-powered streaming text and chat UIs**.
The npm package ai-hjki2n3iu receives a total of 2 weekly downloads. As such, ai-hjki2n3iu popularity was classified as not popular.
We found that ai-hjki2n3iu demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.