Skip to content

Commit

Permalink
.Net: Python: Update multiple-results when streaming at a getting-sta…
Browse files Browse the repository at this point in the history
…rted notebook. (#6859)

### Motivation and Context
Fix the multiple results when streaming.
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description
Don't use enumerate and take a choice_index which is already provided in
the result.

Expected)
Result 1: Blah Blah
Result 2: Blah Blah
Result 3: Blah Blah
Actual)
Result 1: BlahBlahBlah BlahBlahBlah
Result 2: 
Result 3: 
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

---------

Co-authored-by: Evan Mattson <[email protected]>
  • Loading branch information
jungwookim and moonbox3 authored Jun 22, 2024
1 parent 9078be5 commit 2af512f
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,8 @@
" current_time = time.time()\n",
"\n",
" # Update texts with new results\n",
" for idx, result in enumerate(results):\n",
" if idx < number_of_responses:\n",
" texts[idx] += str(result)\n",
" for result in results:\n",
" texts[result.choice_index] += str(result)\n",
"\n",
" # Clear and display output at intervals\n",
" if current_time - last_clear_time > clear_interval:\n",
Expand Down

0 comments on commit 2af512f

Please sign in to comment.