Supista
Contact Us
documentation
Supista ERP
Samples
AI Operations

AI Operation

The askAI() function is used to send structured data, files, and prompts to an AI model within the ERP system via the AgenticAI service.

It enables automated reasoning, analysis, and natural language processing on ERP data, allowing the system to generate intelligent insights, comparisons, or summaries.


Function Signature

askAI(data)

Parameters

data

  • Type: object
  • Required: ✅ Yes

Description: Contains all the necessary information to invoke the AI model, including the agent ID, model to be used, input data arrays, files, and optional user prompts.


Parameter Reference Table

ParameterTypeRequiredDescription
agentIDstringYesUnique identifier of the agent configured within AgenticAI. Defines the AI context or workflow.
modelIDstringYesSpecifies which AI model should be used for reasoning. Example: claude-3.7, claude-4, claude-3.5.
filesarrayOptionalArray of file IDs (previously uploaded) that the AI should consider during reasoning. Useful for document-based prompts.
inputsarrayYesCore data sent to the AI model. Can include rows, quotations, line items, or any structured JSON objects.

Detailed Field Breakdown

🔹 data.agentID

  • Type: string
  • Required: ✅ Yes

Description: The unique identifier of the AI agent registered in the ERP system. This ID determines which AI workflow or context should process the request.


🔹 data.modelID

  • Type: string
  • Required: ✅ Yes

Description: Specifies which AI model should handle the request.

Supported models may include:

  • claude-4
  • claude-3.7
  • claude-3.5
  • claude-3

🔹 data.files

  • Type: array
  • Required: Optional

Description: (Optional) Array of file IDs that should be considered by the AI model.

These files can contain additional context such as:

  • PDFs
  • Technical documents
  • Quotation files

🔹 data.inputs

  • Type: array
  • Required: ✅ Yes

Description: An array of structured data objects (rows, quotations, or line items) sent to the AI for analysis or reasoning.

This forms the core contextual input for the AI operation.


Return Value

  • Type: Promise

Description: Resolves with the AI model’s generated output.

The returned object contains:

  • The AI’s response
  • The model used
  • Execution details

Example Usage

async function customizeERP(userData, apiOperations) {
 
  const askAiPayload = {
    agentID: "3b820f83-ffb6-4716-b970-ddb7778b5862",
    modelID: "claude-4",
    inputs: [ row ],
    files: []
  };
 
  const askAIData = await askAI(askAiPayload);
 
  return {
    result: askAIData
  };
 
}
Last updated on
Transform Data into Decisions with Supista – Your Intelligent Data Partner
AI Procurement Auditor for Procure-to-Pay

Automate your daily operations. Scale your company with confidence.

Discover the gaps, risks, and inefficiencies in your procure-to-pay cycle. Book a free session with our Automation Experts and uncover how AI can transform your operations end-to-end.