Skip to content

Commit a2bf105

Browse files
committed
fix no-stream completion
1 parent 89c1a72 commit a2bf105

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

minds/minds.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,14 @@ def completion(self, message: str, stream: bool = False) -> Union[str, Iterable[
126126
stream=stream
127127
)
128128
if stream:
129-
for chunk in response:
130-
yield chunk.choices[0].delta
129+
return self.stream_response(response)
131130
else:
132131
return response.choices[0].message.content
133132

133+
def stream_response(self, response):
134+
for chunk in response:
135+
yield chunk.choices[0].delta
136+
134137

135138
class Minds:
136139
def __init__(self, client):

0 commit comments

Comments
 (0)