This repository has been archived by the owner on Jun 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
AI Engines
Kedar Vijay Kulkarni edited this page Oct 18, 2021
·
2 revisions
Get available AI engines
Get all of the configured and available AI engines
Query Params
-
Page
(number) Page number -
Size
(number) Page size. If not supplied, returns all the results in a single page for certain APIs.
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.AiEngines().all({ 'page': 1, 'size': 20 }).then((response) => {
console.log(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 }
}
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.
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
*/
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);
}
})();
// *********** 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 }
}
Get the details for a specific AI Engine
require: AI Engine name
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.AiEngines('ada').byName().then((response) => {
console.log(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: {}
}