langfuse generation spans with token usage; switch llm to vllm (qwen2.5-coder-7b on mcrndeb)
This commit is contained in:
@@ -43,11 +43,13 @@ async def decide_next(question: str, metric: str, dimensions: list[str],
|
||||
history=format_history(slices),
|
||||
budget=budget,
|
||||
)
|
||||
with lf.span("drill_down.next", as_type="generation", input={"budget": budget}) as span:
|
||||
with lf.span("drill_down.next", input={"budget": budget}) as span:
|
||||
await events.publish_current(events.llm_call(
|
||||
"drill_down.next", system_len=len(system), user_len=len(user),
|
||||
))
|
||||
decision = _parse_json(chat(system=system, user=user, max_tokens=256))
|
||||
decision = _parse_json(chat(
|
||||
system=system, user=user, max_tokens=256, span_name="drill_down.next.gen",
|
||||
))
|
||||
|
||||
# Hard guard: the chosen dimension MUST be in the candidate list.
|
||||
if decision.get("action") == "drill":
|
||||
@@ -142,7 +144,7 @@ async def interpret(question: str, metric: str, slices: list[Slice]) -> str:
|
||||
await events.publish_current(events.llm_call(
|
||||
"drill_down.interpret", system_len=len(system), user_len=len(user),
|
||||
))
|
||||
return chat(system=system, user=user, max_tokens=512)
|
||||
return chat(system=system, user=user, max_tokens=512, span_name="drill_down.interpret")
|
||||
|
||||
|
||||
# ── Prompt-context formatters ──
|
||||
|
||||
Reference in New Issue
Block a user