mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 14:17:08 +00:00
Skip trace work when disabled; share the agent span builder
With TRACES_ENABLED off, LLM calls record no GenAI metrics, and a streamed answer is joined into a preview only when a span keeps it. Agent runs and continuations build their invoke_agent span in one place, which now reads the model from model_id. The trace panel shows a stream's model time next to how long it was open. Adds missing type hints.
This commit is contained in:
1 parent
699906a015
commit
0bbbac0eb2
18 files changed
+88
-35
No files matched your search
+2
-2
@@ -3,7 +3,7 @@ import time
|
||||
from typing import Any, Dict
|
||||
|
||||
from docsgpt.pricing import compute_cost_usd
|
||||
from docsgpt.tracing.llm import finish_llm_call, output_text, start_llm_span
|
||||
from docsgpt.tracing.llm import finish_llm_call, start_llm_span
|
||||
from docsgpt.storage.db.repositories.token_usage import TokenUsageRepository
|
||||
from docsgpt.storage.db.session import db_session
|
||||
from docsgpt.utils import num_tokens_from_object_or_list, num_tokens_from_string
|
||||
@@ -388,7 +388,7 @@ def stream_token_usage(func):
|
||||
ttft_ms=ttft_ms,
|
||||
cost_usd=cost,
|
||||
estimated=call_usage is estimated_usage,
|
||||
output=output_text(batch),
|
||||
output=batch,
|
||||
)
|
||||
emit = getattr(self, "_emit_stream_finished_log", None)
|
||||
if callable(emit):
|
||||
|
||||
Reference in new issue
Block a user