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

Python: Bug: The provided example is incorrect #11459

Open
qqq694637644 opened this issue Apr 9, 2025 · 4 comments
Open

Python: Bug: The provided example is incorrect #11459

qqq694637644 opened this issue Apr 9, 2025 · 4 comments
Labels
bug Something isn't working python Pull requests for the Python Semantic Kernel triage

Comments

@qqq694637644
Copy link

qqq694637644 commented Apr 9, 2025

https://github.com/microsoft/semantic-kernel/blob/main/python/samples/getting_started_with_processes/step03/step03a_food_preparation.py

The shared and non - shared stateful ones you provided
All are non - shared and stateful
The two functions are exactly the same. You made a mistake. I almost thought I was seeing things.
This is the result of the comparison by Beyond Compare

function
async def use_prepare_stateful_fried_fish_process_no_shared_state():

function
async def use_prepare_stateful_fried_fish_process_shared_state():

function
async def use_prepare_stateful_potato_fries_process_shared_state():
Image

@qqq694637644 qqq694637644 added the bug Something isn't working label Apr 9, 2025
@markwallace-microsoft markwallace-microsoft added python Pull requests for the Python Semantic Kernel triage labels Apr 9, 2025
@github-actions github-actions bot changed the title Bug: The provided example is incorrect Python: Bug: The provided example is incorrect Apr 9, 2025
@qqq694637644
Copy link
Author

I guess the correct example should be like this


    process_builder = PotatoFriesProcess.create_process_with_stateful_steps()
    external_trigger_event = PotatoFriesProcess.ProcessEvents.PreparePotatoFries

    kernel = _create_kernel_with_chat_completion("sample")
    process_instance = process_builder.build()

    print(f"=== Start SK Process '{process_builder.name}' ===")
    await execute_process_with_state(
        process_instance, kernel, external_trigger_event, "Order 1"
    )
    await execute_process_with_state(
        process_instance, kernel, external_trigger_event, "Order 2"
    )
    await execute_process_with_state(
        process_instance, kernel, external_trigger_event, "Order 3"
    )
    print(f"=== End SK Process '{process_builder.name}' ===")

@moonbox3
Copy link
Contributor

moonbox3 commented Apr 9, 2025

Feel free to make a PR with a fix, @qqq694637644. We haven't completed the actual work to handle state with processes (where they can be serialized and deserialized), which is why you'll probably see some "thin" handling of state right now. But if there are other actual fixes, please do go ahead and make a PR. We'd appreciate the contributions. Thanks.

@qqq694637644
Copy link
Author

Feel free to make a PR with a fix, @qqq694637644. We haven't completed the actual work to handle state with processes (where they can be serialized and deserialized), which is why you'll probably see some "thin" handling of state right now. But if there are other actual fixes, please do go ahead and make a PR. We'd appreciate the contributions. Thanks.

Okay, I'll submit a PR later. May I ask if you'll consider adding a flowchart feature similar to LangGraph in processBuild in the future? Writing the ProcessBuild process is too mentally taxing.

@moonbox3
Copy link
Contributor

moonbox3 commented Apr 9, 2025

Thank you for the feedback. We are working on a declarative spec that will allow one to create a process in a “no code/low code” way, potentially similar to what you referenced for LG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Pull requests for the Python Semantic Kernel triage
Projects
None yet
Development

No branches or pull requests

3 participants