@mantium/mantiumapi

JavaScript client for the Mantium AI API.

Usage no npm install needed!

<script type="module">
  import mantiumMantiumapi from 'https://cdn.skypack.dev/@mantium/mantiumapi';
</script>

README

Mantium

Table of Contents

Quickstart:

Read the getting started guide for more information on how to use Mantium.

Authentication

  • Make an account by visiting app.mantiumai.com and select Register.
  • Enter your email address and create a password. After you've verified the email, you'll be able to sign in to the Mantium application. You'll also need your username and password to obtain a token for API use.

Installation

Install Node.js on your computer. To install JavaScript Library please use the following command.

  npm install @mantium/mantiumapi

Usage

Initializing

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

  // bearer_id is received in response after successful login using auth login method.
  mantiumAi.api_key = bearer_id

  // bearer_id is required to pass in every header as value for Authorization.

Auth

get started with the login and use the API

Login

Obtain access token for a user Requirements: username: user's username password: user's password Document link

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

(async () => {
  const loginResponse = await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set as a api_key
      mantiumAi.api_key = response.data.attributes.bearer_id;
      return response;
    });
  console.log(loginResponse);
  console.log('Token', mantiumAi.api_key);
})();

Example of a successful API response

{
  data: {
    id: 'some-long-id',
    type: 'auth_login',
    attributes: {
      bearer_id: 'some-long-bearer-id',
      expires_on: '2021-09-27T15:19:50+00:00',
      token_type: 'Bearer'
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Logout

Invalidate a user's Access token (logout) Requires HTTP Authorization with the bearer_id Requirements: bearer_id: bearer id Document link

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

// This method throw error as we are not passing the Authorization [bearer_id]
(async () => {
  const logoutResponse = await mantiumAi.Auth().resetPassword({
    email: 'useremail@somedomain.com'
  })
    .then((response) => {
      return response;
    });
})();

// Correct way to do this

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
    });
  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  const logoutResponse = await mantiumAi.Auth().revokeToken().then((response) => {
    return response;
  });
  console.log(logoutResponse);
})();

Example of a successful API response

{
  data: {
    id: 'some-long-id',
    type: 'token_revoke',
    attributes: {
      error: null,
      message: 'The authorization token has been successfully revoked'
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

AI Methods

Get all of the supported ai_methods for a provider

List Methods

Require AI Provider name (case sensitive)* Document link

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

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
    });
  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */

  await mantiumAi.AiMethods('openai').list({ 'page': 1, 'size': 20 }).then((response) => {
    console.log(response);
  });

})();

Example of a successful API response

{
  data: [
    {
      id: 'type',
      type: 'object',
      attributes: {
        name: 'answers',
        api_name: 'answers',
        description: 'Returns answers',
        shareable: false,
        ai_provider: {
          name: 'OpenAI',
          description: 'OpenAI -- https://openai.org'
        },
        ai_engines: [
          {
            name: 'davinci',
            use_cases: 'some use cases',
            description: 'Some long description',
            cost_ranking: 100
          }
        ]
      },
      relationships: {}
    }
  ],
  included: [],
  meta: {},
  links: { total_items: 4, current_page: 1 }
}

Go to Table of Contents

AI Engines

Get available AI engines

Get All AI Engines

Get all of the configured and available AI engines

Query Params Page Page number Size Page size. If not supplied, returns all the results in a single page for certain APIs. Document link

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

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

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.AiEngines().all({ 'page': 1, 'size': 20 }).then((response) => {
    console.log(response);
  });
})();

Example of a successful API response

{
  data: [
    {
    id: 'davinci',
    type: 'ai_engine',
    attributes: {
      name: 'davinci',
      description: 'Some long description',
      use_cases: 'some use cases',
      ai_provider: 'OpenAI',
      cost_ranking: '100'
    },
    relationships: {}
  }],
  included: [],
  meta: {},
  links: { total_items: 17, current_page: 1 }
}

Go to Table of Contents

Get AI Engines By Provider

List all of the AI Engines for a specific AI Provider AI Provider name (case sensitive)

Query Params Page Page number Size Page size. If not supplied, returns all the results in a single page for certain APIs.

Document link

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

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

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  const providers = ["openai",
    "cohere",
    "mantium",
    "OpenAI",
    "Cohere",
    "Mantium"];

  for (let provider of providers) {
    const methodResponse = await mantiumAi.AiEngines(provider).byProvider({ 'page': 1, 'size': 20 }).then((response) => {
      return response;
    });
    console.log(methodResponse);
  }

})();

Example of a successful API response

// *********** Response for Cohere ***********
{
  data: [
    {
      id: 'baseline-shrimp',
      type: 'ai_engine',
      attributes: {
        name: 'baseline-shrimp',
        description: 'Some long description',
        use_cases: 'some use cases',
        ai_provider: 'Cohere',
        cost_ranking: '24'
      },
      relationships: {}
    }
  ],
  included: [],
  meta: {},
  links: { total_items: 9, current_page: 1 }
}

Go to Table of Contents

Get AI Engine By Name

Get the details for a specific AI Engine

require: AI Engine name

Document link

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

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    password: 'p@ssWord!'
  })
    .then((response) => {
      // get bearer_id and set to default
      mantiumAi.api_key = response.data.attributes.bearer_id;
    });
  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.AiEngines('ada').byName().then((response) => {
    console.log(response);
  });

})();

Example of a successful API response

// *********** Response for ada ***********
{
  data: {
    id: 'ada',
    type: 'ai_engine',
    attributes: {
      name: 'ada',
      description: 'Some long description',
      use_cases: 'some use cases',
      ai_provider: 'OpenAI',
      cost_ranking: '70'
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Tags

List Tags

Get all of the tags for your selected organization.

Query Params Page Page number Size Page size. If not supplied, returns all the results in a single page for certain APIs.

Document link

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

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

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Tags().list({ 'page': 1, 'size': 20 }).then((response) => {
    console.log('*********** Tag list *********');
    console.log(response);
  });
})();

Example of a successful API response

{
  data: [
    {
      id: 'some-long-id',
      type: 'tag',
      attributes: {
        tag_id: 'some-long-id',
        name: 'My Tag',
        description: 'This is a description',
        organization_id: 'some-long-id',
        created_by: 'user-some-long-id',
        created_at: '2021-09-28T07:33:05.064629+00:00',
        updated_by: null,
        updated_at: null
      },
      relationships: {}
    }
  ],
  included: [],
  meta: {},
  links: { total_items: 1, current_page: 1 }
}

Go to Table of Contents

Create a Tag

Name (string) Tag name Description (string) Optional value for tags used to add additional data regarding a tag

Document link

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

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

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Tags().create({
    name: 'tag name 1',
    description: 'Some description'
  }).then((response) => {
    console.log('*********** Tag create *********');
    console.log(response);
  });
})();

Example of a successful API response

{
  data: {
    id: 'some-long-id',
    type: 'tag',
    attributes: {
      tag_id: 'some-long-id',
      name: 'tag name 1',
      description: 'Some description',
      organization_id: 'organization-some-long-id',
      created_by: 'user-some-long-id',
      created_at: '2021-09-28T08:15:12.797516+00:00',
      updated_by: null,
      updated_at: null
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Get Tag using ID url

Get details about a specific tag.

Tag Id* (string)* required parameter

Document link

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

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

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Tags().retrieveId('some-long-id').then((response) => {
    console.log('*********** Tag retrieve by id *********');
    console.log(response.data);
  });
})();

Example of a successful API response

// *********** Tag retrieve by id *********
{
  id: 'some-long-id',
  type: 'tag',
  attributes: {
    created_at: '2021-09-28T08:15:12.797516+00:00',
    updated_at: null,
    tag_id: 'some-long-id',
    organization_id: 'organization-some-long-id',
    name: 'tag name 1',
    description: 'Some description',
    created_by: 'user-some-long-id',
    updated_by: null
  },
  relationships: {}
}

Go to Table of Contents

Get Tag

Get details about a specific tag.

Tag Id* (string)* required parameter

Document link

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

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Tags().retrieve('some-long-id').then((response) => {
    console.log('*********** Tag retrieve *********');
    console.log(response.data);
  });
})();

Example of a successful API response

*********** Tag retrieve *********
{
  id: 'some-long-id',
  type: 'tag',
  attributes: {
    created_at: '2021-09-28T08:15:12.797516+00:00',
    updated_at: null,
    tag_id: 'some-long-id',
    organization_id: 'organization-some-long-id',
    name: 'tag name 1',
    description: 'Some description',
    created_by: 'user-some-long-id',
    updated_by: null
  },
  relationships: {}
}

Go to Table of Contents

Update Tag

Update details about a specific tag.

Tag Id* (string)* required parameter Document link

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

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

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Tags().update({
    id: 'some-long-id',
    name: 'New tag name',
    description: 'Some long description'
  }).then((response) => {
    // save this tag id to edit the same tag
    tag_id = response.data.attributes.tag_id;
    console.log('*********** Tag updated *********');
    console.log(response);
  });
})();

Example of a successful API response

// *********** Tag updated *********
{
  data: {
    id: 'some-long-id',
    type: 'tag',
    attributes: {
      created_at: '2021-09-28T08:15:12.797516+00:00',
      updated_at: '2021-09-28T08:27:19.940023+00:00',
      tag_id: 'some-long-id',
      organization_id: 'organization-some-long-id',
      name: 'New tag name',
      description: 'Some long description',
      created_by: 'user-some-long-id',
      updated_by: 'user-some-long-id'
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Delete Tag

Delete a specific tag.

Tag Id* (string)* required parameter Document link

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

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

  /*
  * API Key is set on above
  * mantiumAi.api_key=`key`
  * so we can call these method directly now
  */
  await mantiumAi.Tags().remove('some-long-id').then((response) => {
    // save this tag id to edit the same tag
    tag_id = response.data.attributes.tag_id;
    console.log('*********** Tag remove *********');
    console.log(response);
  });
})();

Example of a successful API response

// *********** Tag remove *********
{
  data: {
    id: 'some-long-id',
    type: 'tag',
    attributes: {
      created_at: '2021-09-28T08:15:12.797516+00:00',
      updated_at: '2021-09-28T08:27:19.940023+00:00',
      tag_id: 'some-long-id',
      organization_id: 'organization-some-long-id',
      name: 'New tag name',
      description: 'Some long description',
      created_by: 'user-some-long-id',
      updated_by: 'user-some-long-id'
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Prompts

List Prompts

List all of your organization's prompts.

Query String Parameters

  • page - The page of records to return. Optional, defaults to page 1.
  • size - the number of records to return for each page. Optional, defaults to 20 - prompts a page.
  • schema_class - not used, exclude.
  • tags - 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: 'useremail@somedomain.com',
    password: 'p@ssWord!'
  })
  .then((response) => {
    // get bearer_id and set to default
    mantiumAi.api_key = response.data.attributes.bearer_id;
    return response;
  });

  await mantiumAi.Prompts().list({ 'page': 1, 'size': 20, 'show_public_shareable': false }).then((response) => {
    console.log('*********** List *********');
    console.log(response.data);
  });
})();

Example of a successful API response

{
  data: [
    {
      id: 'some-long-id',
      type: 'prompt',
      attributes: {
        prompt_id: 'some-long-id',
        organization_id: 'organization-some-long-id',
        name: 'Basic Prompt',
        description: 'Basic Prompt Description',
        created_at: '2021-09-29T02:54:28.543648+00:00',
        prompt_text: 'Endpoint Settings: Prompt Line',
        share_scope: 'ORGANIZATION_ONLY',
        ai_provider_approved: false,
        adults_only: false,
        ai_method: 'completion',
        ai_provider: 'OpenAI',
        intelets: [

        ],
        default_engine: 'ada',
        status: 'ACTIVE',
        prompt_parameters: [
          {
            prompt_text: 'Endpoint Settings: Prompt Line',
            basic_settings: {
              top_p: '1',
              stop_seq: [
                'Basic Settings: Stop Sequence'
              ],
              max_tokens: '1024',
              temperature: '1',
              presence_penalty: '1',
              frequency_penalty: '1'
            },
            default_engine: 'ada',
            advanced_settings: {
              n: '1',
              echo: true,
              stream: true,
              best_of: '10',
              logprobs: '10',
              logit_bias: [

              ]
            }
          }
        ],
        last_activity: null,
        share_name: null,
        share_description: '',
        share_placeholder: '',
        share_author_name: null,
        share_author_contact: '',
        share_type: null,
        share_allow_input: false,
        share_status: 'ACTIVE'
      },
      relationships: {
        intelets: { data: [ ] },
        tags: {
          data: [
            {
              type: 'tag',
              id: 'tag-some-long-id'
            }
          ]
        },
        security_policies: { data: [ ] },
        prompt_policies: { data: [ ] }
      }
    }
  ],
  included: [
    {
      id: 'tag-some-long-id',
      type: 'tag',
      attributes: [
        { tag_id: 'tag-some-long-id', name: 'Basic Tag' }
      ],
      relationships: {

      }
    }
  ],
  meta: {

  },
  links: {
    total_items: 3,
    current_page: 1
  }
}

Go to Table of Contents

Create a 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 number beyond the number range prompt_parameters.advanced_settings.n = 10 this value should between 1 - 3


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

(async () => {

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

  mantiumAi.Prompts('OpenAI').create({
    "name": "create the Prompt",
    "intelets": [],
    "policies": [],
    "tags": ["tag-some-long-id"],
    "status": "ACTIVE",
    "description": "Basic Prompt Description",
    "prompt_text": "Endpoint Settings: Prompt Line",
    "ai_method": "completion",
    "default_engine": "ada",
    "prompt_parameters": {
      "basic_settings": {
        "temperature": "1",
        "max_tokens": "512",
        "frequency_penalty": "1",
        "presence_penalty": "1",
        "top_p": "1",
        "stop_seq": ["Basic Settings: Stop Sequence"]
      },
      "advanced_settings": {
        "best_of": "5",
        "n": "10",
        "logprobs": "10",
        "echo": true,
        "stream": true,
        "logit_bias": []
      }
    }
  }).then((response) => {
    console.log("*************** Prompt Create ***************");
    console.log(response.detail);
  });
})();
Example of a Error response
// *************** Prompt Create ***************
{
  detail: [
    {
      loc: [ 'body', 'prompt_parameters', 'advanced_settings', 'n' ],
      msg: 'ensure this value is less than or equal to 3',
      type: 'value_error.number.not_le',
      ctx: { limit_value: 3 }
    }
  ]
}

Example of a successful API response

// *************** Prompt Create ***************
{
  data: {
    id: 'some-long-id',
    type: 'prompt',
    attributes: {
      prompt_id: 'some-long-id',
      organization_id: 'organization-some-long-id',
      name: 'create the Prompt',
      description: 'Basic Prompt Description',
      created_at: '2021-10-10T15:28:29.026463+00:00',
      prompt_text: 'Endpoint Settings: Prompt Line',
      share_scope: 'ORGANIZATION_ONLY',
      ai_provider_approved: false,
      adults_only: false,
      ai_method: 'completion',
      ai_provider: 'OpenAI',
      default_engine: 'ada',
      status: 'ACTIVE',
      prompt_parameters: [Object],
      last_activity: null,
      share_name: null,
      share_description: '',
      share_placeholder: '',
      share_author_name: null,
      share_author_contact: '',
      share_type: null,
      share_allow_input: false,
      share_status: 'ACTIVE'
    },
    relationships: {
      intelets: [Object],
      tags: [Object],
      security_policies: [Object],
      prompt_policies: [Object]
    }
  },
  included: [
    {
      id: 'tag-some-long-id',
      type: 'tag',
      attributes: [Object],
      relationships: {}
    }
  ],
  meta: {},
  links: {}
}

