textcortex-hemingwai-js
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

textcortex-hemingwai-js

textcortex-hemingwai-js

TextCortex API javascript packages for generating content even faster! Generate product descriptions, blogs, ads and more using GPT architecture with a single request to TextCortex API a.k.a HemingwAI

Table of Contents

Installation and usage

The easiest way to install textcortex-hemingwai-js is using npm or yarn.

yarn add textcortex-hemingwai-js

Or

for installation via yarn

npm install textcortex-hemingwai-js

Get your api key:

  1. Signup at https://textcortex.com
  2. Sign-in and click on account on top right.
  3. Go to API Key section and copy your key.


Start generating content with a single line of code!

import { TextCortex } from "textcortex-hemingwai-js";

const hemingwai = new TextCortex(YOUR_API_KEY);

hemingwai.generateProductDescriptions({
  product_title: "Headphone",
  product_brand: "JBL",
  product_features: ["Noise canceling"],
  product_category: ["electronics"],
  source_language: "en",
});

Response:

{
  status: "success",
  ai_results: [
    {
      generated_text: ` The JBL K8 In-Ear Noise Canceling Earbuds are designed to block out unwanted  ambient noise while you're on the go. If you prefer music without distraction,  these earphones will do the job for you. Made with a dynamic driver and an inline microphone for exceptional sound quality,  they come in black and feature built-in volume control.`,
      rank: 0.9762,
      text_length: 336,
      word_frequency: [],
      word_count: 56,
    },
  ],
  error: 200,
}

API key related errors

API key related errors have an error message attached to them as follows:

if (errorData.error === 403) {
  throw {
    errorMessage:
      "API Key is invalid. Check out your API key on https://app.textcortex.com/user/account",
    ...error,
  };
} else if (errorData.error === 402) {
  throw {
    errorMessage:
      "Reached API Limits, increase limits by contacting us at dev@textcortex.com or upgrade your account",
    ...error,
  };
}

What kind of texts are possible to generate?

Currently we support the following methods for generating copy text like the following:

// Generate Blog Articles:
hemingwai.generateBlog;

// Autocomplete the rest using Hemingwai
hemingwai.generate;

// Generate Ad copies using Hemingwai
hemingwai.generateAds;

// Generate Email Body using Hemingwai
hemingwai.generateEmailBody;

// Generate Email Subject using Hemingwai
hemingwai.generateEmailSubject;

// Generate Product Descriptions using Hemingwai
hemingwai.generateProductDescriptions;

Text Generation Variables

There are some variables that you need to send before making a request to Hemingwai.

Here is a brief summary of what those variables are:

  • prompt: Prompting the HemingwAI to start writing on a specific subject

  • creativity: Floating number between 0-1. 0 being the lowest creativity and 1 being the highest. Default is 0.7

  • character_length: Integer which defines the maximum amount of characters that can be produced by the HemingwAI

  • source_language: Language code of the source language of the written prompt. for example 'en' for English and 'de' for German. We support 72 languages. If you don't know the language code you can also use 'auto' for this field to automatically sense the input language.

  • parameters: Used for setting the tone of the generated copy text. It can be basically anything but please keep it plausible :)


Examples

See examples for examples.

Note: while generating ads, you can add your target segment as an option.


Issues

Looking to contribute? You are welcome. Just fork and PR to staging branch.

Questions

You can have a look at the HemingwAI's documentation on TextCortex website

Or talk to us at the TextCortex Dev Community on slack

🐞 Bugs

Please file an issue for bugs, missing documentation, or unexpected behavior.

See Bugs

💡 Feature Requests

We are happy. Please file an issue to suggest new features. Vote on feature requests by adding a 👍. This helps maintainers prioritize what to work on.

Maintainer/Creator

TextCortex Team and Abreham Gezahegn

License

MIT

Package Sidebar

Install

npm i textcortex-hemingwai-js

Weekly Downloads

3

Version

1.1.1

License

MIT

Unpacked Size

78 kB

Total Files

9

Last publish

Collaborators

  • abreham