[Python] Is there a way to simultaneously implement human-like split messaging and function...

Discussão em 'Python' iniciado por Stack, Junho 25, 2025.

  1. Stack

    Stack Membro Participativo

    Typically, an AI provides a single response to a single query. However, in actual messenger conversations between people, it's more natural for multiple messages to be sent in reply. To implement this, I used structured output. This allows me to reliably enforce the generation of split, multiple messages. The problem, however, is that I can't use function calling when I'm using structured output. I'm looking for a solution to this.

    There's a potential workaround where the structured output itself includes the function call, but I'm unsure if it will work well since it isn't a native method. I'm currently using the Python SDK, which is very convenient because it even handles the function calls automatically. Therefore, I'd prefer to build this in a way that is as natural as possible—a method that is officially supported and recommended by the API.

    Continue reading...

Compartilhe esta Página