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

De-serialization error using AssistantClient streaming #200

Closed
2 tasks done
castroal opened this issue Aug 30, 2024 · 5 comments
Closed
2 tasks done

De-serialization error using AssistantClient streaming #200

castroal opened this issue Aug 30, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@castroal
Copy link

castroal commented Aug 30, 2024

Confirm this is not an issue with the underlying OpenAI API

  • This is an issue with the Python library

Confirm this is not an issue with Azure OpenAI

  • This is not an issue with Azure OpenAI

Describe the bug

Using the AssistantClient with file search enabled and streaming gives the error: The requested operation requires an element of type 'String', but the target element has type 'Object'.'

The exception is raised here:

To Reproduce

  1. Create and streaming enumerate a Run using an assistant with file search enabled.

Code snippets

var response = assistantClient.CreateRunStreamingAsync(
    threadId: "thread_id",
    assistantId: "assistant_id",
    options: new RunCreationOptions {},
    cancellationToken: cToken);

await foreach (var update in response.WithCancellation(cToken))
{
     //after a couple of updates, the error "InvalidOperationException The requested operation requires an element of type 'String', but the target element has type 'Object'." is raised.
}

OS

Windows 11

.NET version

net8.0

Library version

2.0.0-beta.10

@castroal castroal added the bug Something isn't working label Aug 30, 2024
@span
Copy link

span commented Aug 30, 2024

Seeing this in beta.3 as well and tried upgrading to beta.10.

It seems to me there have been changes in the API, since beta.3 has been working very well for months.

I wrote a foum post in openai forums about this as well.

https://community.openai.com/t/invalid-json-in-assistants-streaming-with-annotations/926883

@citron8000
Copy link

I am having the same problem since yesterday. It worked fine before for weeks. I'm with beta.7.

@joseharriaga
Copy link
Collaborator

Thank you for reaching out, @castroal ! I'm able to repro the issue. @span is correct that the issue is related to a recent change in the service's REST API exposing a latent bug in the library. We're working on a fix that we hope to release early next week.

@joseharriaga joseharriaga self-assigned this Aug 31, 2024
@joseharriaga
Copy link
Collaborator

This has been fixed as part of this PR: 🔗 #206

We also just pushed a release today, so the fix is now live starting with version 2.0.0-beta.11:
🔗 https://www.nuget.org/packages/OpenAI/2.0.0-beta.11

Thank you!

@span
Copy link

span commented Sep 4, 2024 via email

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

4 participants