fix yield + version number

This commit is contained in:
ishaan-jaff 2023-08-12 15:05:11 -07:00
parent fcecb30d29
commit 406290b9e4
3 changed files with 139 additions and 6 deletions

View file

@ -766,11 +766,9 @@ async def get_ollama_response_stream(api_base="http://localhost:11434", model="l
if chunk.strip() != "":
j = json.loads(chunk)
if "response" in j:
print(j["response"])
yield {
"role": "assistant",
"content": j["response"]
}
completion_obj ={ "role": "assistant", "content": ""}
completion_obj["content"] = j["response"]
yield {"choices": [{"delta": completion_obj}]}
# self.responses.append(j["response"])
# yield "blank"
except Exception as e: