Omniscope Custom Blocks › Connectors/OpenAI-GPT

AI Chat - OpenAI GPT

Sends a prompt from each record to an OpenAI model and adds the reply as a Response field. Uses your own OpenAI API key.

Code & AI Python

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

Omniscope custom block · Connectors

Hundreds of product reviews, and the question is what they are about? One GPT reply per review, added beside the stars, ready to count.

Python · openai, pandas · openai installed on first run

The problem it solves

Star ratings say how happy customers are, not why. The reason is in the review text, and nobody reads a thousand reviews a month closely enough to count the reasons.

This block sends each review to an OpenAI model with one instruction, "name the main topic in two to four words", and writes the topic beside the review, so topics can be counted against the stars.

How it works

What goes in

Product reviews

10 invented reviews from an outdoor equipment shop.

Review Product Stars Text
R-201 Trail headlamp 5 Brilliant beam and it lasted a whole weekend of night walks on one charge.
R-202 Trail headlamp 2 The strap stretched after a week and now it slips down my forehead.
R-203 Insulated flask 4 Keeps tea hot all day, though the lid is fiddly with gloves on.
R-204 Insulated flask 1 Arrived dented and the box was soaked. Took nine days to come.
R-205 Folding stove 5 Packs down tiny and boils half a litre in about three minutes.
R-206 Folding stove 3 Works fine but the instructions are confusing and miss a step.

10 rows in the sample file. The Instruction field holds the same text on every row: "Name the main topic of this product review in two to four words, for example 'battery life' or 'delivery speed'. Reply with the topic only, in lower case."

The options

Option Demo setting What it does
OpenAI API key (your key) A secret key from the OpenAI platform.
Model gpt-6-luna The OpenAI model ID.
User prompt field Text The review text sent for each record.
System prompt field Instruction The instruction: name the main topic in two to four words.
Temperature (empty) The model's default; current GPT models accept no other while reasoning.
Maximum response length (tokens) (empty) No limit beyond the model's own.
Requests at a time 4 How many requests are sent at once.

What comes out

Replies (selected fields)

Review Product Stars Response Truncated
R-201 Trail headlamp 5 battery life false
R-202 Trail headlamp 2 strap durability false
R-203 Insulated flask 4 lid design false
R-204 Insulated flask 1 delivery damage false
R-205 Folding stove 5 size and speed false
R-206 Folding stove 3 instructions false
R-207 Rain jacket 4 waterproofing false
R-208 Rain jacket 2 sizing false
R-209 Trekking poles 5 build quality false
R-210 Trekking poles 3 price false

10 records in all, with every input field kept.

Where it pays off

Retail and e-commerce: Why reviews are low

Topic per review, averaged against stars, shows which problems drag ratings down.

Product teams: Feature requests

Pull the feature asked for out of feedback forms, and count requests per feature.

HR and internal surveys: Open comments

Turn "anything else?" answers into a short list of themes per department.

Marketing: Campaign replies

Classify replies to a campaign as interested, not interested or out of office.

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

Reviews (File or database) → Filter (last week's reviews) → AI Chat - OpenAI GPT → Validate data (Response not empty) → Aggregate (reviews and average Stars per Response) → Report

Filter the input to new reviews first: every run sends every record with a prompt again.

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 - OpenAI GPT block (unconfigured: no API key), and a File block with placeholder.csv: the sample records with the replies the block writes for them.
  2. The question: what are the low-rated reviews about?
  3. Follow the File block into the rest of the workflow: reviews per topic with their stars; the two two-star reviews are about strap durability and sizing.
  4. To use it with your own data: enter an OpenAI API key in the AI Chat - OpenAI GPT 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, 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 OpenAI replies (no live calls): the sample data, the request sent (model, system prompt, temperature and maximum length only when set), 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, and 400 records sent several at a time. 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
OpenAI API keyPasswordA secret key from https://platform.openai.com/api-keys. Usage is billed to its OpenAI account.
ModelTextThe model ID, as listed at https://developers.openai.com/api/docs/models, for example gpt-6-luna or gpt-6.1-sol. It must support the Chat Completions API.
TemperatureNumberOptional, 0 to 2. Lower values make replies more consistent, higher values more varied. Leave empty to use the model's default. Current GPT models accept a temperature only when reasoning is switched off, so leave it empty for them.
Maximum response length (tokens)Whole numberOptional. The most tokens each reply may use, including the model's hidden reasoning, so a low limit can leave the reply empty. 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 model's own maximum.
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.

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.