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

Assistant streaming run throwing exception. #210

Closed
2 of 3 tasks
AndrawsYaqoob01 opened this issue Sep 4, 2024 · 2 comments
Closed
2 of 3 tasks

Assistant streaming run throwing exception. #210

AndrawsYaqoob01 opened this issue Sep 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@AndrawsYaqoob01
Copy link

AndrawsYaqoob01 commented Sep 4, 2024

Confirm this is not an issue with the OpenAI Python Library

  • This is not an issue with the OpenAI Python Library

Confirm this is not an issue with the underlying OpenAI API

  • This is not an issue with the OpenAI API

Confirm this is not an issue with Azure OpenAI

  • This is not an issue with Azure OpenAI

Describe the bug

Assistant streaming run is throwing exception when trying to access a function call in RequiredActionUpdate.

Exception is:
System.ClientModel.ClientResultException: 'HTTP 400 (invalid_request_error: )
Thread THREAD_ID already has an active run RUN_ID

To Reproduce

  1. Run example Example02b_FunctionCallingStreaming

Code snippets

No response

OS

winOS

.NET version

.NET 8.0

Library version

2.0.0-beta.11

@AndrawsYaqoob01 AndrawsYaqoob01 added the bug Something isn't working label Sep 4, 2024
@trrwilson
Copy link
Collaborator

@AndrawsYaqoob01, thank you for contacting us and drawing attention to this problem in the sample!

This appears to stem from a pattern change introduced with #128 -- because RequiredActionUpdate now is now derived from RunUpdate, the sample's existing check (RunUpdate first, then RequiredActionUpdate) now never processes the needed logic in RequiredActionUpdate.

We'll get this sample updated ASAP; the quick fix is to just swap the order of the two blocks to:

                if (update is RequiredActionUpdate requiredActionUpdate)
                {
                    if (requiredActionUpdate.FunctionName == getTemperatureTool.FunctionName)
                    {
                        outputsToSubmit.Add(new ToolOutput(requiredActionUpdate.ToolCallId, "57"));
                    }
                    else if (requiredActionUpdate.FunctionName == getRainProbabilityTool.FunctionName)
                    {
                        outputsToSubmit.Add(new ToolOutput(requiredActionUpdate.ToolCallId, "25%"));
                    }
                }
                else if (update is RunUpdate runUpdate)
                {
                    currentRun = runUpdate;
                }

We're also discussing how to clarify and simplify this pattern.

@AndrawsYaqoob01
Copy link
Author

Can you please update the sample for the future.

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

No branches or pull requests

2 participants