• AI

LLM application development with Textual User Interface (TUI):

LLM application development

2023. 3. 22

The LLM based AI application project can be essentially a database and Textual User Interface app development project. AI searches, inserts, modifies, and deletes data within the system, and this is done based on a type of TUI implemented by an application programmer.

                               [START]
                                  |
                prediction        v         request
  +----------------+     +------------------+     +------------------+
  |                |<----|                  |---->|                  |
  |     LLM        |     |     Session      |     |    Workspace     |
  |                |---->|                  |<----|                  |
  +----------------+     +------------------+     +------------------+
                   action                   response
                            ...repeat...

In order to create an ‘LLM-based program’, you should create a Session and a Workspace.

Session

You will be responsible for structuring unstructured pricing data using the data cleansing program nuage.
Get your work done with nuage.

To use nuage you must respond in JSON.

{
  "command": <name of the command in string>,
  "input": <structured JSON for the command>,
  "log": <your log/opinion for the command execution (optional)>
}

The system displays the results of commands you previously executed and selectable options on the current page.
The command and its input format are displayed on the screen.
You must carry out the indicated tasks by executing selectable commands.

--------output---------
Welcome to nuage.
Total number of data points: 13022
Number of data points processed: 13019
Number of raw data points: 3

-------commands---------
listUnprocessedDataPoints()
  View the number of raw data points
exit()
  system shutdown

-----------------------
Waiting for input...

LLM

{
  "command": "listUnprocessedDataPoints",
  "input": {},
  "log": "Check raw data points to see which data is not yet structured."
}

Session

Execute the listUnprocessedDataPoints command.
--------output---------
nuage > Query raw data points


objects:
- id: 59221
  date: 2024-06-26
  source: lotte mart online mall
  raw: <!DOCTYPE html><head><ti...
- id: 59220
  date: 2024-06-26
  source: lotte mart online mall
  raw: <!DOCTYPE html><head><ti...
- id: 59219
  date: 2024-06-26
  source: lotte mart online mall
  raw: <!DOCTYPE html><head><ti...
pageInfo:
  currentPage: 1
  totalPage: 1

-------commands---------
startUnprocessedDataPointProcessing(id)
  Start processing of data points
back()
  Go back

-----------------------
Waiting for input...

LLM

{
  "command": "startUnprocessedDataPointProcessing",
  "input": {
    "id": 59221
  },
  "log": "Starting processing of the first raw data point (id: 59221)."
}

Session: - initiates and manages the conversation between LLM and the Workspace - checks the LLM’s response structure validity (JSON, YAML, etc.) handling the retries - and reports metrics

Workspace: - is a plain application server with the textual frontend. - The returning type is better to be also structured, because Session might have to care about the workspace server response.

Session

Server Error (500)

--------output---------
Sorry. Due to system maintenance, we are unable to process your request at this time.
Please log in again later.

-------commands---------
exit()
  system shutdown

-----------------------
Waiting for input...

LLM

{
  "command": "exit",
  "input": {},
  "log": "Terminating the task due to the server error"
}