2.1.15 • Published 6 months ago

worqhat v2.1.15

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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:

OptionDescriptionRequired
apiKeyThe API key used for authentication. This key is required to access the API services.Yes
debugIf set to true, the SDK will log debug information to the console. Default value is false.No
max_retriesThe 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:

ParameterDescriptionRequired
conversation_historyAn object representing the history of the conversation.No
preserve_historyA boolean indicating whether to preserve the conversation history.No
questionA string representing the question to generate content for.Yes
training_dataA string representing the training data to use for generating content.No
randomnessA 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:

ParameterDescriptionRequired
conversation_historyAn object representing the history of the conversation.No
preserve_historyA boolean indicating whether to preserve the conversation history.No
questionA string representing the question to generate content for.Yes
training_dataA string representing the training data to use for generating content.No
randomnessA 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.

2.1.4

7 months ago

2.1.3

7 months ago

2.1.6

6 months ago

2.1.5

6 months ago

2.1.8

6 months ago

2.1.7

6 months ago

2.1.9

6 months ago

2.1.14

6 months ago

2.1.15

6 months ago

2.1.10

6 months ago

2.1.2

7 months ago

1.1.13

7 months ago

1.1.12

7 months ago

1.1.11

7 months ago

1.1.10

7 months ago

1.1.9

8 months ago

1.1.8

8 months ago

1.1.7

8 months ago

1.1.6

8 months ago

1.1.5

8 months ago

1.1.4

8 months ago

1.1.3

8 months ago

1.1.2

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago