Log prompt/generation speed of every LLM call in the Prefect log

llama.content() returns the message text and prints llama-server's timings
(prompt tokens + t/s, generated tokens + t/s); used by shots and report/memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pinokio
2026-11-02 15:55:20 +01:00
co-authored by Claude Opus 5.5
parent d9ec9c5b01
commit bc16b01232
3 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ def _ask(path, json_mode=True):
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + img}}]}]}
if json_mode: body["response_format"] = {"type": "json_schema", "json_schema": {"name": "shot", "schema": SCHEMA}} if SCHEMA else {"type": "json_object"}
req = urllib.request.Request(API, json.dumps(body).encode(), {"Content-Type": "application/json"})
return json.load(_open(req, timeout=900))["choices"][0]["message"]["content"]
return llama.content(json.load(_open(req, timeout=900)), f"shot {path.name}")
def read_shot(path):