Files
semantic-kernel/python/tests
Eduard van Valkenburg 97fb2c38f8 Python: Allow Kernel Functions from Prompt for image and audio content (#11403)
### 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.
-->
I noticed that even though the input and prompt rendering match what you
want to use for image and audio generation, we didn't support that.

This introduces just that, with two samples. This unlocks the following
scenario's:

- Running text to speech pipelines with set intro/outro statements
- Creating function calls for image generation with limited scope and a
lot of set pieces.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

- Adds a `get_image_content` method to the TextToImageClientBase class
- Adds the option to select a TextToImage or TextToAudio client in the
service selector (only for non-streaming)
- Adds branches in the KernelFunctionFromPrompt _invoke_internal for
those types.
- Adds handling the output as a FunctionResult
- Adds samples for both


### 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://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 😄
2025-04-10 12:51:53 +00:00
..
2023-04-13 16:12:36 -07:00