Сan I receive tool calls and give tool
# general-english
к
Сan I receive tool calls and give tool responses directly in browser? This is needed to display a form. (just displaying the form (setDisplayContactForm(true) and "ok, the form is displayed, please fill it" as the next sentence)
s
ccing: @Kings_big💫
k
Yes, you can handle tool calls in the browser to display a form like setDisplayContactForm(true) and send a tool response like “Ok, the form is displayed, please fill it” back to the assistant.
к
How can I do that ?
k
Define a custom tool like displayContactForm in the assistant config, handle the tool call in your frontend like (setDisplayContactForm(true)), and respond with sendToolResponse to confirm the action.

https://youtu.be/rc4PlH9BRbA?si=bli9ewgt61sByuzO

к
But how do I implement the sendToolResponse?
k
Define a custom tool in your assistant, handle tool call POST requests on your server, and respond with a JSON result the assistant can use in the conversation.