@@ -48,6 +48,8 @@ class OpenAICompatibleRunner(BaseRunner, ABC): {'role': 'user', 'content': [{'type': 'text', 'text': result.getvalue()}]} ) + if system_prompt := payload.pop('system_prompt', None): + payload['messages'].insert(0, {'role': 'system', 'content': system_prompt}) payload['messages'].append({'role': 'user', 'content': [{'type': 'text', 'text': content}]}) if file and isinstance(file, BytesIO): @@ -79,7 +81,6 @@ class OpenAICompatibleRunner(BaseRunner, ABC): try: with client.stream('POST', '/chat/completions', json=payload) as stream: stream_content = stream.iter_text() - if stream.status_code >= 400: raw = ''.join([chunk for chunk in stream_content]) try: