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

[Bug]: Delete conversation state in OpenAI Python example is not working #2199

Open
jbaron opened this issue Nov 23, 2024 · 4 comments
Open
Labels
bug Something isn't working P2 Priority level 2 - Nice to have

Comments

@jbaron
Copy link

jbaron commented Nov 23, 2024

Language

Python

Version

latest

Description

In the OpenAI Python example, the way to delete conversation state seems not to be working. It looks mostly like a copy of the JS code when I checked, but the most important part (state.deleteConversationState()) cannot be resolved in Python and throws there for an exception.

@app.message("/clear")
async def message(context: TurnContext, state: AppTurnState):
    state.deleteConversationState() # doesn't seem to be implemented in the custom state.py file!!!!
    await context.send_activity(
        "New chat session started: Previous messages won't be used as context for new queries."
    )
    return True

I'm running it with teams-ai version 1.5.0 and also in the main branch didn't see a newer version of this example. So for me unclear how to delete conversation state in Python version.

Reproduction Steps

1. Included the sample code in my own project
2. Deployed the bot
3. Got an exception about `state.deleteConversationState` not found when executing `/clear` in Teams
@jbaron jbaron added the bug Something isn't working label Nov 23, 2024
@Meghana-MSFT
Copy link

@jbaron - Thank you for reporting this issue, we will test the sample and get back to you with an update.

@jbaron
Copy link
Author

jbaron commented Nov 29, 2024

Found out the following does work (from another example):

@bot_app.message("/clear")
async def _on_clear_message(context: TurnContext, state: TurnState):
    """Reset the conversation state"""
    if state.conversation:
        del state.conversation

    await context.send_activity("New session started.")
    return True

BTW, I noticed this particular OpenAI Python example has more issues, for example the app runtime was still set to NodeJS and not Python.

@Meghana-MSFT
Copy link

Meghana-MSFT commented Dec 4, 2024

@jbaron - Thank you for confirming that your issue is resolved.

@corinagum -

BTW, I noticed this particular OpenAI Python example has more issues, for example the app runtime was still set to NodeJS and not Python.

Could you please help look into this feedback regarding the Python sample.

@corinagum corinagum added the P2 Priority level 2 - Nice to have label Dec 13, 2024
@corinagum
Copy link
Collaborator

@BMS-geodev could you leave a comment here for assignment? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2 Priority level 2 - Nice to have
Projects
None yet
Development

No branches or pull requests

3 participants