Batches: OpenAI's Files and Batch APIs, served at the lowest priority under a store lease, each line a request of the key that made it
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
889be70b8f
commit
841ee21c12
19 files changed
+1775
-10
No files matched your search
@@ -0,0 +1,55 @@
|
||||
-- The Files and Batch APIs. A file is what a client uploaded (a batch's
|
||||
-- requests) or what a batch wrote (its answers, its errors), owned by the
|
||||
-- project of the key that made it. A batch is a file of requests served one
|
||||
-- by one at the lowest priority; each finished line is kept as it is
|
||||
-- served, so a batch survives the control plane restarting under it, and
|
||||
-- the lease says which gateway is working on it.
|
||||
CREATE TABLE files (
|
||||
id TEXT PRIMARY KEY,
|
||||
owner TEXT NOT NULL,
|
||||
purpose TEXT NOT NULL,
|
||||
filename TEXT NOT NULL,
|
||||
bytes INTEGER NOT NULL,
|
||||
content BLOB NOT NULL,
|
||||
created_at INTEGER NOT NULL,
|
||||
expires_at INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX files_owner ON files (owner, created_at);
|
||||
|
||||
CREATE TABLE batches (
|
||||
id TEXT PRIMARY KEY,
|
||||
owner TEXT NOT NULL,
|
||||
key_id TEXT NOT NULL,
|
||||
endpoint TEXT NOT NULL,
|
||||
input_file_id TEXT NOT NULL,
|
||||
completion_window TEXT NOT NULL,
|
||||
status TEXT NOT NULL,
|
||||
output_file_id TEXT NOT NULL DEFAULT '',
|
||||
error_file_id TEXT NOT NULL DEFAULT '',
|
||||
total INTEGER NOT NULL DEFAULT 0,
|
||||
completed INTEGER NOT NULL DEFAULT 0,
|
||||
failed INTEGER NOT NULL DEFAULT 0,
|
||||
created_at INTEGER NOT NULL,
|
||||
in_progress_at INTEGER NOT NULL DEFAULT 0,
|
||||
finalizing_at INTEGER NOT NULL DEFAULT 0,
|
||||
completed_at INTEGER NOT NULL DEFAULT 0,
|
||||
failed_at INTEGER NOT NULL DEFAULT 0,
|
||||
expired_at INTEGER NOT NULL DEFAULT 0,
|
||||
cancelling_at INTEGER NOT NULL DEFAULT 0,
|
||||
cancelled_at INTEGER NOT NULL DEFAULT 0,
|
||||
expires_at INTEGER NOT NULL,
|
||||
metadata TEXT NOT NULL DEFAULT '',
|
||||
errors TEXT NOT NULL DEFAULT '',
|
||||
lease_owner TEXT NOT NULL DEFAULT '',
|
||||
lease_until INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX batches_owner ON batches (owner, created_at);
|
||||
CREATE INDEX batches_status ON batches (status, lease_until);
|
||||
|
||||
CREATE TABLE batch_results (
|
||||
batch_id TEXT NOT NULL,
|
||||
line INTEGER NOT NULL,
|
||||
ok INTEGER NOT NULL,
|
||||
data TEXT NOT NULL,
|
||||
PRIMARY KEY (batch_id, line)
|
||||
);
|
||||
Reference in new issue
Block a user