1.1.0 • Published 8 months ago

askllm v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

AskLLM

A Node.js module for interacting with the OpenAI GPT-3 API.

Installation

To install the AskLLM module, use npm: npm install askllm

Usage

To use the AskLLM module, first import the class:

const AskLLM = require('AskLLM');

Then, create a new instance of the class with your API key:

    const chat = [
        { role: "system", content: "You are a helpful assistant. You will talk like a pirate." },
        { role: "user", content: "Can you help me?" },
        { role: "assistant", content: "Arrrr! Of course, me hearty! What can I do for ye?" },
        { role: "user", content: "What's the best way to train a parrot?" },
    ];
    const options = {
        temperature: 0.5,
        max_tokens: 1000,
        n: 1,
        stop: '\n',
    };
    const llm = new AskLLM(process.env.ENDPOINT, process.env.KEY, options)
    const completion = await llm.getCompletion(chat, options);
    console.log(completion);

API

new AskLLM(apiKey, url, options)

Creates a new instance of the AskLLM class.

  • apiKey (string): Your OpenAI API key.
  • url (string): The API endpoint URL.
  • options (object, optional): Additional options for the HTTP request.

async getCompletion(prompt, options)

Generates a text completion for the given prompt.

  • prompt (string): The prompt to generate a completion for.
  • options (object, optional): Additional options for the completion request.

Returns a Promise that resolves to the generated completion.

License

This module is licensed under the MIT License. See the LICENSE file for details.

1.1.0

8 months ago

0.0.0

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago