Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.Net: Use empty string instead of null content in assistant message i…
…n Azure/OpenAI connectors (#9150) ### Motivation and Context <!-- 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. --> Resolves: #8072 Resolves: #8488 Azure Chat Completion with data service returns `400 (Bad Request) Invalid chat message detected: message content must be string` response when assistant message in chat history doesn't contain `content` property or when this property is an array of content items. This case is applicable for function calling, where AI model returns set of tools to call instead of message content. This PR contains a change to set `content` property as an empty string only for cases when content doesn't exist (`null`). ### Description <!-- 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: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https:/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https:/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 😄
- Loading branch information