Skip to content

Python: Allow Kernel Functions from Prompt for image and audio content #11403

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

Merged
merged 5 commits into from
Apr 10, 2025

Conversation

eavanvalkenburg
Copy link
Member

@eavanvalkenburg eavanvalkenburg commented Apr 7, 2025

Motivation and Context

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

  • 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

@eavanvalkenburg eavanvalkenburg requested a review from a team as a code owner April 7, 2025 12:53
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Apr 7, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Apr 7, 2025

Python Unit Test Overview

Tests Skipped Failures Errors Time
3418 5 💤 0 ❌ 0 🔥 1m 43s ⏱️

@eavanvalkenburg eavanvalkenburg force-pushed the prompt_for_image_and_audio branch from 6df5e18 to 76fbcb0 Compare April 7, 2025 14:08
@eavanvalkenburg eavanvalkenburg force-pushed the prompt_for_image_and_audio branch from ee1ddf8 to 81da09e Compare April 9, 2025 07:04
@eavanvalkenburg eavanvalkenburg force-pushed the prompt_for_image_and_audio branch from 79d0810 to 2d42291 Compare April 10, 2025 08:36
@eavanvalkenburg eavanvalkenburg force-pushed the prompt_for_image_and_audio branch from 2d42291 to a9d735b Compare April 10, 2025 12:38
@moonbox3 moonbox3 added this pull request to the merge queue Apr 10, 2025
Merged via the queue into microsoft:main with commit 97fb2c3 Apr 10, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants