BatchAi.h header

#include <ew/app/BatchAi.h>

Namespace ew::app

BatchItem struct

struct ew::app::BatchItem

One target of a batch AI command: a stable id, a human-readable label (for the results view), and the input text the command runs on.

Members

QString ew::app::BatchItem::id

A stable id (e.g. a content id) identifying the target.

QString ew::app::BatchItem::label

A human-readable label shown in the results.

QString ew::app::BatchItem::input

The text the command runs on.

BatchResult struct

struct ew::app::BatchResult

The outcome of running a command on one BatchItem.

Members

QString ew::app::BatchResult::id

The originating item's id.

QString ew::app::BatchResult::label

The originating item's label.

bool ew::app::BatchResult::ok = false

True when the model produced output; false when the call errored.

QString ew::app::BatchResult::output

The model's output (when ok).

QString ew::app::BatchResult::error

A human-readable error (when not ok).

TokenUsage ew::app::BatchResult::usage {}

The tokens the model reported for this item's call (zero when unreported).

bool operator==(const BatchResult &, const BatchResult &)=default

Results compare equal when every field matches.

ChainResult struct

struct ew::app::ChainResult

The outcome of running a chain of commands over one starting text.

Members

bool ew::app::ChainResult::ok = false

True when every command succeeded; false when a step errored.

QString ew::app::ChainResult::finalOutput

The last command's output (when ok).

std::vector<QString> ew::app::ChainResult::steps

Each command's output, in order, for transparency (empty past the failing step).

QString ew::app::ChainResult::error

A human-readable error (when a step failed).

TokenUsage ew::app::ChainResult::usage {}

The tokens summed across every step that ran (zero when unreported).

Functions

std::vector< BatchResult > ew::app::runBatchCommand(AiProvider &provider, const PromptCommand &command, const std::vector< BatchItem > &items)

Runs command on each of items independently through provider, collecting one BatchResult per item in the same order. Each item's input is applied via the command's instruction (an AiPrompts rewrite request). Blocking (it drives the provider once per item), so call it off the GUI thread with a value copy of items so a background task owns its data.

ChainResult ew::app::runCommandChain(AiProvider &provider, const std::vector< PromptCommand > &commands, const QString &initialText)

Runs commands in order over initialText, feeding each command's output as the next command's input, and stopping at the first error. Returns the final output plus each step's output. Blocking; call off the GUI thread.