Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Intelets

Kedar Vijay Kulkarni edited this page Dec 5, 2021 · 3 revisions

Intelets

List Intelets

List all of your organization's intelets.

Query String Parameters

  • page (number) - The page of records to return. Optional, defaults to page 1.

  • size (number) - the number of records to return for each page. Optional, defaults to 20 intelets a page.

  • tags (string) - A list of Tag IDs separated by comma used to filter the results, optional.

Document link

const mantiumAi = require('@mantium/mantiumapi');

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: '[email protected]',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
      return response;
    });
  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Intelets().list({ 'page': 1, 'size': 20 }).then((response) => {
    console.log('*********** List *********');
    console.log(response.data);
  });
})();

Example of a successful completion response

{
  data: [
    {
      id: 'f6e84a80-5c60-4015-90e8-21fe0b0fc8b7',
      type: 'intelet_view',
      attributes: {
        intelet_id: 'f6e84a80-5c60-4015-90e8-21fe0b0fc8b7',
        name: 'Intelet Name given by me',
        description: 'Description given by me',
        created_at: '2021-10-17T10:44:14.510931+00:00',
        created_by: 'a3e5c076-311c-46af-97cd-d1e529512afe',
        created_by_email: '[email protected]',
        created_by_name: ' ',
        updated_at: null,
        updated_by_email: null,
        updated_by_name: null,
        organization_id: 'c68c07c9-d11a-4b54-8823-1dff6792916d',
        organization_name: ' ',
        tags: null,
        prompts: [
          {
            prompt_id: 'c45bcc94-ea1e-4faa-886b-059b10c38020',
            prompt_name: 'update the Prompt',
            operation_order: 1
          },
          {
            prompt_id: '242bb0a2-213e-4001-96a4-f29e0912c99a',
            prompt_name: 'Basic Prompt',
            operation_order: 2
          }
        ]
      },
      relationships: {}
    }
  ],
  included: [],
  meta: {},
  links: { total_items: 1, current_page: 1 }
}

Go to Table of Contents

Create an Intelet

  • Name* (string) - Name of the Intelet.

  • Description (string) - Text to describe the purpose of this Intelet.

  • Prompts (array) - Prompts to include in the Intelet. Prompts are executed in the order that they appear in this list, with the first Prompt feeding its output to the 2nd Prompt, and so on until the final Prompt.

Body payload object { ...data }; Object example

Document link

Example of violate setting value(s) and it's Response(s)

in following example we send wrong prompts ID's

const mantiumAi = require('@mantium/mantiumapi');

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: '[email protected]',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
      return response;
    });

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  mantiumAi.Intelets('OpenAI').create({
    "name":"intelet name",
    "description":"description for the intelet",
    "prompts":[
      "41f62edf-9b0f-4397-8254-21dfc95e4efe",
      "23c217b8-1f87-4222-9e3c-e3bf4497c217"
    ]}).then((response) => {
    console.log("*************** Intelet Create ***************");
    console.log(response);
  });

})();

Example of a Error response

// *************** Prompt Create ***************
{
  detail: 'Prompt ID 96613f72-0fed-4b39-8775-beafe74d30ef does not exist for the organization 563821cd-903e-4b5c-8541-ea828058aec6'
}

Correct data for creation

const mantiumAi = require('@mantium/mantiumapi');

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: '[email protected]',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
      return response;
    });

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  mantiumAi.Intelets('OpenAI').create({
    "name":"intelet name",
    "description":"description for the intelet",
    "prompts":[
      "41f62edf-9b0f-4397-8254-21dfc95e4efe",
      "23c217b8-1f87-4222-9e3c-e3bf4497c217"
    ]}).then((response) => {
    console.log("*************** Intelet Create ***************");
    console.log(response);
  });
})();

Example of a successful completion response

{
  data: {
    id: '8caa02c8-cb62-4a58-a17c-302a8369b3a0',
    type: 'intelet',
    attributes: {
      created_at: '2021-10-17T17:18:39.618524+00:00',
      updated_at: null,
      intelet_id: '8caa02c8-cb62-4a58-a17c-302a8369b3a0',
      organization_id: 'c68c07c9-d11a-4b54-8823-1dff6792916d',
      name: 'intelet name',
      description: 'description for the intelet',
      share_allow_input: false,
      share_name: null,
      share_description: '',
      share_placeholder: '',
      share_author_name: null,
      share_author_contact: '',
      share_type: null,
      share_status: 'ACTIVE',
      created_by: 'a3e5c076-311c-46af-97cd-d1e529512afe',
      updated_by: null
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Update Intelet

  • Name* (string) - Name of the Intelet.

  • Description (string) - Text to describe the purpose of this Intelet.

  • Prompts (array) - Prompts to include in the Intelet. Prompts are executed in the order that they appear in this list, with the first Prompt feeding its output to the 2nd Prompt, and so on until the final Prompt.

Prompt Id* (string)* required parameter

Body payload object { ...data }; Object example

Document link

const mantiumAi = require('@mantium/mantiumapi');

// mantiumAi.ORIGIN = 'https://api.staging.mantiumai.com';

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: '[email protected]',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
      // console.log(response);
      return response;
    });

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  mantiumAi.Intelets().update({
    "id": "5407866a-0ad3-4671-b7e3-b5635bf521ea",
    "name":"Chang in intelet name",
    "description":"description for the intelet is changed",
    "prompts":[
      "41f62edf-9b0f-4397-8254-21dfc95e4efe",
      "23c217b8-1f87-4222-9e3c-e3bf4497c217"
    ]}).then((response) => {
    console.log("*************** Intelet update ***************");
    console.log(response);
  });

})();

