Files
codex/codex-rs/core/src/context/base_instructions.rs
T
pakrym-oai 84c989acf9 Annotate Responses Lite base instructions (#40296)
## What changed

- Build Responses Lite base instructions through a dedicated context fragment so the developer message carries the `model.base_instructions` content kind.
- Apply provider metadata cleanup after adding the base-instructions message, preserving the existing behavior for non-OpenAI providers.

## Testing

- Extend Responses Lite request coverage to verify the annotation is present for OpenAI requests and omitted for a third-party provider.

GitOrigin-RevId: b0317f92dfb9570860688b49e3a7668da516ee8c
2026-08-23 23:52:07 +00:00

32 lines
729 B
Rust

use super::ContextualUserFragment;
use codex_protocol::models::ContentItemKind;
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct BaseInstructionsFragment(pub(crate) String);
impl ContextualUserFragment for BaseInstructionsFragment {
fn content_kind(&self) -> ContentItemKind {
ContentItemKind("model.base_instructions".to_string())
}
fn role(&self) -> &'static str {
"developer"
}
fn requires_separate_message(&self) -> bool {
true
}
fn markers(&self) -> (&'static str, &'static str) {
Self::type_markers()
}
fn type_markers() -> (&'static str, &'static str) {
("", "")
}
fn body(&self) -> String {
self.0.clone()
}
}