This commit is contained in:
team3
2026-07-12 04:20:07 +02:00
parent 14bcf1b8e9
commit a284e03225
29 changed files with 866 additions and 329 deletions

View File

@@ -87,11 +87,12 @@ async def call(ctx: Kontext, *, stage: str, template: str, werte: dict,
versuch += 1
key = f"{ctx.topic}-{ctx.ebene}-{stage}-{item or 'x'}-{versuch}"
start = time.monotonic()
status, tokens, err, wait_ms = "error", None, "", 0
status, tokens, err, wait_ms, model = "error", None, "", 0, ""
try:
res = await _roher_call(key, prompt, timeout, ctx, role, caps)
tokens, err = res.tokens, res.err
wait_ms = int(res.wait_s * 1000)
model = res.model
if res.ok:
if erwartet is str:
status = "ok"
@@ -112,7 +113,7 @@ async def call(ctx: Kontext, *, stage: str, template: str, werte: dict,
finally:
ledger.log_call(ctx.run_id, ebene=ctx.ebene, stage=stage, item=item,
template=template, template_hash=thash, role=role,
provider=ctx.provider, status=status,
provider=ctx.provider, model=model, status=status,
dur_ms=int((time.monotonic() - start) * 1000),
wait_ms=wait_ms,
tokens=tokens, meta={"err": err[:300]} if err else None)