Example of a successful completion response

// *************** Intelet Update ***************
{
  data: {
    id: '5407866a-0ad3-4671-b7e3-b5635bf521ea',
    type: 'intelet',
    attributes: {
      created_at: '2021-10-18T10:25:08.034662+00:00',
      updated_at: '2021-10-18T10:42:57.048906+00:00',
      intelet_id: '5407866a-0ad3-4671-b7e3-b5635bf521ea',
      organization_id: 'c68c07c9-d11a-4b54-8823-1dff6792916d',
      name: 'Chang in intelet name',
      description: 'description for the intelet is changed',
      share_allow_input: false,
      share_name: null,
      share_description: '',
      share_placeholder: '',
      share_author_name: null,
      share_author_contact: '',
      share_type: null,
      share_status: 'ACTIVE',
      created_by: 'a3e5c076-311c-46af-97cd-d1e529512afe',
      updated_by: 'a3e5c076-311c-46af-97cd-d1e529512afe'
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Get an Intelet using ID url

Information on specific intelet

  • Intelet Id* (string)

Document link

const mantiumAi = require('@mantium/mantiumapi');

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: '[email protected]',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
      return response;
    });

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Intelets()
    .retrieveId('5407866a-0ad3-4671-b7e3-b5635bf521ea')
    .then((response) => {
      console.log("*************** retrieve ***************");
      console.log(response);
    });
})();

Example of a successful completion response

// *************** retrieve ***************
{
  data: {
    id: '5407866a-0ad3-4671-b7e3-b5635bf521ea',
    type: 'intelet_view',
    attributes: {
      intelet_id: '5407866a-0ad3-4671-b7e3-b5635bf521ea',
      name: 'Chang in intelet name',
      description: 'description for the intelet is changed',
      created_at: '2021-10-18T10:25:08.034662+00:00',
      created_by: 'a3e5c076-311c-46af-97cd-d1e529512afe',
      created_by_email: '[email protected]',
      created_by_name: ' ',
      updated_at: '2021-10-18T10:42:57.048906+00:00',
      updated_by_email: '[email protected]',
      updated_by_name: ' ',
      organization_id: 'c68c07c9-d11a-4b54-8823-1dff6792916d',
      organization_name: ' ',
      tags: null,
      prompts: [
        {
          prompt_id: 'c07449be-aae0-421c-a00d-72e1b6928ac4',
          prompt_name: 'update the Prompt',
          operation_order: 1
        },
        {
          prompt_id: 'fb6a24b9-cd3c-4600-a58f-929ce6d5c044',
          prompt_name: 'Test prompt name',
          operation_order: 2
        }
      ]
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Get an Intelet

Information on specific intelet

  • Intelet Id* (string)

Document link

const mantiumAi = require('@mantium/mantiumapi');

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: '[email protected]',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
      return response;
    });

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Intelets()
    .retrieve('5407866a-0ad3-4671-b7e3-b5635bf521ea')
    .then((response) => {
      console.log("*************** retrieve ***************");
      console.log(response);
    });
})();

Example of a successful completion response

// *************** retrieve ***************
{
  data: {
    id: '5407866a-0ad3-4671-b7e3-b5635bf521ea',
    type: 'intelet_view',
    attributes: {
      intelet_id: '5407866a-0ad3-4671-b7e3-b5635bf521ea',
      name: 'Chang in intelet name',
      description: 'description for the intelet is changed',
      created_at: '2021-10-18T10:25:08.034662+00:00',
      created_by: 'a3e5c076-311c-46af-97cd-d1e529512afe',
      created_by_email: '[email protected]',
      created_by_name: ' ',
      updated_at: '2021-10-18T10:42:57.048906+00:00',
      updated_by_email: '[email protected]',
      updated_by_name: ' ',
      organization_id: 'c68c07c9-d11a-4b54-8823-1dff6792916d',
      organization_name: ' ',
      tags: null,
      prompts: [
        {
          prompt_id: 'c07449be-aae0-421c-a00d-72e1b6928ac4',
          prompt_name: 'update the Prompt',
          operation_order: 1
        },
        {
          prompt_id: 'fb6a24b9-cd3c-4600-a58f-929ce6d5c044',
          prompt_name: 'Test prompt name',
          operation_order: 2
        }
      ]
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Delete an Intelet

  • Intelet Id* (string)

Document link

const mantiumAi = require('@mantium/mantiumapi');

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: '[email protected]',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
      return response;
    });

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Intelets()
    .remove('2bddef3e-f4d9-400c-b2db-4ed2a52c6b83')
    .then((response) => {
      console.log("*************** Remove ***************");
      console.log(response);
    });
})();

