Skip to content

Commit

Permalink
Generate token metrics also for fake stream
Browse files Browse the repository at this point in the history
Signed-off-by: Eero Tamminen <[email protected]>
  • Loading branch information
eero-t committed Mar 3, 2025
1 parent 4bfd4ae commit 04f2407
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions comps/cores/mega/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ async def schedule(self, initial_inputs: Dict | BaseModel, llm_parameters: LLMPa
# turn the response to a StreamingResponse
# to make the response uniform to UI
def fake_stream(text):
is_first = True
token_start = self.metrics.token_update(token_start, is_first)

Check warning on line 174 in comps/cores/mega/orchestrator.py

View check run for this annotation

Codecov / codecov/patch

comps/cores/mega/orchestrator.py#L173-L174

Added lines #L173 - L174 were not covered by tests
yield "data: b'" + text + "'\n\n"
yield "data: [DONE]\n\n"

Expand Down

0 comments on commit 04f2407

Please sign in to comment.