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

streamObject alternating between undefined and the response #1508

Closed
bernaferrari opened this issue May 7, 2024 · 8 comments
Closed

streamObject alternating between undefined and the response #1508

bernaferrari opened this issue May 7, 2024 · 8 comments
Assignees

Comments

@bernaferrari
Copy link

bernaferrari commented May 7, 2024

Description

This one is hard to reproduce, because there is no rawText for me to debug and send the issue :P #1486

But basically, in a certain circumstance, partialObject (from for await (const partialObject of stream.partialObjectStream) {) will return undefined, followed by the correct JSON, followed by undefined. It keeps alternating between undefined and the correct JSON.

I wish it either didn't return undefined, since that's not useful, or there were a better way to debug this so I could report to you.

image

Code example

No response

Additional context

No response

@bernaferrari bernaferrari changed the title bug with streamObject streamObject alternating between undefined and the response May 7, 2024
@lgrammel lgrammel self-assigned this May 7, 2024
@lgrammel
Copy link
Collaborator

lgrammel commented May 7, 2024

@bernaferrari are you able to reproduce this locally consistently each time?

@bernaferrari
Copy link
Author

Yes!! But I wish I could send what is breaking instead of my whole prompt.

@lgrammel
Copy link
Collaborator

lgrammel commented May 7, 2024

@bernaferrari is there a chance that you could provide a similar example that breaks and has nothing to do with your prompt? (e.g. using a structurally similar prompt/schema from a different domain)

@bernaferrari
Copy link
Author

I don't know, but I could send the output before and after it is undefined so you can test character by character what is wrong. Would that be helpful?

@lgrammel
Copy link
Collaborator

lgrammel commented May 7, 2024

I don't know, but I could send the output before and after it is undefined so you can test character by character what is wrong. Would that be helpful?

Maybe, would have to see

@bernaferrari
Copy link
Author

bernaferrari commented May 7, 2024

Check if this helps, I'm printing JSON.stringify(partialObject). You can see there is a pattern. Always with the ,"props":{} it seems to crash.

{"type":"div","children":[{"type":"Card"}]}
undefined
{"type":"div","children":[{"type":"Card","props":{},"children":[]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":""}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"Card"}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader"}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader"}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader"}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader"}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader"}]}]}
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader"}]}]}
undefined
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader","props":{},"children":[]}]}]}

Then again at:

{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader","props":{},"children":[{"type":"CardTitle"}]}]}]}
undefined
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader","props":{},"children":[{"type":"CardTitle","props":{},"children":[""]}]}]}]}

and

{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader","props":{},"children":[{"type":"CardTitle","props":{},"children":["Tea Shop"]},{"type":"CardDescription","props":{},"children":["Explore and purchase a variety of teas."]}]},{"type":"CardContent"}]}]}
undefined
{"type":"div","children":[{"type":"Card","props":{},"children":[{"type":"CardHeader","props":{},"children":[{"type":"CardTitle","props":{},"children":["Tea Shop"]},{"type":"CardDescription","props":{},"children":["Explore and purchase a variety of teas."]}]},{"type":"CardContent","props":{},"children":[]}]}]}

@lgrammel
Copy link
Collaborator

lgrammel commented May 8, 2024

@bernaferrari thank you! investigating now

@lgrammel
Copy link
Collaborator

lgrammel commented May 8, 2024

Fix: #1529

@lgrammel lgrammel closed this as completed May 8, 2024
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