Skip to main content

steer_core/
catalog.rs

1use crate::auth::ProviderRegistry;
2use crate::error::Result;
3use crate::model_registry::ModelRegistry;
4use std::sync::Arc;
5
6/// Configuration for loading catalog files.
7#[derive(Debug, Clone, Default)]
8pub struct CatalogConfig {
9    /// Additional catalog files to load (absolute or relative paths).
10    pub catalog_paths: Vec<String>,
11}
12
13impl CatalogConfig {
14    pub fn new() -> Self {
15        Self::default()
16    }
17
18    pub fn with_catalogs(catalog_paths: Vec<String>) -> Self {
19        Self { catalog_paths }
20    }
21}
22
23/// Load both registries with the same catalog configuration.
24pub fn load_registries(
25    config: &CatalogConfig,
26) -> Result<(Arc<ModelRegistry>, Arc<ProviderRegistry>)> {
27    let model_registry = Arc::new(ModelRegistry::load(&config.catalog_paths)?);
28    let provider_registry = Arc::new(ProviderRegistry::load(&config.catalog_paths)?);
29    Ok((model_registry, provider_registry))
30}