ai
ai copied to clipboard
Allow changing `body` with `useCompletion`
I've got an endpoint that takes custom additional data - it would make using useCompletion
a lot easier in many situations if it exposed setBody
or something similar.
Check the docs! Use the body property on useCompletion function Doc
Check the docs! Use the body property on useCompletion function
I mean to change the body property after instantiating useCompletion
, or adding body to the complete
call. This is basically what I want to achieve (or setBody
before calling complete
), with response
being the additional data.
const { complete } = useCompletion();
api.edge.search.context.useMutation({
onSuccess: (response) => {
complete(query, response);
},
});
Good call - ideally all methods that trigger a request should accept an extra optional option, that can contain custom body and headers.