example of stream text generation on openai added

This commit is contained in:
Barış Özmen
2024-11-02 22:08:51 +03:00
parent 90593d7919
commit 36d6ca4a11
+7
View File
@@ -0,0 +1,7 @@
from _context import sm
# Defaults to the default provider (openai)
r = sm.generate_stream_text("Write a poem about the moon", llm_model="gpt-4o-mini")
for chunk in r:
print(chunk, end="", flush=True)