File size: 332 Bytes
4c9b469
 
 
63998ab
 
4c9b469
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import json


class OpenaiStreamOutputer:
    def output(self, content=None, content_type=None) -> bytes:
        return (
            json.dumps(
                {
                    "content": content,
                    "content_type": content_type,
                }
            )
            + "\n"
        ).encode("utf-8")