POST
/
api
/
ai
/
content
/
v4
curl --request POST \
  --url https://api.worqhat.com/api/ai/content/v4 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "question": "hiii there",
  "model": "aicon-v4-nano-160824",
  "randomness": 0.5,
  "stream_data": false,
  "training_data": "You are alex and you are one of the best Tour Guides. answer everything while starting with your name",
  "response_type": "text",
  "conversation_id": "conv_1724236791746",
  "preserve_history": true,
  "conversation_history": [
    "What is the capital of India?: New Delhi",
    "What is the capital of USA?: Washington DC"
  ]
}'
{
  "Text Output": {
    "value": {
      "content": "Hi there!  My name is Alex, and I'm happy to help you with anything you need for your tour.  What can I do for you today?",
      "processingTime": 3105.397454,
      "processingId": "8aa97481-20f9-48f4-a12d-d02eb6c1d62a",
      "processing_count": 84,
      "conversation_id": "conv_1724236791746",
      "model": "aicon-v4-nano-160824"
    }
  },
  "JSON Structured Output": {
    "value": {
      "content": "{\"response\": \"Hi there!  My name is Alex, and I'm delighted to assist you with your travel needs. What can I help you with today\"}",
      "processingTime": 2946.176112,
      "processingId": "5944ab45-8bd7-4151-853d-da6cf315d617",
      "processing_count": 90,
      "conversation_id": "conv_1724237541817",
      "model": "aicon-v4-nano-160824"
    }
  },
  "Streaming Data": {
    "value": {
      "data": [
        {
          "content": "Hi",
          "model": "aicon-v4-nano-160824",
          "timestamp": 1724240278523,
          "processing_id": "bc4cc3b9-d000-4866-83ad-ad71abf10c8f",
          "conversation_id": "conv_1724240276193"
        },
        {
          "content": " there! My name is Alex, and I'm excited to be your tour",
          "model": "aicon-v4-nano-160824",
          "timestamp": 1724240278630,
          "processing_id": "bc4cc3b9-d000-4866-83ad-ad71abf10c8f",
          "conversation_id": "conv_1724240276193"
        },
        {
          "content": " guide today. What can I help you with? \n",
          "model": "aicon-v4-nano-160824",
          "timestamp": 1724240278708,
          "processing_id": "bc4cc3b9-d000-4866-83ad-ad71abf10c8f",
          "conversation_id": "conv_1724240276193"
        },
        {
          "content": "",
          "model": "aicon-v4-nano-160824",
          "timestamp": 1724240278712,
          "processing_id": "bc4cc3b9-d000-4866-83ad-ad71abf10c8f",
          "conversation_id": "conv_1724240276193"
        },
        {
          "content": "",
          "model": "aicon-v4-nano-160824",
          "finishReason": "stop",
          "timestamp": 1724240278716,
          "processing_id": "bc4cc3b9-d000-4866-83ad-ad71abf10c8f",
          "conversation_id": "conv_1724240276193",
          "wordCount": 77
        }
      ]
    }
  }
}

Generate from Multimodal Inputs WorqHat AiCon V4 API allows you to generate text using only text input. You can choose from a variety of models, each with its own strengths:

  • aion-v4-nano-160824 (finetuned included): Ideal for quick and efficient text generation, especially when resources are limited.
  • aion-v4-large-160824 (finetuned included): Our smartest and highest accuracy model, suitable for a wide range of text generation tasks, complex though and reasoning along with mathematical solutions.
  • aion-v4-alpha-160824: A better version of the aion-v4-nano-160824 model which is trained on live data, providing up-to-date insights and knowledge. It’s ideal for tasks that require real-time information, such as news analysis, market research, or staying informed on current events.

Choose Your Response Style:

You have the option to either stream the response (stream_data = true) or wait for the entire result to be generated (stream_data = false).

Benefit: Faster interactions. You receive partial results as they are generated, allowing you to start working with the text immediately.


Example:

var files = document.querySelector('input[type="file"]').files;
var myHeaders = new Headers();
myHeaders.append('Authorization', 'Bearer sk-02e44************');

var formdata = new FormData();
formdata.append('question', 'what are the images about');
formdata.append(
  'training_data',
  'You are alex and you are one of the best Tour Guides. answer everything while starting with your name'
);

for (const file of files) {
  formdata.append('files', file);
}

formdata.append('model', 'aicon-v4-nano-160824');
formdata.append('stream_data', 'true');

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow',
};

fetch('https://api.worqhat.com/api/ai/content/v4', requestOptions)
  .then(response => response.text())
  .then(result => {
      console.log(result);
      alert('Response received: ' + result);
  })
  .catch(error => {
      console.log('error', error);
      alert('Error: ' + error);
  });

Key Points:

  • Replace YOUR_API_KEY with your actual WorqHat AiCon V4 API key.
  • Adjust the model parameter to select the desired model.
  • Modify the prompt to provide your text input.

Try out other Capabilities of the WorqHat API

  • Build Multiturn Conversations or Chat Applications by having the model maintain history by default Text Only Conversational
  • Fetch real world information and data using the Alpha Models Alpha Models(Text Only)

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

Response

200
application/json
Text generated successfully

The response is of type object.