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

client.Beta.Threads.Runs.NewStreaming ends inmediatly #127

Open
crazybolillo opened this issue Nov 18, 2024 · 2 comments
Open

client.Beta.Threads.Runs.NewStreaming ends inmediatly #127

crazybolillo opened this issue Nov 18, 2024 · 2 comments

Comments

@crazybolillo
Copy link

crazybolillo commented Nov 18, 2024

I am using the code provided in the example for assistant streaming:

stream := client.Beta.Threads.Runs.NewStreaming(ctx, thread.ID, openai.BetaThreadRunNewParams{
AssistantID: openai.String(assistant.ID),
Instructions: openai.String("Please address the user as Jane Doe. The user has a premium account."),
})
if err != nil {
panic(err)
}
for stream.Next() {
evt := stream.Current()
println(fmt.Sprintf("%T", evt.Data))
}

And I get a single api.Run event and then the loop exits and code finished. Is this a bug? Or am I doing something wrong?

@RobertCraigie
Copy link
Collaborator

Hey @crazybolillo, I get the following output when I run the assistant-streaming example, what do you see?

$ go run main.go
Create an assistant
Create an thread
Create a message
Create a run
openai.Run
openai.Run
openai.Run
openai.RunStep
openai.RunStep
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStepDeltaEvent
openai.RunStep
openai.RunStep
openai.RunStep
openai.Message
openai.Message
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.MessageDeltaEvent
openai.Message
openai.RunStep
openai.Run

@crazybolillo
Copy link
Author

Thanks for your time. I went ahead and reviewed the code, it started working after I removed option.WithRequestTimeout(10*time.Second) when creating the client. The weird thing is that when you add that parameter, it stops before actual 10 seconds go through.

Would that be considered a bug? I think it would be nice to be able to set a timeout in case assistants take too long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants