Merge pull request #18 from jmorganca/yield-object

update generate to yield object
This commit is contained in:
Michael Yang
2023-06-28 18:06:18 -07:00
committed by GitHub
3 changed files with 5 additions and 5 deletions

View File

@@ -1,6 +1,5 @@
import os
import sys
import json
from pathlib import Path
from argparse import ArgumentParser
@@ -71,7 +70,6 @@ def generate_oneshot(*args, **kwargs):
print(flush=True)
for output in engine.generate(*args, **kwargs):
output = json.loads(output)
choices = output.get("choices", [])
if len(choices) > 0:
print(choices[0].get("text", ""), end="", flush=True)