Go to Table of Contents

Update Prompt

Update details about a specific Prompt.

Prompt Id* (string)* required parameter

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

Document link

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

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    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.Prompts('OpenAI').update({
    "id": "some-long-id",
    "name": "update the Prompt",
    "intelets": [],
    "policies": [],
    "tags": ["383fb5e6-6c30-4641-9850-efeb3cdd77b8"],
    "status": "ACTIVE",
    "description": "Basic Prompt Description",
    "prompt_text": "Endpoint Settings: Prompt Line",
    "ai_method": "completion",
    "default_engine": "ada",
    "prompt_parameters": {
      "basic_settings": {
        "temperature": "1",
        "max_tokens": "512",
        "frequency_penalty": "1",
        "presence_penalty": "1",
        "top_p": "1",
        "stop_seq": ["Basic Settings: Stop Sequence"]
      },
      "advanced_settings": {
        "best_of": "5",
        "n": "2",
        "logprobs": "10",
        "echo": true,
        "stream": true,
        "logit_bias": []
      }
    }
  }).then((response) => {
    console.log("*************** Prompt Update ***************");
    console.log(response);
  });

})();

Example of a successful API response

// *************** Prompt Update ***************
{
  data: {
    id: 'some-long-id',
    type: 'prompt',
    attributes: {
      prompt_id: 'some-long-id',
      organization_id: 'organization-some-long-id',
      name: 'update the Prompt',
      description: 'Basic Prompt Description',
      created_at: '2021-10-10T15:28:29.026463+00:00',
      prompt_text: 'Endpoint Settings: Prompt Line',
      share_scope: 'ORGANIZATION_ONLY',
      ai_provider_approved: false,
      adults_only: false,
      ai_method: 'completion',
      ai_provider: 'OpenAI',
      default_engine: 'ada',
      status: 'ACTIVE',
      prompt_parameters: {
        basic_settings: {
          top_p: '1',
          stop_seq: [Array],
          max_tokens: '512',
          temperature: '1',
          presence_penalty: '1',
          frequency_penalty: '1'
        },
        advanced_settings: {
          n: '2',
          echo: true,
          stream: true,
          best_of: '5',
          logprobs: '10',
          logit_bias: []
        }
      },
      last_activity: null,
      share_name: null,
      share_description: '',
      share_placeholder: '',
      share_author_name: null,
      share_author_contact: '',
      share_type: null,
      share_allow_input: false,
      share_status: 'ACTIVE'
    },
    relationships: {
      intelets: { data: [] },
      tags: { data: [ [Object] ] },
      security_policies: { data: [] },
      prompt_policies: { data: [] }
    }
  },
  included: [
    {
      id: 'tag-some-long-id',
      type: 'tag',
      attributes: {
        tag_id: 'tag-some-long-id',
        name: 'Basic Tag'
      },
      relationships: {}
    }
  ],
  meta: {},
  links: {}
}

Go to Table of Contents

Get Prompt using ID url

Get details about a specific Prompt.

Prompt Id* (string)* required parameter

Document link

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

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    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.Prompts()
    .retreiveId('fab6e007-dab2-4245-907e-e1edf6f5f690')
    .then((response) => {
      console.log("*************** Retreive ***************");
      console.log(response);
    });
})();

Example of a successful API response

