Text

Utilities functions for text

Description:
  • Utilities functions for text

Source:

Methods

(static) generateSummary(options) → {Promise.<string>}

Description:
  • Generates a summary of the provided content using OpenAI's chat completions API.

Source:
Example
import { generateSummary } from "nsuite";
const summary = generateSummary({
  apiKey: "",
  baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
  model: "qwen-turbo",
  language: "English",
  maxWords: 200,
  content: "",
});
Parameters:
Name Type Description
options Object

The options for generating the summary.

Properties
Name Type Description
apiKey string

The API key for OpenAI.

baseUrl string

The base URL for the OpenAI API.

model string

The model to use for generating the summary.

language string

The language in which the summary should be written.

maxWords number

The maximum number of words the summary should contain.

content string

The content to be summarized.

Throws:
  • Throws an error if there is a problem generating the summary.
Type
Error
Returns:
  • A promise that resolves to the generated summary.
Type
Promise.<string>