Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.
Kedar Vijay Kulkarni edited this page Oct 18, 2021 · 2 revisions

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('mantiumclient-js');

(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 completion 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('mantiumclient-js');

(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 completion 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('mantiumclient-js');

(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 completion 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

Clone this wiki locally