mirror of
https://github.com/openai/codex.git
synced 2026-04-28 08:34:54 +00:00
feat(personality) introduce model_personality config (#9459)
## Summary Introduces the concept of a config model_personality. I would consider this an MVP for testing out the feature. There are a number of follow-ups to this PR: - More sophisticated templating with validation - In-product experience to manage this ## Testing - [x] Testing locally
This commit is contained in:
23
codex-rs/core/tests/suite/personality.rs
Normal file
23
codex-rs/core/tests/suite/personality.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use codex_core::config::types::Personality;
|
||||
use codex_core::models_manager::manager::ModelsManager;
|
||||
use core_test_support::load_default_config_for_test;
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
|
||||
const BASE_INSTRUCTIONS_TEMPLATE: &str = include_str!(
|
||||
"../../templates/model_instructions/gpt-5.2-codex_instructions_template.md"
|
||||
);
|
||||
const FRIENDLY_PERSONALITY: &str = include_str!("../../templates/personalities/friendly.md");
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn model_personality_updates_base_instructions() {
|
||||
let codex_home = TempDir::new().expect("create temp dir");
|
||||
let mut config = load_default_config_for_test(&codex_home).await;
|
||||
config.model_personality = Some(Personality::Friendly);
|
||||
|
||||
let model_info = ModelsManager::construct_model_info_offline("gpt-5.2-codex", &config);
|
||||
let expected =
|
||||
BASE_INSTRUCTIONS_TEMPLATE.replace("{{ personality_message }}", FRIENDLY_PERSONALITY);
|
||||
|
||||
assert_eq!(model_info.base_instructions, expected);
|
||||
}
|
||||
Reference in New Issue
Block a user