npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ai21-sdk

v1.0.3

Published

A npm package designed specializing in Natural Language Processing, which develops AI systems that can understand and generate natural language.

Downloads

22

Readme

ai21-sdk (An unofficial NPM package for AI21 Labs)

npm version created by star size npm downloads license

A npm package designed specializing in Natural Language Processing, which develops AI systems that can understand and generate natural language. AI21’s tools provide robust and flexible solutions for developers looking to integrate advanced language models into their applications.

About AI21 Labs

AI21 Labs is a leading company in the field of artificial intelligence, specifically in natural language processing (NLP) and generative AI. They develop advanced AI models and tools to assist in various tasks involving text understanding, generation, and manipulation. AI21's models are known for their high performance and capability to generate human-like text.

Main Functions

  1. Text Generation: AI21 models can generate coherent and contextually relevant text based on a given prompt. This is useful for content creation, creative writing, and other applications requiring natural language generation.

  2. Text Summarization: The models can summarize long pieces of text into shorter, more concise versions without losing the essential information.

  3. Text Completion: Given the start of a sentence or paragraph, AI21 models can complete the text in a coherent manner.

  4. Question Answering: These models can answer questions based on provided context or general knowledge.

How to Use

  1. Create an account and Sign In: https://studio.ai21.com/
  2. Go into the Profile and Click on API key. Copy the API key and we will use it to authenticate your account.

Installation

You can install this package using npm or yarn.

npm

npm i ai21-sdk

yarn

yarn add ai21-sdk

Usage

// Usage example

import Paraphrase from "ai21-sdk/dist/paraphrase";
import GrammaticalCorrection from "ai21-sdk/dist/grammaticalCorrection";
import TextImprovements from "ai21-sdk/dist/textImprovements";
import TextSegmentation from "ai21-sdk/dist/textSegmentation";
import ContextualAnswer from "ai21-sdk/dist/contextualAnswers";

const access_token = 'xxxxxxxxxxxxxxxxxx';

const paraphrase = new Paraphrase(access_token);
const grammaticalCorrection = new GrammaticalCorrection(access_token);
const textImprovements = new TextImprovements(access_token);
const textSegmentation = new TextSegmentation(access_token);
const contextualAnswer = new ContextualAnswer(access_token);

paraphrase.getParaphrase('I am Muhammad Usman & I am 30 years').then( result => console.log(result));
grammaticalCorrection.getGrammaticalCorrection('I Muhammad Usman I 30 years old').then( result => console.log(result));
textImprovements.getTextImprovements('I am Muhammad Usman and I 30 years old  Pakstan', ["fluency"]).then( result => console.log(result));
textSegmentation.getTextSegmentation('https://www.nhs.uk/conditions/carpal-tunnel-syndrome/', 'URL').then( result => console.log(result));
contextualAnswer.getContextualAnswer('Something large text context', 'Did the economy shrink?').then( result => console.log(result));

Functions

| Function | Description | |---------|---------| | getParaphrase | Takes a piece of text and returns a list of paraphrases that convey the same meaning using different words. | | getGrammaticalCorrection | Detects grammar, spelling, punctuation, and word choice errors in text, and suggests how to correct them. | | getTextImprovements | Provides rewrite recommendations for improving the fluency, clarity and style of the input text. | | getTextSegmentation | Takes a document (raw text or URL) and returns segmentation into paragraphs by topic. | | getContextualAnswer | Receives a document and a question and returns an answer based entirely on the document context. |

Scripts

Build

To compile the TypeScript files to JavaScript, run:

npm run build

Test

To run tests, use:

npm run test

Configuration

TypeScript Configuration

This package uses a tsconfig.json file for TypeScript configuration. Here is an example:

{
  "compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "outDir": "./dist"
  },
}

Contributing

Support

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details.