New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance Traceability of Generator Outputs in Promptflow Tracing #3120
Conversation
promptflow-tracing test result 12 files 12 suites 7m 23s ⏱️ Results for commit e20a5d0. ♻️ This comment has been updated with latest results. |
promptflow SDK CLI Azure E2E Test Result liucheng/20240430_generator_span 4 files 4 suites 4m 14s ⏱️ Results for commit e20a5d0. ♻️ This comment has been updated with latest results. |
promptflow-core test result0 tests 0 ✅ 0s ⏱️ Results for commit e20a5d0. ♻️ This comment has been updated with latest results. |
SDK CLI Global Config Test Result liucheng/20240430_generator_span6 tests 6 ✅ 1m 17s ⏱️ Results for commit e20a5d0. ♻️ This comment has been updated with latest results. |
Executor Unit Test Result liucheng/20240430_generator_span796 tests 796 ✅ 3m 44s ⏱️ Results for commit e20a5d0. ♻️ This comment has been updated with latest results. |
Executor E2E Test Result liucheng/20240430_generator_span245 tests 239 ✅ 5m 11s ⏱️ Results for commit e20a5d0. ♻️ This comment has been updated with latest results. |
SDK CLI Test Result liucheng/20240430_generator_span 4 files 4 suites 1h 4m 5s ⏱️ Results for commit e20a5d0. ♻️ This comment has been updated with latest results. |
…iucheng/20240430_generator_span
…iucheng/20240430_generator_span
Description
This PR introduces an enhanced method for capturing the trace of generator output functions within the Promptflow tracing framework. In the previous approach, when a function returned a generator, the associated span would terminate, and the output would be a string representing the generator object. Subsequently, a new span would be initiated when another function consumed this generator.
With the modifications proposed in this PR, the span persists beyond the point where a function returns a generator, concluding only after the generator has been fully consumed. Consequently, the output of the span encapsulating the generator or iterator object is now a comprehensive list of the iterated objects.
These changes significantly improve the transparency and intelligibility of the tracing process for generator outputs.
Example with OpenAI Call
Consider the following code for a node:
With the changes in this PR, specifying
stream=True
yields a generator object from theclient.chat.completions.create
call.Original Implementation
openai_chat
. The first span ended when the call finished, and the output was a string representing the generator object. The second span started when the generator was consumed and ended when the generator was fully consumed.New Implementation
openai_chat
. The span ends when the generator is fully consumed.All Promptflow Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines