Skip to content

Commit a2db208

Browse files
committed
Grok doesn't support stream-options
1 parent d1fe9c5 commit a2db208

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

aipyapp/aipy/llm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,14 @@ def _parse_response(self, response):
168168
)
169169

170170
def get_completion(self, messages):
171-
stream_options = {'include_usage': True} if self._stream else None
171+
kws = {'stream_options': {'include_usage': True}} if self._stream and not self._base_url else {}
172172
try:
173173
response = self._client.chat.completions.create(
174174
model = self._model,
175175
messages = messages,
176176
stream=self._stream,
177-
stream_options = stream_options,
178-
max_tokens = self.max_tokens
177+
max_tokens = self.max_tokens,
178+
**kws
179179
)
180180
except Exception as e:
181181
self.console.print(f"❌ [bold red]{self.name} API {T('call_failed')}: [yellow]{str(e)}")

0 commit comments

Comments
 (0)