cm-igarashi-ryosuke / zenn-chat-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

このリポジトリはAI Chat GPT-3 exampleテンプレートを元に作成しています。

詳細はこちらの記事を参照してください。

ローカルで実行する場合、元の手順に加え、以下が必要です。

  • PineconeのAPIキーと環境名を.envに追加します。
  • Pineconeになにかしらのデータを登録します。

Pineconeのmetadataのフォーマットは以下のとおりです。

{
    'title': 'ページのタイトル',
    'url': 'ページのURL',
    'sentence': 'ベクトル化する前のテキスト',
}
  • .npmrcに以下を記述します。( pinecone-ts-client の #44 の問題を回避するため、パッケージをforkしています。)
//npm.pkg.github.com/:_authToken=ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX(personal access token)
@cm-igarashi-ryosuke:registry=https://npm.pkg.github.com

===

AI Chat GPT-3 example

This example shows how to implement a simple chat bot using Next.js, API Routes, and OpenAI ChatGPT API.

Components

  • Next.js
  • OpenAI API (ChatGPT) - streaming
  • API Routes (Edge runtime) - streaming

How to Use

You can choose from one of the following two methods to use this repository:

One-Click Deploy

Deploy the example using Vercel:

Deploy with Vercel

Clone and Deploy

Execute create-next-app with pnpm to bootstrap the example:

pnpm create next-app --example https://github.com/vercel/examples/tree/main/solutions/ai-chatgpt

Set up environment variables

Rename .env.example to .env.local:

cp .env.example .env.local

then, update OPENAI_API_KEY with your OpenAI secret key.

Next, run Next.js in development mode:

pnpm dev

The app should be up and running at http://localhost:3000.

Deploy it to the cloud with Vercel (Documentation).

About


Languages

Language:TypeScript 97.8%Language:JavaScript 2.2%