Add streaming support to XAI provider and update example usage

This commit is contained in:
2024-11-02 16:42:28 -04:00
parent 27d30ccfe8
commit d6afbd1fd0
2 changed files with 24 additions and 3 deletions
+1 -3
View File
@@ -1,9 +1,7 @@
from _context import sm
# Defaults to the default provider (openai)
r = sm.generate_text(
"Write a poem about the moon", llm_model="gpt-4o-mini", stream=True
)
r = sm.generate_text("Write a poem about the moon", llm_provider="xai", stream=True)
for chunk in r:
print(chunk, end="", flush=True)