System Prompt is set twice

Created on 14 May 2025, about 19 hours ago

Problem/Motivation

Currently due to the following code, the system prompt will be set twice. This does not affect quality, however it adds extra input tokens:

if ($this->chatSystemRole) {
        $chat_input[] = [
          'role' => 'system',
          'content' => [
            [
              'type' => 'text',
              'text' => $this->chatSystemRole,
            ],
          ],
        ];
        // If its o1 or o3 in it, we add it as a user message.
        if (preg_match('/(o1|o3)/i', $model_id)) {
          $chat_input[] = [
            'role' => 'user',
            'content' => $this->chatSystemRole,
          ];
        }
        else {
          $chat_input[] = [
            'role' => 'system',
            'content' => $this->chatSystemRole,
          ];
        }
      }

Steps to reproduce

Proposed resolution

Make sure its only set once.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇩🇪Germany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024