{
  data: {
    id: 'fab6e007-dab2-4245-907e-e1edf6f5f690',
    type: 'prompt',
    attributes: {
      prompt_id: 'fab6e007-dab2-4245-907e-e1edf6f5f690',
      organization_id: 'c68c07c9-d11a-4b54-8823-1dff6792916d',
      name: 'update the Prompt',
      description: 'Basic Prompt Description',
      created_at: '2021-10-10T15:28:29.026463+00:00',
      prompt_text: 'Endpoint Settings: Prompt Line',
      share_scope: 'ORGANIZATION_ONLY',
      ai_provider_approved: false,
      adults_only: false,
      ai_method: 'completion',
      ai_provider: 'OpenAI',
      default_engine: 'ada',
      status: 'ACTIVE',
      prompt_parameters: {
        basic_settings: {
          top_p: '1',
          stop_seq: [Array],
          max_tokens: '512',
          temperature: '1',
          presence_penalty: '1',
          frequency_penalty: '1'
        },
        advanced_settings: {
          n: '2',
          echo: true,
          stream: true,
          best_of: '5',
          logprobs: '10',
          logit_bias: []
        }
      },
      last_activity: null,
      share_name: null,
      share_description: '',
      share_placeholder: '',
      share_author_name: null,
      share_author_contact: '',
      share_type: null,
      share_allow_input: false,
      share_status: 'ACTIVE'
    },
    relationships: {
      intelets: { data: [] },
      tags: { data: [ [Object] ] },
      security_policies: { data: [] },
      prompt_policies: { data: [] }
    }
  },
  included: [
    {
      id: '383fb5e6-6c30-4641-9850-efeb3cdd77b8',
      type: 'tag',
      attributes: {
        tag_id: '383fb5e6-6c30-4641-9850-efeb3cdd77b8',
        name: 'Basic Tag'
      },
      relationships: {}
    }
  ],
  meta: {},
  links: {}
}

Go to Table of Contents

Get Prompt

Get details about a specific Prompt.

Prompt Id* (string)* required parameter

Document link

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

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    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.Prompts()
    .retreive('fab6e007-dab2-4245-907e-e1edf6f5f690')
    .then((response) => {
      console.log("*************** Retreive ***************");
      console.log(response);
    });
})();

Example of a successful API response

{
  data: {
    id: 'fab6e007-dab2-4245-907e-e1edf6f5f690',
    type: 'prompt',
    attributes: {
      prompt_id: 'fab6e007-dab2-4245-907e-e1edf6f5f690',
      organization_id: 'c68c07c9-d11a-4b54-8823-1dff6792916d',
      name: 'update the Prompt',
      description: 'Basic Prompt Description',
      created_at: '2021-10-10T15:28:29.026463+00:00',
      prompt_text: 'Endpoint Settings: Prompt Line',
      share_scope: 'ORGANIZATION_ONLY',
      ai_provider_approved: false,
      adults_only: false,
      ai_method: 'completion',
      ai_provider: 'OpenAI',
      default_engine: 'ada',
      status: 'ACTIVE',
      prompt_parameters: {
        basic_settings: {
          top_p: '1',
          stop_seq: [Array],
          max_tokens: '512',
          temperature: '1',
          presence_penalty: '1',
          frequency_penalty: '1'
        },
        advanced_settings: {
          n: '2',
          echo: true,
          stream: true,
          best_of: '5',
          logprobs: '10',
          logit_bias: []
        }
      },
      last_activity: null,
      share_name: null,
      share_description: '',
      share_placeholder: '',
      share_author_name: null,
      share_author_contact: '',
      share_type: null,
      share_allow_input: false,
      share_status: 'ACTIVE'
    },
    relationships: {
      intelets: { data: [] },
      tags: { data: [ [Object] ] },
      security_policies: { data: [] },
      prompt_policies: { data: [] }
    }
  },
  included: [
    {
      id: '383fb5e6-6c30-4641-9850-efeb3cdd77b8',
      type: 'tag',
      attributes: {
        tag_id: '383fb5e6-6c30-4641-9850-efeb3cdd77b8',
        name: 'Basic Tag'
      },
      relationships: {}
    }
  ],
  meta: {},
  links: {}
}

Go to Table of Contents

Delete Prompt

Delete a specific Prompt.

Prompt Id* (string)* required parameter

Document link



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

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    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.Prompts()
    .remove('fab6e007-dab2-4245-907e-e1edf6f5f690')
    .then((response) => {
      console.log("*************** Remove ***************");
      console.log(response);
    });
})();

/*
* run command
* node prompt/retreive.js
*/

Example of a successful API response

{}

Go to Table of Contents

Execute Prompt

Asynchronously submit a prompt by prompt_id. If successful, the status and results of the prompt can be retrieved from the /v1/prompt/result/{prompt_execution_id} endpoint by prompt_execution_id.

Prompt Id* (string)* required parameter

Input* (string)* Input for executing a prompt asynchronously

Document link

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

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    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 prompt_id = 'b1c01f1a-ff6c-45e8-8378-d23d11d7de9c';
  let input = 'This is my first test execute prompt';

  await mantiumAi.Prompts('OpenAI')
    .execute({
      id: prompt_id,
      input
    })
    .then(async (res) => {
      console.log("*************** Execute ***************");
      console.log(res);
    });
})();

Example of a successful API response

// *************** Execute ***************
{
  success: true,
  prompt_id: 'b1c01f1a-ff6c-45e8-8378-d23d11d7de9c',
  input: 'This is my first test execute prompt',
  status: 'QUEUED',
  prompt_execution_id: 'd96d6f42-05a3-4ae6-b846-a891af8a8635',
  error: '',
  warning_message: ''
}

Go to Table of Contents

Get Prompt Result

Returns execution status of a prompt ran through the prompt execution workflow asynchronously.

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

Document link

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

(async () => {
  await mantiumAi.Auth().accessTokenLogin({
    username: 'useremail@somedomain.com',
    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 prompt_id = 'b1c01f1a-ff6c-45e8-8378-d23d11d7de9c';
  let input = 'This is my second test execute prompt';

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

Example of a successful API response

// *************** Execute Result ***************
{
  prompt_execution_id: 'd96d6f42-05a3-4ae6-b846-a891af8a8635',
  prompt_id: 'b1c01f1a-ff6c-45e8-8378-d23d11d7de9c',
  status: 'COMPLETED',
  input: 'This is my second test execute prompt',
  output: "Endpoint Settings: Prompt LineThis is my second test execute prompt, but my last one worked fine. I thought this was rough except for Thoughtnet having doubts about working with it... I found another test which showed interaction with the NavigatorHelpers class. But, now my memory is terrible. Part of that may be hardware ghosting or at least faulty programming on bad servers.....I tried to use InsertPageName here only to find that didn't work though. So, if extra query pages fail because not everything's Showed in Page Name window, something cleantly isn't done.... Now the question is whether Thoughtnet will comply so they don't have to deal w/ weird loading times?????Edit: You can go straight off After powering up after this screen appearsoted by Admin using Command Prompt",
  error: '',
  reason: '',
  hitl_info: null,
  warning_message: ''
}

Go to Table of Contents

Logs

List Logs

Query Params

page (number) - Page number

size (number) - Page size. If not supplied, returns all the results in a single page for certain APIs.

after_date (string) - After Date

before_date (string) Before Date

log_type (string) LogType, An enumeration. [AUTH | DEFAULT | PROMPT | INTELET FILE]

log_level (string) Log Level

log_status (string) Log Status

Document link

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

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

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

  await mantiumAi.Logs().list({
      'page': 1,
      'size': 2
    })
    .then((response) => {
      console.log('*********** Logs list *********');
      console.log(response);
    });
})();

Example of a successful API response

// *********** Logs list *********
{
  data: [
    {
      id: 'log-some-long-id',
      type: 'log',
      attributes: {
        log_id: 'log-some-long-id',
        event_timestamp: '2021-10-15T13:55:57.468749+00:00',
        organization_id: 'organization-some-long-id',
        log_type: 'PROMPT',
        log_payload: [Object],
        log_level: 'INFO'
      },
      relationships: {}
    },
    {
      id: 'log-some-long-id',
      type: 'log',
      attributes: {
        log_id: 'log-some-long-id',
        event_timestamp: '2021-10-15T13:55:52.304732+00:00',
        organization_id: 'organization-some-long-id',
        log_type: 'PROMPT',
        log_payload: [Object],
        log_level: 'WARNING'
      },
      relationships: {}
    }
  ],
  included: [],
  meta: {},
  links: { total_items: 103, current_page: 1, next_page: 2 }
}

Go to Table of Contents

Get Log using ID url

Get details about a specific log.

Prompt Id* (string)* required parameter

Document link

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

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

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

  await mantiumAi.Logs().retrieveId('log-some-long-id')
    .then((response) => {
      console.log('*********** Log *********');
      console.log(response);
    });
})();

