Signature

global static List<QueryDocumentBatch.FlowOutput> execute(
  List<QueryDocumentBatch.FlowInput> inputs
)
Parameters
ParameterDescription
inputs
List<QueryDocumentBatch.FlowInput>
requiredOne entry per document or dataset to query, each with its list of prompts. Every prompt in every entry is sent in one request. See the field breakdown below.

FlowInput

FlowInput
ParameterDescription
processedDocumentId
String
optionalId of the processed document to query. Set this or datasetId.
datasetId
String
optionalId of the dataset to query. Set this or processedDocumentId.
agent
String
optionalOptional agent to run the queries with.
prompts requiredThe questions to ask, one per prompt.

FlowOutput

FlowOutput
ParameterDescription
prompts The prompts from the matching input, each with result set to the answer.

Return Type

List<QueryDocumentBatch.FlowOutput>. One output per input, in the same order. Each output holds the same prompts you passed in, with result filled in with the answer.

Example

cldfs.QueryDocumentPrompt total = new cldfs.QueryDocumentPrompt();
total.id = 'total';
total.query = 'What is the invoice total?';

cldfs.QueryDocumentPrompt dueDate = new cldfs.QueryDocumentPrompt();
dueDate.id = 'dueDate';
dueDate.query = 'When is the payment due?';

cldfs.QueryDocumentBatch.FlowInput input = new cldfs.QueryDocumentBatch.FlowInput();
input.processedDocumentId = '68f1c2a9e4b0d35a7c9e1f21';
input.prompts = new List<cldfs.QueryDocumentPrompt>{ total, dueDate };

List<cldfs.QueryDocumentBatch.FlowOutput> outputs = cldfs.QueryDocumentBatch.execute(
  new List<cldfs.QueryDocumentBatch.FlowInput>{ input }
);
for (cldfs.QueryDocumentPrompt prompt : outputs[0].prompts) {
  System.debug(prompt.id + ': ' + prompt.result);
}
SynchronousThe answers come back in the same call, so this method makes a callout and the usual Apex callout limits apply: call it before any DML in the transaction, or from an asynchronous context. To ask one question, or to build the queries yourself, use Query Document.