Express + AI SDK

R
Renaudil y a 2 jours
0

Description

Using AI SDK in an Express app.

npx boilerapp express-ai-sdk

文档

Express.js + AI SDK Example

You can use the AI SDK in an Express.js server to generate and stream text and objects.

Usage

  1. Create .env file with the following content (and more settings, depending on the providers you want to use):
OPENAI_API_KEY=\"YOUR_OPENAI_API_KEY\"
  1. Run the following commands from the root directory of the AI SDK repo:
pnpm install
pnpm build
  1. Run the following command:
pnpm dev
  1. Test the endpoint with Curl:
curl -X POST http://localhost:8080
curl -X POST http://localhost:8080/custom-data-parts
curl -i http://localhost:8080/chat \\
 -H \"Content-Type: application/json\" \\
 --data '{ \"messages\":[{\"role\":\"user\\

Prix

Gratuit

FREE

评论 (0)

常见问题

常见问题解答 (FAQ)

有问题?我们有答案。如果您找不到想要的答案,请随时联络我们。

Boilerapp 是一个专门用于分享 Boilerplates、入门套件(Starter Kits)和项目模版的开发者社区平台。我们的目标很简单:为您节省初始配置(Setup)的时间,让您可以专注于真正重要的代码。无论您是在寻找简单的代码库还是完整的 SaaS 项目,都能在这里找到。

还有其他问题?

我们的团队随时为您提供帮助。联络我们,我们将尽快回复。