Skip to content

AI Services

AI Services allow Lowgile applications to work with Large Language Models (LLMs) and AI providers.

Typical AI use cases include:

  • Extracting structured information from documents,
  • Processing emails and attachments,
  • Analyzing PDFs and images to extract structured data,
  • Generating summaries or text output,
  • Executing AI-assisted workflow automation, and
  • Integrating AI-driven business functionality into applications.

AI services are typically configured once and then reused across workflows, integrations, and application logic.

Most AI integrations follow a similar execution flow:

Figure 1:

Typical AI service execution flow.

AI services usually reference a reusable configuration item such as:

The configuration item contains:

  • Provider type,
  • Deployment configuration,
  • Authentication settings,
  • Runtime options, and
  • Tracing configuration.

AI services can return structured output instead of unstructured plain-text responses.

Instead of returning loosely formatted text that applications cannot reliably process, AI services can generate predictable structured data that workflows, entities, screens, and automation logic can work with directly.

Structured responses are useful when applications need to:

  • Populate entities,
  • Extract business data,
  • Process workflow decisions,
  • Parse uploaded documents, or
  • Continue workflow or automation processing.

Example structured extraction flow:

const ai = new SimpleAI(This.$Config.AiConnection);
const result = await ai.queryAndReturnStructured({
prompt: "Extract the supplier name and invoice total",
files: [uploadedPdf]
});

Insight

In the function queryAndReturnStructured, Lowgile internally converts the AI response into structured application data.

Common structured extraction scenarios include:

  • Reading materials from technical drawings,
  • Extracting values from uploaded PDFs,
  • Parsing incoming email attachments, and
  • Identifying entities or business data from unstructured documents.

AI services can expose tools that allow AI models to request additional information during execution.

Runtime tools are commonly used to:

  • Retrieve ERP or database information,
  • Execute application logic,
  • Access external systems,
  • Enrich AI-generated output, and
  • Support advanced automation scenarios.

Example runtime tool:

ai.addTool({
name: "getSupplierLeadTime",
description: "Returns the expected lead time for a supplier",
inputSchema: {
supplierId: "string"
},
execute: async ({ supplierId }) => {
const supplier = await This.DB.Supplier.findOne({ id: supplierId });
return supplier.leadTimeDays;
}
});

AI services can process runtime file content such as:

  • PDFs,
  • Images,
  • Email attachments,
  • Uploaded files, and
  • Generated documents.

Before AI models can analyze file content, files are often converted into runtime formats that the AI service can process more reliably.

Common runtime formats include:

  • Images for visual analysis,
  • Buffers for binary file processing, and
  • Structured data formats such as JSON or XML.

This allows AI services to:

  • Analyze documents and images,
  • Extract structured business data,
  • Parse uploaded files and attachments, and
  • Continue workflow or automation processing based on the extracted information.

Key Takeaway

AI configuration items keep provider settings and credentials separate from application logic. This makes AI integrations easier to reuse and maintain.