microsoft / promptflow

Build high-quality LLM apps - from prototyping, testing to production deployment and monitoring.
https://microsoft.github.io/promptflow/
MIT License
8.32k stars 712 forks source link

[Executor] Update completion tokens for generator output #3110

Closed lumoslnt closed 1 week ago

lumoslnt commented 1 week ago

Description

Currently, if user call OpenAI API with streaming mode in dag flow, the completion tokens in run info will be zero. In this PR, we fix the error by calculating tokens after the output is consumed.

All Promptflow Contribution checklist:

General Guidelines and Best Practices

Testing Guidelines

github-actions[bot] commented 1 week ago

promptflow SDK CLI Azure E2E Test Result dev/linatang/update-completion-tokens

  4 files    4 suites   4m 6s :stopwatch: 238 tests 203 :white_check_mark:  35 :zzz: 0 :x: 952 runs  812 :white_check_mark: 140 :zzz: 0 :x:

Results for commit 115cdbbb.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 1 week ago

promptflow-core test result

0 tests   0 :white_check_mark:  0s :stopwatch: 0 suites  0 :zzz: 0 files    0 :x:

Results for commit 115cdbbb.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 1 week ago

SDK CLI Global Config Test Result dev/linatang/update-completion-tokens

6 tests   6 :white_check_mark:  1m 20s :stopwatch: 1 suites  0 :zzz: 1 files    0 :x:

Results for commit 115cdbbb.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 1 week ago

Executor Unit Test Result dev/linatang/update-completion-tokens

792 tests   792 :white_check_mark:  3m 44s :stopwatch:   1 suites    0 :zzz:   1 files      0 :x:

Results for commit 115cdbbb.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 1 week ago

Executor E2E Test Result dev/linatang/update-completion-tokens

242 tests   237 :white_check_mark:  5m 11s :stopwatch:   1 suites    5 :zzz:   1 files      0 :x:

Results for commit 115cdbbb.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 1 week ago

SDK CLI Test Result dev/linatang/update-completion-tokens

    4 files      4 suites   59m 44s :stopwatch:   668 tests   655 :white_check_mark: 13 :zzz: 0 :x: 2 672 runs  2 620 :white_check_mark: 52 :zzz: 0 :x:

Results for commit 115cdbbb.

:recycle: This comment has been updated with latest results.