Omniscope Custom Blocks › Connectors/AI-Chat-Local-LLM

AI Chat - Local LLM

Sends a prompt from each record to a language model on your own server, through an OpenAI-compatible endpoint, and adds the reply as a Response field.

Code & AI Python

Open the demo in Omniscope Download demo.ioz Sample data: exit-comments.csv Sample data: placeholder.csv Source on GitHub

Omniscope custom block · Connectors

Free-text comments too sensitive to send to a cloud service? A reply per record from a model on your own network, added beside the comment.

Python · openai, pandas · openai installed on first run

The problem it solves

Exit surveys ask leavers why they are going, and the honest answer is in the free-text comment. Those comments name managers and colleagues; HR may not be allowed to send them to an outside service, so they are read one by one, or not at all.

This block sends each comment to a model running on a machine you control, with the list of reasons to choose from, and writes the reason beside the comment, so leavers' reasons can be counted per department.

How it works

What goes in

Exit survey comments

10 invented exit-survey responses from five departments.

Survey ID Department Leaving Date Comment
X-301 Finance 2025-01-31 I was offered the same role elsewhere for noticeably more money.
X-302 Warehouse 2025-02-14 Shifts kept getting longer and cover was never arranged when people were off.
X-303 Customer Service 2025-02-28
X-304 IT 2025-03-07 After four years I could not see a route to a senior post here.
X-305 Warehouse 2025-03-21 My family is moving to Scotland in the summer.
X-306 Marketing 2025-04-04 My line manager rarely gave feedback and cancelled most one-to-ones.

10 rows in the sample file. The Instruction field holds the same text on every row: "You read comments from staff exit surveys. Give the main reason for leaving as one of: Pay, Career progression, Manager, Workload, Relocation, Other. Reply with the reason only."

The options

Option Demo setting What it does
Endpoint http://localhost:8080/v1 The model server's OpenAI-compatible address.
API key (empty) Only if the server asks for one.
Model LLaMA_CPP The model name the server expects.
User prompt field Comment The comment sent for each record.
System prompt field Instruction The instruction and the six reasons.
Temperature (empty) The server's default.
Maximum response length (tokens) (empty) The server's default.
Requests at a time 1 One request at a time, as most local servers answer.

What comes out

Replies (selected fields)

Survey ID Department Comment Response Truncated
X-301 Finance I was offered the same role elsewhere for noticeably more money. Pay false
X-302 Warehouse Shifts kept getting longer and cover was never arranged when people were off. Workload false
X-303 Customer Service
X-304 IT After four years I could not see a route to a senior post here. Career progression false
X-305 Warehouse My family is moving to Scotland in the summer. Relocation false
X-306 Marketing My line manager rarely gave feedback and cancelled most one-to-ones. Manager false
X-307 Finance I am going back to university full-time. Other false
X-308 Customer Service Too many calls per hour and no time to follow anything up properly. Workload false
X-309 IT The pay review was frozen two years running. Pay false
X-310 Marketing I wanted to lead campaigns and that was not going to happen soon. Career progression false

10 records in all, with every input field kept. X-303 has no comment, so it was not sent and its Response is empty.

Where it pays off

HR: Exit and engagement surveys

Code free-text answers into reasons or themes without the comments leaving the organisation.

Healthcare and care services: Incident notes

Classify incident or complaint notes that contain personal details, on a server inside the network.

Legal and finance: Confidential documents

Summarise or tag contract clauses and case notes that may not go to a cloud service.

Offline and air-gapped sites: AI without internet

Run the same text tasks on a server with no internet connection at all.

Use cases describe typical scenarios and are illustrative; the sample data is invented.

Why do this in Omniscope

How it fits into an Omniscope workflow

Exit survey export (File or database) → AI Chat - Local LLM → Validate data (Response is one of the six reasons, or empty) → Aggregate (leavers per Response and Department) → Report

Every run sends every record with a prompt again; filter the input to new responses first.

Try it

  1. Open the demo project (demo.iox on the demo server, or import demo.ioz from this folder). It holds the AI Chat - Local LLM block (unconfigured: the endpoint is empty), and a File block with placeholder.csv: the sample records with the replies the block writes for them.
  2. The question: why are people leaving, and does it differ by department?
  3. Follow the File block into the rest of the workflow: leavers per reason and department (Pay 2, Workload 2, Career progression 2, Relocation 1, Manager 1, Other 1, and one with no comment).
  4. To use it with your own data: start a model server with an OpenAI-compatible API, enter its endpoint and model name in the AI Chat - Local LLM block, connect your records and choose the prompt and instruction fields, run it, and connect its Replies output where the File block was.

Running in Omniscope

Omniscope workflow
Omniscope workflow

The demo project's workflow: the placeholder data, the block, and a Validate data check on the output.

Language and libraries

Python. It uses the openai package (Apache License 2.0), OpenAI's Python SDK, used here only as a client for OpenAI-compatible servers, and pandas (BSD 3-Clause).

pandas is part of Omniscope's Python environment. openai is listed in the block's dependencies, so Omniscope installs it with pip on first run if it is missing.

Tested

The block is covered by automated tests that run its script against a stand-in for Omniscope's Python API and invented model server replies (no live calls): the sample data, the request sent (model, system prompt, temperature and maximum length only when set, no API key needed), an optional system prompt, empty and missing prompts, numbers and dates as prompts, the input's fields kept, an existing Response field, empty input, replies cut short, failed requests (a refused key and an unknown model), option checks, 400 records sent several at a time, and one request at a time by default. With the real openai package installed, further tests let it build the HTTP requests and read the canned replies.

Reference

Fields it reads

NameTypeWhat it does
User prompt fieldFieldThe field holding each record's prompt: the instruction and the text to work on. Build it with a Formula block if it combines several fields. Numbers and dates are sent as text; records with an empty prompt are not sent.
System prompt fieldFieldOptional. A field holding instructions that set the model's role, rules and answer format, for example "Reply with one category only: Billing, Delivery or Other". Usually the same text on every record.

Options

NameTypeWhat it does
EndpointTextThe base address of an OpenAI-compatible API, usually ending in /v1, for example http://localhost:8080/v1 (llama.cpp, llamafile) or http://localhost:11434/v1 (Ollama). Resolved on the Omniscope server.
API keyPasswordOptional. Only if your server asks for one; most local servers don't.
ModelTextThe model name your server expects, for example the name listed by its /v1/models page. Servers that hold one model (llama.cpp, llamafile) accept any name.
TemperatureNumberOptional, 0 to 2. Lower values make replies more consistent, higher values more varied. Leave empty to use the model's default. Some servers cap it at 1 or ignore it.
Maximum response length (tokens)Whole numberOptional. The most tokens each reply may use. A token is roughly three-quarters of a word. Replies that reach the limit are cut short and marked in the Truncated field. Empty: the server's default.
Requests at a timeWhole numberHow many requests are sent at the same time, 1 to 16. Higher finishes large inputs sooner; lower it if the service reports a rate limit. Most local servers answer one request at a time unless set up for more.

Outputs

OutputWhat it holds
RepliesThe input records with two fields added: Response (the model's reply) and Truncated (true if the reply stopped at the maximum response length). Records with an empty prompt have both empty.