How can I invoke another assistant from my real-time client function and ensure the response is played back in real-time?
For example:
client.addTool(
{
name: "get_weather",
description: "Retrieves the weather for a given latitude and longitude. Specify a label for the location.",
parameters: {
type: "object",
properties: {
assistant_id: {
type: "string",
description: "The unique ID of the Weather assistant.",
default: "x",
},
lat: {
type: "number",
description: "Latitude",
},
lng: {
type: "number",
description: "Longitude",
},
location: {
type: "string",
description: "Name of the location",
},
},
required: ["lat", "lng", "location"],
},
},
async ({assistant_id, lat, lng, location }) => {
const response = await invokeAssistant({
assistant_id: assistant_id,
lat: lat,
lng: lng,
location: location,
});
return response;
}
);
I want the response from the invoked assistant to be streamed back and processed, so it can be played back in real-time