Example of a successful API response

{
  data: {
    id: 'bb65e751-9384-4239-a9e9-a29703e94de4',
    type: 'log',
    attributes: {
      log_id: 'bb65e751-9384-4239-a9e9-a29703e94de4',
      event_timestamp: '2021-10-15T13:55:57.468749+00:00',
      organization_id: 'c68c07c9-d11a-4b54-8823-1dff6792916d',
      log_type: 'PROMPT',
      log_payload: {
        to: 'completion',
        name: 'update the Prompt',
        error: '',
        input: 'This is my testing execute prompt',
        config: [Object],
        output: '. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test.\n' +
          'I have a new prompt line that I want to test.',
        status: 'COMPLETED',
        ai_app_id: null,
        ai_method: 'completion',
        direction: 'incoming',
        prompt_id: '29d46e2b-9d43-42cf-a1b0-edbf5db745dc',
        intelet_id: null,
        ai_provider: 'OpenAI',
        prompt_text: 'Updated new Prompt Line',
        warning_message: null,
        provider_response: [Object],
        input_character_length: 56
      },
      log_level: 'INFO'
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

Get Log

Get details about a specific log.

Prompt Id* (string)* required parameter

Document link

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

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

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

  await mantiumAi.Logs().retrieveId('log-some-long-id')
    .then((response) => {
      console.log('*********** Log *********');
      console.log(response);
    });
})();

Example of a successful API response

{
  data: {
    id: 'bb65e751-9384-4239-a9e9-a29703e94de4',
    type: 'log',
    attributes: {
      log_id: 'bb65e751-9384-4239-a9e9-a29703e94de4',
      event_timestamp: '2021-10-15T13:55:57.468749+00:00',
      organization_id: 'c68c07c9-d11a-4b54-8823-1dff6792916d',
      log_type: 'PROMPT',
      log_payload: {
        to: 'completion',
        name: 'update the Prompt',
        error: '',
        input: 'This is my testing execute prompt',
        config: [Object],
        output: '. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test. I have a new prompt line that I want to test.\n' +
          'I have a new prompt line that I want to test.',
        status: 'COMPLETED',
        ai_app_id: null,
        ai_method: 'completion',
        direction: 'incoming',
        prompt_id: '29d46e2b-9d43-42cf-a1b0-edbf5db745dc',
        intelet_id: null,
        ai_provider: 'OpenAI',
        prompt_text: 'Updated new Prompt Line',
        warning_message: null,
        provider_response: [Object],
        input_character_length: 56
      },
      log_level: 'INFO'
    },
    relationships: {}
  },
  included: [],
  meta: {},
  links: {}
}

Go to Table of Contents

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: 'useremail@somedomain.com',
    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 API 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: 'kedman1234@gmail.com',
        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: 'useremail@somedomain.com',
    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: 'useremail@somedomain.com',
    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 API 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: 'useremail@somedomain.com',
    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 API 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: 'useremail@somedomain.com',
    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 API 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: 'kedman1234@gmail.com',
      created_by_name: ' ',
      updated_at: '2021-10-18T10:42:57.048906+00:00',
      updated_by_email: 'kedman1234@gmail.com',
      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: 'useremail@somedomain.com',
    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 API 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: 'kedman1234@gmail.com',
      created_by_name: ' ',
      updated_at: '2021-10-18T10:42:57.048906+00:00',
      updated_by_email: 'kedman1234@gmail.com',
      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: 'useremail@somedomain.com',
    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 API 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: 'useremail@somedomain.com',
    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 API 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: 'useremail@somedomain.com',
    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 API 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