Batches
Many users at once: one ask each, followed together.
GET/v1/batches/{batch_id}/itemsEach item with its task id and result.
Request3 fields
Path
batch_idstringrequiredThe batch's id (bat_...).
- Type
string
Query
limitintegerHow many items per page, 1 to 100. Default 20.
- Type
integer
cursorstringWhere to go on from: the next_cursor of the page before, unchanged. Absent: the first page.
- Type
string
Answers 2002 fields
dataobject[]The items on this page.
object"batch.item"Always batch.item.
- Type
"batch.item"
indexintegerWhere it was in the items you sent, from 0.
- Type
integer
user_idstring | nullYour id for its user; null on your company's own Bash.
- Type
string | null
status"queued" | "running" | "succeeded" | "failed" | "cancelled"queued: not started yet. running: its conversation is working. succeeded or failed: it has finished. cancelled: the batch was cancelled before it started.
- Type
"queued" | "running" | "succeeded" | "failed" | "cancelled"
conversation_idstring | nullThe conversation it runs in (conv_...); null until it starts.
- Type
string | null
task_idstring | nullThe work it started (task_...); null until it starts work.
- Type
string | null
resultobject | nullWhat it came to, once it succeeded; null before, and when it failed.
replystring | nullWhat Bash said when it took the item: an item goes straight to work, so this is the one line Started work on it. The work's answer is text.
- Type
string | null
textstring | nullThe work's answer: its final reply, the words of its last step that said anything. Null when the item did not go to work (its reply is the answer then) or the work ended with no final reply.
- Example
Your flight 6E 2134 is on time.
dataany | nullData the work returned for an output_schema; null when it returned none.
- Type
any | null
outcomeobject | nullWhether it met its success criteria; null when there were none.
- Type
object | null
errorobject | nullWhy it failed; null unless it did.
codestringA stable code to branch on.
- Type
string
messagestringWhat went wrong, in plain words.
- Type
string
metadatamap of stringYour labels for this item, as you sent them.
- Type
map of string
created_atstringWhen the batch was made, as an ISO 8601 time.
- Type
string
finished_atstring | nullWhen it finished, as an ISO 8601 time; null until then.
- Type
string | null
next_cursorstring | nullSend it as cursor for the next page; null on the last page.
- Type
string | null
const batch = vestra.ask([{ user: 'traveller-42', message: 'Is your flight hit by the storm?' }]);const results: unknown[] = [];for await (const item of batch.items()) results.push(item.result);batch = vestra.ask([{"user": "traveller-42", "message": "Is your flight hit by the storm?"}])results = [item.result for item in batch.items()]vestra events bat_7xk# Its status and counts, then each item's text: the work's answer.curl "$VESTRA_BASE_URL/v1/batches/bat_7xk" \ -H "Authorization: Bearer $VESTRA_API_KEY" curl "$VESTRA_BASE_URL/v1/batches/bat_7xk/items" \ -H "Authorization: Bearer $VESTRA_API_KEY"No sample in your language for this route, so here it is over HTTP.
# Its status and counts, then each item's text: the work's answer.curl "$VESTRA_BASE_URL/v1/batches/bat_7xk" \ -H "Authorization: Bearer $VESTRA_API_KEY" curl "$VESTRA_BASE_URL/v1/batches/bat_7xk/items" \ -H "Authorization: Bearer $VESTRA_API_KEY"