mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
## What changed Allow Responses-compatible providers to configure live web access and remote compaction under `model_providers.<id>.capabilities`: ```toml [model_providers.custom.capabilities] external_web_access = false remote_compaction = "v2" ``` `external_web_access = false` keeps hosted web search from accessing the live web. `remote_compaction` accepts `v2` to send `compaction_trigger` items through the Responses endpoint, or `unsupported` to use local compaction. Omitted capabilities retain existing provider defaults. ## Testing Add unit coverage for preserving unspecified defaults and a request-snapshot scenario verifying cached web search and V2 compaction for a custom provider. GitOrigin-RevId: fbcc4870aa51c112af575d711679a3941d1e7878
29 lines
1.2 KiB
Rust
29 lines
1.2 KiB
Rust
//! Serializable capability overrides for custom Responses-compatible providers.
|
|
//!
|
|
//! Unspecified capabilities inherit the provider's existing defaults. Model and
|
|
//! turn settings may further restrict the capabilities declared here.
|
|
|
|
use schemars::JsonSchema;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
/// Overrides for the optional API features supported by a custom provider.
|
|
#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize, PartialEq, Eq, JsonSchema)]
|
|
#[schemars(deny_unknown_fields)]
|
|
pub struct ModelProviderCapabilities {
|
|
/// Whether hosted web search may access the live web.
|
|
pub external_web_access: Option<bool>,
|
|
/// Remote context-compaction protocol; omission preserves provider defaults.
|
|
pub remote_compaction: Option<RemoteCompactionSupport>,
|
|
}
|
|
|
|
/// Remote context-compaction protocols supported by a model provider.
|
|
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum RemoteCompactionSupport {
|
|
/// Use local compaction instead of a provider compaction protocol.
|
|
Unsupported,
|
|
/// Send `compaction_trigger` items over the Responses endpoint.
|
|
V2,
|
|
}
|