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

worqhat

v2.1.15

Published

NodeJS SDK for WorqHat Endpoints

Downloads

155

Readme

Worqhat Node SDK

Better Stack Badge NPM version GitHub CI Known Vulnerabilities

The WorqHat Node SDK is a comprehensive library that allows developers to interact with the WorqHat API. It provides a simple and intuitive interface to access various AI services such as content generation, image generation, text extraction, image analysis, and more.

This library provides convenient access to the WorqHat REST API from TypeScript or JavaScript.

To learn how to use the WorqHat APIs, check out our API Reference and Documentation.

Table of Contents

Installation

You can install the WorqHat Node SDK via npm or yarn:

# using npm
npm install worqhat
# using yarn
yarn add worqhat

Usage

First, you need to import the Worqhat SDK and initialize it with your API key:

const worqhat = require('worqhat');

var config = new worqhat.Configuration({
  apiKey: "your-api-key",
  debug: true,
  max_retries: 3,
});

worqhat.initializeApp(config);

Here are the configuration options you can set when initializing the Worqhat SDK:

| Option | Description | Required | | ------------- | --------------------------------------------------------------------------------------------------- | -------- | | apiKey | The API key used for authentication. This key is required to access the API services. | Yes | | debug | If set to true, the SDK will log debug information to the console. Default value is false. | No | | max_retries | The maximum number of retries to attempt for a request. The default value is 2. Max limit is 5. | No |

TypeScript support

Import the package as a class and run the Typescript compiler. You can then use the SDK as follows:

import * as worqhat from 'worqhat';

const config = new worqhat.Configuration({
  apiKey: 'your-api-key',
  debug: false,
});

worqhat.initializeApp(config);

Verify User Profile

The easiest way to verify whether the package is working or not is by sending a request to the Authenticate endpoint. This can be done by calling the checkAuthentication method provided by the SDK. Here is an example of how to do this:

const worqhat = require('worqhat');

const config = new worqhat.Configuration({
  apiKey: 'your-api-key',
  debug: true,
});

worqhat.initializeApp(config);

async function checkAuth() {
  try {
    const result = await worqhat.checkAuthentication();
    console.log(result);
  } catch (error) {
    console.error(error);
  }
}

checkAuth();

Sample Functions

You can generate content using the contentGeneration method:

AiCon V2

Version 2 Content Generation AI focused only on Business Content Generation Purpose. It can be used to generate content for a variety of business use cases where the content is not too creative or complex. Read more at https://docs.worqhat.com/ai-models/text-generation-ai/aicon-v2-textgen

   async function generateContent() {
     try {
       var result = await worqhat.contentGeneration.v2({
         conversation_history: [{ "previous question": "answer to your previous question" }, { "previous question": "answer to your previous question" }],
         preserve_history: true,
         question: "Your question here",
         training_data: "your-training-data-id",
         randomness: 0.3,
       })
       console.log(result);

     } catch (error) {
       console.error(error);
     }
   }

   generateContent();

Here are the parameters that can be passed to the contentGeneration method:

| Parameter | Description | Required | | ---------------------- | ----------------------------------------------------------------------------------- | -------- | | conversation_history | An object representing the history of the conversation. | No | | preserve_history | A boolean indicating whether to preserve the conversation history. | No | | question | A string representing the question to generate content for. | Yes | | training_data | A string representing the training data to use for generating content. | No | | randomness | A float representing the randomness or hallucinating factor for content generation. | No |

Note: If conversation_history is not provided, the default value is undefined. If preserve_history is not provided, the default value is false. If training_data is not provided, the default value is undefined. If randomness is not provided, the default value is 0.2.


AiCon V3

Version 3 Advanced Generation AI focused for more creative and understanding capabilities. It can be used to generate content for a variety of use cases where the content is more creative or complex. It can run complex situational analysis and understand the context of the commands. Read more at https://docs.worqhat.com/ai-models/text-generation-ai/aicon-v3-textgen

   const worqhat = require('worqhat');

   var config = new worqhat.Configuration({
     apiKey: "your-api-key",
     debug: true,
   });

   worqhat.initializeApp(config);

   async function generateContent() {
     try {
       var result = await worqhat.contentGeneration.v3({
         conversation_history: [{ "previous question": "answer to your previous question" }, { "previous question": "answer to your previous question" }],
         preserve_history: true,
         question: "Your question here",
         training_data: "your-training-data-id",
         randomness: 0.3,
       })
       console.log(result);

     } catch (error) {
       console.error(error);
     }
   }

   generateContent();

Here are the parameters that can be passed to the contentGeneration method:

| Parameter | Description | Required | | ---------------------- | ----------------------------------------------------------------------------------- | -------- | | conversation_history | An object representing the history of the conversation. | No | | preserve_history | A boolean indicating whether to preserve the conversation history. | No | | question | A string representing the question to generate content for. | Yes | | training_data | A string representing the training data to use for generating content. | No | | randomness | A float representing the randomness or hallucinating factor for content generation. | No |

Note: If conversation_history is not provided, the default value is undefined. If preserve_history is not provided, the default value is false. If training_data is not provided, the default value is undefined. If randomness is not provided, the default value is 0.2.

Documentations

For more detailed documentation, please visit our official documentation.

License

This project is licensed under the MIT License. For more details, please refer to the LICENSE file.

Contributing

We welcome contributions from the community. Please read our contributing guidelines for more information.

Support

If you encounter any issues or have any questions, please file an issue on our GitHub issues page.