Replies: 2 comments
-
I also suffer from this problem. It will be helpful to achieve solution! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @AN0DA @Nemryk , if you want to execute your flow quickly and collect token usage. You can use tracing & In opened trace UI, you can find token count here: Streaming output is also supported with flex flow, you can reference this sample. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, does anyone have any ideas on how to achieve this?
I need to collect token usage metrics and send them using both standard and streaming endpoints. For reference, my code looks like this (all code snippets are parts of a larger class):
Referring to this discussion (#3352), I managed to get what I want. Although the implementation is slightly overengineered, it works great and looks like this:
However, I cannot wrap my mind around capturing the stream from the
run()
function. I went through the promptflow library implementations forRun
,Flow
, and similar classes, as well as how promptflow-serve is coded, but nothing seems to work for me.Is achieving this functionality as simple and convenient when using
load_flow
andFlow
class unachievable when usingrun()
? Do you have any ideas on how I can solve this case?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions