0.1.17 • Published 5 months ago

@gensx/vercel-ai-sdk v0.1.17

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 months ago

@gensx/vercel-ai-sdk

Vercel AI SDK for GenSX

Installation

npm install @gensx/vercel-ai-sdk

Requires gensx

This package requires gensx to be installed as a peer dependency.

npm install gensx

Usage

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

5 months ago

0.1.16

6 months ago

0.1.15

6 months ago

0.1.14

6 months ago

0.1.13

6 months ago

0.1.12

6 months ago

0.1.11

7 months ago

0.1.10

7 months ago

0.1.9

7 months ago

0.1.8

7 months ago

0.1.7

7 months ago

0.1.6

7 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

8 months ago

0.1.0

8 months ago