Using Vercel AI SDK, how to send prompt without a form? (using OpenAI)
Unanswered
Semipalmated Plover posted this in #help-forum
Semipalmated PloverOP
I am using the Vercel AI SDK with Next.js and am curious how I can manipulate handleInputChange and handleSubmit without an input element. For example, using a useEffect to send the query "Hi!" and getting a response back.
I've been reading the docs but I seem to be missing how I can achieve this, and my hacky solutions don't seem to work. Any advice?
I've been reading the docs but I seem to be missing how I can achieve this, and my hacky solutions don't seem to work. Any advice?
6 Replies
Semipalmated PloverOP
Bump
European sprat
It doesn't really work like that but you could probably figure out some way to hack it
handleInputChange expects an HTMLInputElement ChangeEvent
handleSubmit expects an HTMLFormElement FormEvent
+ ChatRequestOptions
I'd suggest looking for alternatives like calling the API directly since the point of useChat is to handle changes and submissions to a form