How to Return Arbitrary Schema Stream Response in HttpApiEndpoint?

Is there a way to give an arbitary schema stream response in HttpApiEndpoint? for example,

HttpApiEndpoint.post("generateText", "/:id/stream/text")
    .setPath(
        Schema.Struct({
            id: ChatId
        })
    )
    .setPayload(AiInput.AiInput)
    .addError(ChatIdNotFoundError)
    .addError(ChatNotOwnedByUserError)
    .addSuccess(
        AiResponse.AiResponse.pipe(
            HttpApiSchema.withEncoding({
                kind: "Json",
                contentType: "application/octet-stream"
            })
        )
    )
Was this page helpful?