/*
* run command
* node intelets/remove.js
*/

Example of a successful completion response

Intelet Deleted

Go to Table of Contents

Execute Intelet

Asynchronously submit data to an intelet by intelet_id. If successful, the status and results of the intelet can be retrieved from the /v1/intelet/result/{intelet_execution_id} endpoint by intelet_execution_id.

Intelet Id* (string)* required parameter, The ID of the intelet to start executing

Input* (string)* Data to input into the Intelet

Document link

const mantiumAi = require('@mantium/mantiumapi');

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: '[email protected]',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
      return response;
    });

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */

  let intelet_id = 'some-long-intelets-id';
  let input = 'What is the meaning of life?';

  await mantiumAi.Intelets()
    .execute({
      id: intelet_id,
      input
    })
    .then(async (res) => {
      console.log("*************** Execute ***************");
      console.log(res);
    });
})();

Example of a successful completion response

// *************** Execute ***************
{
  success: true,
  intelet_id: 'some-long-intelets-id',
  input: 'What is the meaning of life?',
  status: 'QUEUED',
  intelet_execution_id: 'some-long-intelets-execution-id',
  error: ''
}

Go to Table of Contents

Get Intelet Result

Get Intelet Execution Result

Returns execution status of intelet ran through the intelet execution workflow asynchronously.

Intelet Execution Id* (string)* this can be achieved from the successful response from the execute Intelet method.

Document link

const mantiumAi = require('@mantium/mantiumapi');

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: '[email protected]',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
      return response;
    });

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */

  let intelet_id = 'some-long-intelets-id';
  let input = 'What is the meaning of life?';

  await mantiumAi.Intelets()
    .execute({
      id: intelet_id,
      input
    })
    .then(async (res) => {
      /*
      * from the successful response collect the prompt_execution_id
      * and then pass this to the result method
      */
      if(res?.intelet_execution_id) {
        await mantiumAi.Intelets().result(res.intelet_execution_id)
        .then((response) => {
          console.log("*************** Execute Result ***************");
          console.log(response);
        });
      }
    });
})();

Example of a successful completion response

// *************** Execute Result ***************
{
  intelet_execution_id: '81daa784-838f-46f6-9518-2c50cec7fb4b',
  intelet_id: 'da98c9fc-c139-4136-a6e9-286bca5cc397',
  status: 'COMPLETED',
  input: 'What is the meaning of life?',
  output: '\n' +
    '"I am a man of the people, and I will not be a slave to the people." - Abraham Lincoln\n' +
    '\n',
  error: '',
  reason: '',
  results: [],
  pending_prompts: [],
  executed_prompts: [
    {
      status: 'COMPLETED',
      prompt_execution_id: '4e72c6a3-3560-410c-af5f-fe5544d5b986',
      prompt_id: '41f62edf-9b0f-4397-8254-21dfc95e4efe',
      input: 'What is the meaning of life?',
      output: '\n' +
        'Check out my FULL explanation, including copyright claim for this work at the bottom of the OP.\n' +
        "Well is it absolutely necessary? I know you like to troll, but if your goal is information sharing (and not trolling) is there any point in starting with negativity? Or am I missing something that using fault finding opens up exept personal gratification on your part..OH PS IM NOT A TANK!!!! Well many people may respond 'TKO's SILLY' Check out my FULL explanation, including copyright claim for this work at the bottom of the OP.Well is it absolutely necessary? I know you like to troll, but if your goal is information sharing (and not trolling)is there any point in starting with negativity? Or am I missing something that using fault finding opens up exept personal gratification on your part..OH PS IM NOT A TANK!!!!",
      reason: '',
      error: '',
      hitl_info: null
    },
    {
      status: 'COMPLETED',
      prompt_execution_id: '8108d3be-0f12-4d94-bfda-1f49327c6d12',
      prompt_id: '23c217b8-1f87-4222-9e3c-e3bf4497c217',
      input: '\n' +
        'Check out my FULL explanation, including copyright claim for this work at the bottom of the OP.\n' +
        "Well is it absolutely necessary? I know you like to troll, but if your goal is information sharing (and not trolling) is there any point in starting with negativity? Or am I missing something that using fault finding opens up exept personal gratification on your part..OH PS IM NOT A TANK!!!! Well many people may respond 'TKO's SILLY' Check out my FULL explanation, including copyright claim for this work at the bottom of the OP.Well is it absolutely necessary? I know you like to troll, but if your goal is information sharing (and not trolling)is there any point in starting with negativity? Or am I missing something that using fault finding opens up exept personal gratification on your part..OH PS IM NOT A TANK!!!!",
      output: '\n' +
        '"I am a man of the people, and I will not be a slave to the people." - Abraham Lincoln\n' +
        '\n',
      reason: '',
      error: '',
      hitl_info: null
    }
  ]
}

Go to Table of Contents