llmage/wwwroot/test_llm_charging.dspy
2026-04-08 17:28:32 +08:00

14 lines
415 B
Plaintext

luid=params_kw.luid
env = request._run_ns
async with get_sor_context(env, 'llmage') as sor:
sql = "select a.ppid, b.* from llm a, llmusage b where a.id=b.llmid and b.id=${id}$"
recs = await sor.sqlExe(sql, {'id': luid})
if recs:
r = recs[0]
debug(f'{luid=}, {r.usages=}')
x = await llm_charging(r.ppid, r)
return x
return {'sql': sql, 'luid': luid, 'error': 'llm not found'}
return {
'error': 'error'}