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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

marcus_johansson created an issue. See original summary.

marcus_johansson’s picture

Assigned: Unassigned » marcus_johansson

marcus_johansson’s picture

Assigned: marcus_johansson » Unassigned
Status: Active » Needs review
marcus_johansson’s picture

marcus_johansson’s picture

For testing, please test before and after the MR, to make sure that it works as advertised.

dan2k3k4’s picture

Status: Needs review » Reviewed & tested by the community

Working fine for me

marcus_johansson’s picture

Status: Reviewed & tested by the community » Fixed

Thank you @dan2k3k4, getting merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.