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

experimental_useObject ability to reset object #2397

Open
T04435 opened this issue Jul 24, 2024 · 0 comments
Open

experimental_useObject ability to reset object #2397

T04435 opened this issue Jul 24, 2024 · 0 comments
Labels
ai/ui enhancement New feature or request

Comments

@T04435
Copy link

T04435 commented Jul 24, 2024

Feature Description

sdk version "ai": "3.2.34"
Similar to

const { setCompletion } = useCompletion(...)

which can be used to unset the completion.
I actually think a better approach would be to reset the object to undefined when submit starts, but if that is not possible then a

const { setObject } = useObject(...)

const handleSubmit () => {
  // unset object
  setObject(undefined);
  submit('stream object');
}  

Use Case

avoid showing the last object while generating the new one.
ATM have to copy object to another useState to reset, same for onFinish but that's another topic.

Additional context

No response

@lgrammel lgrammel added enhancement New feature or request ai/ui labels Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/ui enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants