Beta completion, runTools

Using the beta completions in the javascript sdk and specifically the runTools function with all my function defines in the tools parameter. This is all happening server-side. Truncated example:

const stream ={
    stream: true,
    tools: [
        type: 'function',
        function: {
          function: function getWeather(args: { city: string }) {
            const { city } = args;

            return `Fake weather for ${city} is 72 degrees and sunny.`;
          parse: JSON.parse,
          description: 'Get the weather for a given city.',
          parameters: {
            type: 'object',
            properties: {
              city: {
                type: 'string',
                description: 'The city to get the weather for.',

return new Response(stream.toReadableStream());

My frontend is consuming this with the following:

const runner = ChatCompletionStream.fromReadableStream(

// Listen for content updates and append delta to output
runner.on('content', (delta) => { ... })

// Listen for function call, gets params
runner.on('functionCall', (functionCall) => {});

// Where and when does this happen?
runner.on('functionCallResult', (functionCallResult) => {});

The content and functionCall events work as expected. But functionCallResult never gets fired. Perhaps it doesn’t do what the name implies. What I’m looking for is the “result” of the function call having been run and what it returns. So in the example above, the result I would expect is Fake weather for ${city} is 72 degrees and sunny. with ${city} being replaced by whatever it determined for the parameter for the function call. Does this exist?

The end goal is to be able to not only pass data to the AI to extend it’s knowledge, but to also be able to do something with the result of the function call. For example, instead of just the example text being returned, if it returned json for the weather details. That automatically gets returned to the AI, but would be good to be able to get that response to do something on the frontend with it, like display a sun if it’s sunny or rainclouds if it’s rainy. Seems like this should be possible thru events firing but not seeing a way to with the provided events.