Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
/ gpt3-ts Public archive

A framework to build OpenAPI apps using nodejs & deno

Notifications You must be signed in to change notification settings

HikaruEgashira/gpt3-ts

Repository files navigation

gpt

OpenAI API made easy !! now deno support !

https://beta.openai.com/docs

install

yarn add @hikae/gpt

example

import { App, openai } from "@hikae/gpt";

require("dotenv").config();

async function main() {
    const key = process.env.OPENAI_API_KEY;
    if (!key) {
        throw new Error("[OPENAI_API_KEY] not found");
    }

    const app: App = openai.app(key);
    const result = await openai.classification({
        examples: [
            ["幸せ", "Positive"],
            ["私は悲しい、、", "Negative"],
            ["最高の気分だ!", "Positive"],
        ],
        labels: ["Positive", "Negative", "Neutral"],
        query: "今日は晴れの日だ",
        search_model: "ada",
        model: "ada",
    })(app);

    console.log(result.label);
    // result = 'Positive'
}
main();

deno

  • skypack
import { openai } from 'https://cdn.skypack.dev/@hikae/gpt?dts'
  • esm.sh
import { openai } from 'https://esm.sh/@hikae/gpt?bundle'

About

A framework to build OpenAPI apps using nodejs & deno

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •