Skip to content

.Net: Use type to represent python code execution result - #11931

Merged
SergeyMenshykh merged 8 commits into
microsoft:mainfrom
SergeyMenshykh:use-type-for-code-execution-function
May 7, 2025
Merged

SergeyMenshykh merged 8 commits into
microsoft:mainfrom
SergeyMenshykh:use-type-for-code-execution-function

Conversation

@SergeyMenshykh

Copy link
Copy Markdown
Contributor

Motivation, Context and Description

This PR introduces a new type, SessionsPythonCodeExecutionResult, to represent the Python code execution result and refactors the SessionsPythonPlugin.ExecuteCodeAsync method to return this type instead of a string. This should allow access to the result in a structured way for scenarios where the result needs to be processed further, for example, in the auto function invocation filters. At the same time, the type overloads the ToString() method to be used in scenarios where the result needs to be a string, for example when the function is invoked as part of rendering a prompt template.

Contributes to: #10070

@SergeyMenshykh SergeyMenshykh self-assigned this May 7, 2025
@SergeyMenshykh
SergeyMenshykh requested a review from a team as a code owner May 7, 2025 12:47
@SergeyMenshykh SergeyMenshykh added the .NET Issue or Pull requests regarding .NET code label May 7, 2025
@markwallace-microsoft Mark Wallace (markwallace-microsoft) added the kernel Issues or pull requests impacting the core kernel label May 7, 2025
@SergeyMenshykh SergeyMenshykh moved this to Sprint: In Review in Semantic Kernel May 7, 2025
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue May 7, 2025
Merged via the queue into microsoft:main with commit fa2d52f May 7, 2025
@SergeyMenshykh
SergeyMenshykh deleted the use-type-for-code-execution-function branch May 7, 2025 21:40
@github-project-automation github-project-automation Bot moved this from Sprint: In Review to Sprint: Done in Semantic Kernel May 7, 2025
jcruzmot-te pushed a commit to thousandeyes/aia-semantic-kernel that referenced this pull request Sep 15, 2025
…1931)

### Motivation, Context and Description

This PR introduces a new type, `SessionsPythonCodeExecutionResult`, to
represent the Python code execution result and refactors the
`SessionsPythonPlugin.ExecuteCodeAsync` method to return this type
instead of a string. This should allow access to the result in a
structured way for scenarios where the result needs to be processed
further, for example, in the auto function invocation filters. At the
same time, the type overloads the `ToString()` method to be used in
scenarios where the result needs to be a string, for example when the
function is invoked as part of rendering a prompt template.

Contributes to:
microsoft#10070

This branch was previously deployed

1 inactive deployment
integration — 02f021a7 Deployed May 7, 2025 by SergeyMenshykh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants