Omniscope Custom Blocks › Connectors/AI-Chat-DeepSeek

AI Chat - DeepSeek

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

Code & AI Python

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

Omniscope custom block · Connectors

Expense claims described in everyone's own words? A DeepSeek category per claim, added beside the amount, ready to total.

Python · openai, pandas · openai installed on first run

The problem it solves

Expense claims arrive with a free-text description: "Taxi from station to supplier's warehouse", "Team breakfast before planning day". To report spend per category, each one needs a category, and finance staff end up re-keying them.

This block sends each description to DeepSeek with the list of categories and writes the category beside the claim, so amounts can be totalled per category and the odd ones reviewed.

How it works

What goes in

Expense claims

10 invented expense claims from five employees.

Claim Employee Date Amount Description
EX-7001 A. Fairweather 2025-06-02 48.6 Return train Leeds to York for client workshop
EX-7002 A. Fairweather 2025-06-02 23.15 Lunch with client team at workshop
EX-7003 B. Okafor 2025-06-03 129.0 Hotel, one night, Bristol, for site audit
EX-7004 B. Okafor 2025-06-04 12.99 Printer paper and toner refill for home office
EX-7005 C. Hughes 2025-06-05 19.0 Monthly subscription, diagram drawing tool
EX-7006 C. Hughes 2025-06-06 350.0 One-day spreadsheet modelling course

10 rows in the sample file. The Instruction field holds the same text on every row: "Classify this expense claim into one category: Travel, Accommodation, Meals, Office supplies, Software, Training or Other. Reply with the category only."

The options

Option Demo setting What it does
DeepSeek API key (your key) A key from the DeepSeek platform.
Model deepseek-flash The DeepSeek model ID.
User prompt field Description The claim's description, sent for each record.
System prompt field Instruction The instruction and the seven categories.
Temperature (empty) The model's default (no effect while the model is thinking).
Maximum response length (tokens) (empty) DeepSeek's default.
Requests at a time 4 How many requests are sent at once.

What comes out

Replies (selected fields)

Claim Amount Description Response Truncated
EX-7001 48.6 Return train Leeds to York for client workshop Travel false
EX-7002 23.15 Lunch with client team at workshop Meals false
EX-7003 129.0 Hotel, one night, Bristol, for site audit Accommodation false
EX-7004 12.99 Printer paper and toner refill for home office Office supplies false
EX-7005 19.0 Monthly subscription, diagram drawing tool Software false
EX-7006 350.0 One-day spreadsheet modelling course Training false
EX-7007 7.5 Parking at Manchester Piccadilly Travel false
EX-7008 31.4 Taxi from station to supplier's warehouse Travel false
EX-7009 15.0 Flowers for a colleague's leaving card Other false
EX-7010 54.2 Team breakfast before quarterly planning day Meals false

10 records in all, with every input field kept.

Where it pays off

Finance: Expense and transaction coding

Suggest a category or nominal code for each claim or card transaction, for a person to confirm.

Procurement: Spend categories

Classify purchase order lines into a spend taxonomy, to see spend per category and supplier.

IT service: Ticket routing

Assign each incoming ticket to a team from its description.

Research: Coding open answers

Give each open survey answer a code from a fixed code frame, for counting.

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

Expense claims (File or database) → Filter (this month) → AI Chat - DeepSeek → Validate data (Response is one of the seven categories) → Aggregate (Amount per Response and Employee) → Report

Filter the input to new claims 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 - DeepSeek 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: how much was spent on each kind of expense?
  3. Follow the File block into the rest of the workflow: Amount totalled per category (Travel: 87.50 over three claims, Meals: 77.35 over two).
  4. To use it with your own data: enter a DeepSeek API key in the AI Chat - DeepSeek 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, which DeepSeek's OpenAI-compatible API also works with, 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 DeepSeek 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
DeepSeek API keyPasswordA key from https://platform.deepseek.com/api_keys. Usage is billed to its DeepSeek account.
ModelTextThe model ID, as listed at https://api-docs.deepseek.com/quick_start/pricing, for example deepseek-flash or deepseek-v4-pro.
TemperatureNumberOptional, 0 to 2. Lower values make replies more consistent, higher values more varied. Leave empty to use the model's default. DeepSeek ignores it while the model is thinking, which is on by default.
Maximum response length (tokens)Whole numberOptional. The most tokens each reply may use; in thinking mode this includes the reasoning. A token is roughly three-quarters of a word. Replies that reach the limit are cut short and marked in the Truncated field. Empty: DeepSeek'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.

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.