mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
## What changed - Add a character n-gram shadow selector that combines skill descriptions with host interface metadata and tool dependency names and descriptions. - Bound routing fields, dependency records, and candidate counts before ranking. - Exclude explicitly selected skills from shadow candidates and only record invocations for skills eligible for the experiment. ## Testing - Add unit coverage for host interface metadata, connector dependencies, baseline description matches, and long routing metadata. GitOrigin-RevId: 36ef0cb4a68601f2d9d41c3344c88f7927c32bf4
52 lines
1.9 KiB
Rust
52 lines
1.9 KiB
Rust
mod character_ngram;
|
|
mod character_routing_card;
|
|
mod fielded_bm25;
|
|
mod multi_query_lexical;
|
|
mod routing_card_lexical;
|
|
mod rrf_lexical_char;
|
|
mod weighted_lexical;
|
|
pub(crate) use character_ngram::CharacterNgramSkillSelector;
|
|
pub(crate) use character_routing_card::CharacterRoutingCardSkillSelector;
|
|
use codex_skills::SkillDependencies;
|
|
pub(crate) use fielded_bm25::FieldedBm25SkillSelector;
|
|
pub(crate) use multi_query_lexical::MultiQueryLexicalSkillSelector;
|
|
pub(crate) use routing_card_lexical::RoutingCardLexicalSkillSelector;
|
|
pub(crate) use rrf_lexical_char::RrfLexicalCharSkillSelector;
|
|
pub(crate) use weighted_lexical::WeightedLexicalSkillSelector;
|
|
|
|
/// Metadata searched by a cheap skill selector.
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub(crate) struct SkillSelectionDocument<'a> {
|
|
/// Caller-owned identifier returned in [`CheapSkillSelection::candidate_ids`].
|
|
pub id: usize,
|
|
pub name: &'a str,
|
|
pub short_description: Option<&'a str>,
|
|
pub description: &'a str,
|
|
pub dependencies: Option<&'a SkillDependencies>,
|
|
}
|
|
|
|
/// Bounded output from one cheap skill-selection method.
|
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
|
pub(crate) struct CheapSkillSelection {
|
|
pub candidate_ids: Vec<usize>,
|
|
pub query_term_count: usize,
|
|
pub query_truncated: bool,
|
|
pub candidate_set_truncated: bool,
|
|
}
|
|
|
|
/// Selects likely-relevant skills without changing the model-visible catalog.
|
|
///
|
|
/// Implementations must be deterministic, side-effect free, and cheap enough to run in shadow
|
|
/// mode on every turn. Callers must validate returned IDs against the supplied documents.
|
|
pub(crate) trait CheapSkillSelector: Send + Sync {
|
|
/// Low-cardinality identifier suitable for experiment metrics.
|
|
fn method(&self) -> &'static str;
|
|
|
|
fn select(
|
|
&self,
|
|
query: &str,
|
|
documents: &[SkillSelectionDocument<'_>],
|
|
limit: usize,
|
|
) -> CheapSkillSelection;
|
|
}
|