Skip to main content

litellm_rs/core/providers/registry/
lifecycle.rs

1//! Provider module lifecycle decisions.
2//!
3//! This manifest records the lifecycle decision for every directory under
4//! `src/core/providers`.  It is deliberately conservative: modules that compile
5//! but are not reachable from the gateway LLM factory are kept as `Stub` until a
6//! focused PR either wires them, moves them to catalog-only metadata, or deletes
7//! them with owner confirmation.
8
9/// Lifecycle decision for a provider module directory.
10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
11pub enum ProviderModuleLifecycle {
12    /// The provider module is reachable through a native runtime `Provider` enum branch.
13    Wire,
14    /// The provider should be represented by catalog metadata instead of a code module.
15    CatalogOnly,
16    /// The code module is intentionally retained but is not runtime-wired yet.
17    Stub,
18    /// The directory is shared infrastructure, not a provider implementation.
19    Internal,
20    /// The directory is a candidate for removal after owner confirmation.
21    Delete,
22}
23
24/// Lifecycle entry for one directory under `src/core/providers`.
25#[derive(Debug, Clone, Copy, PartialEq, Eq)]
26pub struct ProviderModuleLifecycleEntry {
27    pub module_name: &'static str,
28    pub lifecycle: ProviderModuleLifecycle,
29    pub reason: &'static str,
30}
31
32/// Temporary approved baseline for provider implementation directories that
33/// GH837 has not yet deleted, demoted, wired, or explicitly exempted.
34#[derive(Debug, Clone, Copy, PartialEq, Eq)]
35pub struct ProviderOrphanBaselineEntry {
36    pub module_name: &'static str,
37    pub lane: &'static str,
38    pub issue: &'static str,
39    pub owner: &'static str,
40    pub expires: &'static str,
41    pub reason: &'static str,
42}
43
44pub static PROVIDER_MODULE_LIFECYCLE: &[ProviderModuleLifecycleEntry] = &[
45    wire("anthropic", "native Provider enum variant"),
46    provider_extra_wire(
47        "azure",
48        "native Provider enum variant when providers-extra is enabled; otherwise unsupported without generic fallback",
49    ),
50    provider_extra_wire(
51        "azure_ai",
52        "native Provider enum variant when providers-extra is enabled; otherwise unsupported without generic fallback",
53    ),
54    internal("base", "shared provider infrastructure"),
55    wire("bedrock", "native Provider enum variant"),
56    providers_extended_wire(
57        "black_forest_labs",
58        "ProviderType::BlackForestLabs dispatches to native asynchronous image endpoints",
59    ),
60    wire("cloudflare", "native Provider enum variant"),
61    wire("databricks", "typed Databricks Model Serving runtime"),
62    wire("deepgram", "native audio Provider enum variant"),
63    wire("elevenlabs", "native audio Provider enum variant"),
64    providers_extended_wire(
65        "cohere",
66        "ProviderType::Cohere dispatches to native Cohere API paths when providers-extended is enabled",
67    ),
68    internal("factory", "provider construction infrastructure"),
69    providers_extended_wire(
70        "fal_ai",
71        "ProviderType::FalAI dispatches to native image-generation endpoints when providers-extended is enabled",
72    ),
73    providers_extended_wire(
74        "gemini",
75        "ProviderType::Gemini dispatches to native Google AI Studio Gemini auth when providers-extended is enabled",
76    ),
77    providers_extended_wire(
78        "github_copilot",
79        "ProviderType::GitHubCopilot dispatches to native GitHub Copilot auth when providers-extended is enabled",
80    ),
81    internal("macros", "provider macro infrastructure"),
82    wire("mistral", "native Provider enum variant"),
83    providers_extended_wire(
84        "ollama",
85        "ProviderType::Ollama dispatches to the native Ollama protocol when providers-extended is enabled",
86    ),
87    wire("openai", "native Provider enum variant"),
88    wire("openai_like", "shared OpenAI-compatible runtime provider"),
89    wire("oci", "typed OCI compatible and native retrieval runtime"),
90    internal("registry", "provider catalog and lifecycle infrastructure"),
91    providers_extended_wire(
92        "replicate",
93        "ProviderType::Replicate dispatches to native prediction lifecycle paths when providers-extended is enabled",
94    ),
95    wire("sagemaker", "typed SageMaker InvokeEndpoint runtime"),
96    wire("snowflake", "typed Snowflake Cortex runtime"),
97    providers_extended_wire(
98        "stability",
99        "ProviderType::Stability dispatches to native v2beta image endpoints",
100    ),
101    internal("thinking", "shared thinking/reasoning support"),
102    provider_extra_wire(
103        "vertex_ai",
104        "ProviderType::VertexAI dispatches to native Vertex AI auth when providers-extra is enabled",
105    ),
106    wire("watsonx", "typed watsonx native inference runtime"),
107    wire(
108        "voyage",
109        "ProviderType::Voyage dispatches to native embedding and rerank endpoints",
110    ),
111];
112
113pub static PROVIDER_ORPHAN_BASELINE: &[ProviderOrphanBaselineEntry] = &[];
114
115pub fn provider_module_lifecycle() -> &'static [ProviderModuleLifecycleEntry] {
116    PROVIDER_MODULE_LIFECYCLE
117}
118
119pub fn provider_orphan_baseline() -> &'static [ProviderOrphanBaselineEntry] {
120    PROVIDER_ORPHAN_BASELINE
121}
122
123const fn wire(module_name: &'static str, reason: &'static str) -> ProviderModuleLifecycleEntry {
124    entry(module_name, ProviderModuleLifecycle::Wire, reason)
125}
126
127const fn internal(module_name: &'static str, reason: &'static str) -> ProviderModuleLifecycleEntry {
128    entry(module_name, ProviderModuleLifecycle::Internal, reason)
129}
130
131const fn provider_extra_wire(
132    module_name: &'static str,
133    reason: &'static str,
134) -> ProviderModuleLifecycleEntry {
135    let lifecycle = if cfg!(feature = "providers-extra") {
136        ProviderModuleLifecycle::Wire
137    } else {
138        ProviderModuleLifecycle::Stub
139    };
140    entry(module_name, lifecycle, reason)
141}
142
143const fn providers_extended_wire(
144    module_name: &'static str,
145    reason: &'static str,
146) -> ProviderModuleLifecycleEntry {
147    let lifecycle = if cfg!(feature = "providers-extended") {
148        ProviderModuleLifecycle::Wire
149    } else {
150        ProviderModuleLifecycle::Stub
151    };
152    entry(module_name, lifecycle, reason)
153}
154
155const fn entry(
156    module_name: &'static str,
157    lifecycle: ProviderModuleLifecycle,
158    reason: &'static str,
159) -> ProviderModuleLifecycleEntry {
160    ProviderModuleLifecycleEntry {
161        module_name,
162        lifecycle,
163        reason,
164    }
165}
166
167#[cfg(test)]
168#[path = "lifecycle_tests.rs"]
169mod tests;