feat: browser access (allowed_origins, CORS with Private Network Access), job cancel, Tomie/Unity adapters, benchmark
Includes earlier uncommitted work: Tomie and Unity adapters, benchmark, structured output, call metrics. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
13492929c6
commit
f49ee90477
32 files changed
+2799
-51
No files matched your search
@@ -10,7 +10,7 @@ from .provider import Provider, ProviderError
|
||||
from .storage import encode
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
PROMPT_VERSION = 2
|
||||
PROMPT_VERSION = 3
|
||||
|
||||
|
||||
class Engine:
|
||||
@@ -78,7 +78,7 @@ class Engine:
|
||||
self.storage.item_result(identity, item["position"], "completed", cached, cached=True)
|
||||
else:
|
||||
pending.append(item)
|
||||
while pending:
|
||||
while pending and self.storage.job_state(identity) != "cancelled":
|
||||
batch, size = [], 0
|
||||
while pending and len(batch) < options["batch_size"]:
|
||||
item = pending[0]
|
||||
@@ -112,10 +112,13 @@ class Engine:
|
||||
for item in remaining:
|
||||
item["attempts"] += 1
|
||||
error = "Model omitted the item or returned a duplicate ID"
|
||||
call_error = None
|
||||
try:
|
||||
output = await provider.translate(model, project, [{"id": item["id"], "text": protected[item["id"]].text} for item in remaining])
|
||||
except ProviderError as exc:
|
||||
output, error = {}, str(exc)
|
||||
call_error = str(exc)
|
||||
self.storage.record_call(identity, len(remaining), getattr(provider, "last_metrics", {}), call_error)
|
||||
failed = []
|
||||
for item in remaining:
|
||||
item_error = error
|
||||
|
||||
Reference in new issue
Block a user