From 613314d7f45d53d654ccf047126234ca6393847d Mon Sep 17 00:00:00 2001 From: Shroominic Date: Mon, 20 Nov 2023 14:42:48 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Add=20story=20generator=20stream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/stream.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 examples/stream.py diff --git a/examples/stream.py b/examples/stream.py new file mode 100644 index 0000000..3f4189f --- /dev/null +++ b/examples/stream.py @@ -0,0 +1,15 @@ +from funcchain import chain, settings +from funcchain.streaming import stream_to + +settings.MODEL_TEMPERATURE = 1 +settings.MODEL_NAME = "gpt-3.5-turbo-1106" + + +def generate_story_of(topic: str) -> str: + """ + Write a short story based on the topic. + """ + return chain() + +with stream_to(print): + generate_story_of("a space cat")