Download codex-rs/app-server-protocol/src/protocol/v2/model.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 7.5 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v2/model.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/app-server-protocol/src/protocol/v2/model.rs
-
curl -L -o model.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v2/model.rs
7.5 kB
| use super::shared::v2_enum_from_core; | |
| use super::turn::CyberAccessProgram; | |
| use crate::JsonSchema; | |
| use crate::TS; | |
| use codex_protocol::openai_models::InputModality; | |
| use codex_protocol::openai_models::ModelAccessPrograms as CoreModelAccessPrograms; | |
| use codex_protocol::openai_models::ModelAvailabilityNux as CoreModelAvailabilityNux; | |
| use codex_protocol::openai_models::ReasoningEffort; | |
| use codex_protocol::openai_models::default_input_modalities; | |
| use codex_protocol::protocol::ModelRerouteReason as CoreModelRerouteReason; | |
| use codex_protocol::protocol::ModelVerification as CoreModelVerification; | |
| use codex_protocol::protocol::MultiAgentVersion as CoreMultiAgentVersion; | |
| use serde::Deserialize; | |
| use serde::Serialize; | |
| use serde_json::Value as JsonValue; | |
| v2_enum_from_core!( | |
| pub enum ModelRerouteReason from CoreModelRerouteReason { | |
| HighRiskCyberActivity | |
| } | |
| ); | |
| v2_enum_from_core!( | |
| pub enum ModelVerification from CoreModelVerification { | |
| TrustedAccessForCyber | |
| } | |
| ); | |
| v2_enum_from_core!( | |
| /// Multi-agent runtime supported by a model. | |
| pub enum MultiAgentVersion from CoreMultiAgentVersion { | |
| Disabled, | |
| V1, | |
| V2 | |
| } | |
| ); | |
| pub struct ModelProviderCapabilitiesReadParams {} | |
| pub struct ModelProviderCapabilitiesReadResponse { | |
| pub namespace_tools: bool, | |
| pub image_generation: bool, | |
| pub web_search: bool, | |
| } | |
| pub struct ModelListParams { | |
| /// Opaque pagination cursor returned by a previous call. | |
| pub cursor: Option<String>, | |
| /// Optional page size; defaults to a reasonable server-side value. | |
| pub limit: Option<u32>, | |
| /// When true, include models that are hidden from the default picker list. | |
| pub include_hidden: Option<bool>, | |
| } | |
| pub struct ModelAvailabilityNux { | |
| pub message: String, | |
| } | |
| impl From<CoreModelAvailabilityNux> for ModelAvailabilityNux { | |
| fn from(value: CoreModelAvailabilityNux) -> Self { | |
| Self { | |
| message: value.message, | |
| } | |
| } | |
| } | |
| pub struct ModelServiceTier { | |
| pub id: String, | |
| pub name: String, | |
| pub description: String, | |
| } | |
| /// Caller-specific explicit access programs advertised by model discovery. | |
| pub struct ModelAccessPrograms { | |
| /// Accepted explicit selections. | |
| pub cyber: Vec<CyberAccessProgram>, | |
| } | |
| impl From<CoreModelAccessPrograms> for ModelAccessPrograms { | |
| fn from(value: CoreModelAccessPrograms) -> Self { | |
| Self { | |
| cyber: value.cyber.into_iter().map(Into::into).collect(), | |
| } | |
| } | |
| } | |
| impl From<ModelAccessPrograms> for CoreModelAccessPrograms { | |
| fn from(value: ModelAccessPrograms) -> Self { | |
| Self { | |
| cyber: value.cyber.into_iter().map(Into::into).collect(), | |
| } | |
| } | |
| } | |
| pub struct Model { | |
| pub id: String, | |
| pub model: String, | |
| pub upgrade: Option<String>, | |
| pub upgrade_info: Option<ModelUpgradeInfo>, | |
| pub availability_nux: Option<ModelAvailabilityNux>, | |
| pub display_name: String, | |
| pub description: String, | |
| pub model_specialty: Option<String>, | |
| pub hidden: bool, | |
| pub supported_reasoning_efforts: Vec<ReasoningEffortOption>, | |
| pub default_reasoning_effort: ReasoningEffort, | |
| pub input_modalities: Vec<InputModality>, | |
| /// @deprecated Always false; models no longer support personality selection. | |
| pub supports_personality: bool, | |
| /// Multi-agent runtime declared by this model, when available. | |
| pub multi_agent_version: Option<MultiAgentVersion>, | |
| /// Deprecated: use `serviceTiers` instead. | |
| pub additional_speed_tiers: Vec<String>, | |
| pub service_tiers: Vec<ModelServiceTier>, | |
| /// Catalog default service tier id for this model, when one is configured. | |
| pub default_service_tier: Option<String>, | |
| /// Null when the catalog does not provide access-program metadata. | |
| pub available_access_programs: Option<ModelAccessPrograms>, | |
| // Only one model should be marked as default. | |
| pub is_default: bool, | |
| } | |
| pub struct ModelUpgradeInfo { | |
| pub model: String, | |
| pub upgrade_copy: Option<String>, | |
| pub model_link: Option<String>, | |
| pub migration_markdown: Option<String>, | |
| /// Informational Unix timestamp for this upgrade's scheduled retirement, if known. | |
| pub retirement_at: Option<i64>, | |
| } | |
| pub struct ReasoningEffortOption { | |
| pub reasoning_effort: ReasoningEffort, | |
| pub description: String, | |
| } | |
| pub struct ModelListResponse { | |
| pub data: Vec<Model>, | |
| /// Opaque cursor to pass to the next call to continue after the last item. | |
| /// If None, there are no more items to return. | |
| pub next_cursor: Option<String>, | |
| } | |
| pub struct ModelReroutedNotification { | |
| pub thread_id: String, | |
| pub turn_id: String, | |
| pub from_model: String, | |
| pub to_model: String, | |
| pub reason: ModelRerouteReason, | |
| } | |
| pub struct ModelVerificationNotification { | |
| pub thread_id: String, | |
| pub turn_id: String, | |
| pub verifications: Vec<ModelVerification>, | |
| } | |
| pub struct TurnModerationMetadataNotification { | |
| pub thread_id: String, | |
| pub turn_id: String, | |
| pub metadata: JsonValue, | |
| } | |
| pub struct ModelSafetyBufferingUpdatedNotification { | |
| pub thread_id: String, | |
| pub turn_id: String, | |
| pub model: String, | |
| pub use_cases: Vec<String>, | |
| pub reasons: Vec<String>, | |
| pub show_buffering_ui: bool, | |
| pub faster_model: Option<String>, | |
| } | |