Skip to content
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

Multiple responses that don't need to be parsed #1658

Closed
chipalost opened this issue Jun 21, 2023 · 3 comments · Fixed by #2214
Closed

Multiple responses that don't need to be parsed #1658

chipalost opened this issue Jun 21, 2023 · 3 comments · Fixed by #2214
Assignees
Labels
bug Something isn't working sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)

Comments

@chipalost
Copy link

chipalost commented Jun 21, 2023

SK allows for multiple responses to be returned for one request; however, it appends all responses into one string. This makes it hard to interact with any one particular response as they must first be parsed into individual responses.

An alternative could be returning an array of ContextVariables or an array of Context objects, each of which containing its own result.

  • Context.ContextVariables[].Result
  • Context[].ContextVariables.Result
@evchaki evchaki added the sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community) label Jun 22, 2023
@chipalost
Copy link
Author

In theory, SK already supports this. A developer should be able to iterate through a collection of responses. For example, Kernel.RunAsync() returns SKContext and you should then be able to iterate through ModelResults which is part of the SKContext.

Unfortunately, it looks like we have a bug where all responses are being appended to a string which is then provided as each of the responses contained in ModelResults.

@shawncal
Copy link
Member

@RogerBarreto looks like ModelResults isn't getting filled in properly. Can you take a look please?

@RogerBarreto
Copy link
Member

@shawncal @chipalost. I could not find this behavior in the current Model Results although I found another unwanted behavior.

Each ModelResult is actually including all the choices (Prompt Results) and is not clear from which ModelResult is which choice.

I will open a small PR to make it clear in a ModelResult 1:1 Choice

github-merge-queue bot pushed a commit that referenced this issue Jul 31, 2023
### Motivation and Context

Prior to this change, when using the ModelResult in a multiple results
scenario the choices were being repeated for each ModelResult object,
not being clear which Choice was related to the Result.

Resolves #1658
Closes #1658

### Description

Added two new representations for both `ChatResult` and `TextResult`
that has one to one reference to the `choice` details coming from the
LLM.

Updated GetModelResult example with the expected behavior and an easier
example to track the changes and different prompts.

### Contribution Checklist

- [x] The code builds clean without any errors or warnings
- [x] 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
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
@nacharya1 nacharya1 added the bug Something isn't working label Aug 2, 2023
SOE-YoungS pushed a commit to SOE-YoungS/semantic-kernel that referenced this issue Nov 1, 2023
…soft#2214)

### Motivation and Context

Prior to this change, when using the ModelResult in a multiple results
scenario the choices were being repeated for each ModelResult object,
not being clear which Choice was related to the Result.

Resolves microsoft#1658
Closes microsoft#1658

### Description

Added two new representations for both `ChatResult` and `TextResult`
that has one to one reference to the `choice` details coming from the
LLM.

Updated GetModelResult example with the expected behavior and an easier
example to track the changes and different prompts.

### Contribution Checklist

- [x] The code builds clean without any errors or warnings
- [x] 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
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants