Skip to content
Snippets Groups Projects
Commit 05ae5ec5 authored by Marcus Johansson's avatar Marcus Johansson
Browse files

Issue #3497577: O1 does not allow system role

parent e1ec2be4
No related branches found
No related tags found
1 merge request!14Issue #3497577: O1 does not allow system role
Pipeline #390600 passed
......@@ -270,10 +270,19 @@ class OpenAiProvider extends AiProviderClientBase implements
$chat_input = [];
// Add a system role if wanted.
if ($this->chatSystemRole) {
$chat_input[] = [
'role' => 'system',
'content' => $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,
];
}
}
/** @var \Drupal\ai\OperationType\Chat\ChatMessage $message */
foreach ($input->getMessages() as $message) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment