Make sure to use the system prompt

This commit is contained in:
Clément Renault 2025-06-06 12:32:40 +02:00
parent 70670c3be4
commit 717a026fdd
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
2 changed files with 51 additions and 20 deletions

View file

@ -102,16 +102,24 @@ pub enum ChatCompletionSource {
VLlm,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SystemRole {
System,
Developer,
}
impl ChatCompletionSource {
pub fn system_role(&self, model: &str) -> &'static str {
pub fn system_role(&self, model: &str) -> SystemRole {
use ChatCompletionSource::*;
use SystemRole::*;
match self {
ChatCompletionSource::OpenAi if Self::old_openai_model(model) => "system",
ChatCompletionSource::OpenAi => "developer",
ChatCompletionSource::AzureOpenAi if Self::old_openai_model(model) => "system",
ChatCompletionSource::AzureOpenAi => "developer",
ChatCompletionSource::Mistral => "system",
ChatCompletionSource::Gemini => "system",
ChatCompletionSource::VLlm => "system",
OpenAi if Self::old_openai_model(model) => System,
OpenAi => Developer,
AzureOpenAi if Self::old_openai_model(model) => System,
AzureOpenAi => Developer,
Mistral => System,
Gemini => System,
VLlm => System,
}
}