Skip to content

MasaoBlue/learn-chatgpt-api

 
 

Repository files navigation

TypeScriptではじめるChatGPT API

UZABASE Tech Blog 「TypeScriptではじめるChatGPT API」のサンプルコードです。

実行にはNode.js 18以降が必要です。

インストール

git clone https://github.com/newspicks/learn-chatgpt-api.git
cd learn-chatgpt-api
npm install
npm run build
npm install -g .
# アンインストール
npm uninstall -g learn-chatgpt-api

使い方

# 以下の情報は .env ファイルに記述することもできます(その場合文頭のexportは削除)
export OPENAI_ORGANIZATION=<your-organization>
export OPENAI_API_KEY=<your-api-key>

# npm install -g して使う場合
chatgpt --help

# インストールしないで使う場合
npx ts-node src/index.ts --help

# VSCodeの場合、任意の箇所でブレークポイントを貼ってデバッグを開始することができます
Usage: chatgpt [options] [command]

Learn ChatGPT API By Example

Options:
  -h, --help                              display help for command

Commands:
  simple-chat [options]                   simple chat with ChatGPT
  summary-and-comment [options] <url>     summarize a web page
  classify [options] <tag> <url>          classify a web page
  summary-long-text [options] <file>      summarize a long text file
  qa-with-search [options] <question>     question answering with web search
  create-embedding <infile> <outfile>     create embeddings for a text file
  qa-with-embedding [options] <question>  question answering with embeddings
  help [command]                          display help for command

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 85.7%
  • JavaScript 14.3%