0.1.17 • Published 6 months ago
@gensx/vercel-ai-sdk v0.1.17
@gensx/vercel-ai-sdk
Vercel AI SDK for GenSX
Installation
npm install @gensx/vercel-ai-sdkRequires gensx
This package requires gensx to be installed as a peer dependency.
npm install gensxUsage
import * as gensx from "@gensx/core";
import { GenerateText, StreamText } from "@gensx/vercel-ai-sdk";
const ChatBot = gensx.Component(async ({ userInput }) => {
return (
<GenerateText
messages={[
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: userInput },
]}
model="gpt-4o"
temperature={0.7}
/>
);
});
// Use with streaming
const StreamingChat = gensx.Component(async ({ userInput }) => {
return (
<StreamText
messages={[
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: userInput },
]}
stream={true}
>
{async (stream) => {
for await (const token of stream) {
process.stdout.write(token);
}
}}
</StreamText>
);
});0.1.17
6 months ago
0.1.16
6 months ago
0.1.15
6 months ago
0.1.14
7 months ago
0.1.13
7 months ago
0.1.12
7 months ago
0.1.11
8 months ago
0.1.10
8 months ago
0.1.9
8 months ago
0.1.8
8 months ago
0.1.7
8 months ago
0.1.6
8 months ago
0.1.5
8 months ago
0.1.4
8 months ago
0.1.3
8 months ago
0.1.2
8 months ago
0.1.1
9 months ago
0.1.0
9 months ago