pub struct RealmConnectionSet {
pub realm_id: String,
pub backends: BTreeMap<String, BackendProfile>,
pub auth_profiles: BTreeMap<String, AuthProfile>,
pub bindings: BTreeMap<String, ProviderBinding>,
pub default_binding: Option<String>,
}Expand description
Realm-scoped set of backends, auth profiles, and bindings.
Produced by RealmConnectionSet::from_config from a
RealmConfigSection ingested from TOML.
Fields§
§realm_id: String§backends: BTreeMap<String, BackendProfile>§auth_profiles: BTreeMap<String, AuthProfile>§bindings: BTreeMap<String, ProviderBinding>§default_binding: Option<String>Implementations§
Source§impl RealmConnectionSet
impl RealmConnectionSet
Sourcepub fn from_config(
realm_id: &str,
section: &RealmConfigSection,
) -> Result<Self, ProviderBindingError>
pub fn from_config( realm_id: &str, section: &RealmConfigSection, ) -> Result<Self, ProviderBindingError>
Validate and materialize a realm connection set from its config
section. Normalizes provider strings into the typed
Provider enum and verifies that every binding references
existing backend and auth profiles whose providers agree.
Sourcepub fn synthesize_env_default(provider: Provider) -> Self
pub fn synthesize_env_default(provider: Provider) -> Self
Synthesize a default RealmConnectionSet for a given provider,
sourcing credentials from a well-known env var. Used by surface
factories when no explicit realm config exists but the user has
set ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY in
the environment. OpenAI also supports an Azure env envelope:
AZURE_OPENAI_API_KEY plus AZURE_OPENAI_ENDPOINT synthesizes the
azure_openai backend instead of public OpenAI when no public OpenAI
key is present. The synthesized realm is consumed by the same
ProviderRuntimeRegistry path as explicit realms, so env-var auth and
realm-config auth share one resolution pipeline.
Returns a realm with id "env_default" containing one binding
"default" pointing at:
- BackendProfile
"default"with the provider’s default backend_kind and base_url=None (provider client uses its default). - AuthProfile
"default"withsource = Env { env: <ENV_VAR> }and the provider-specific env auth method.
The ENV_VAR name is per-provider:
- Anthropic:
ANTHROPIC_API_KEY - OpenAI:
OPENAI_API_KEY - Azure OpenAI:
AZURE_OPENAI_API_KEY+AZURE_OPENAI_ENDPOINT - Google:
GEMINI_API_KEY
Callers should also honor RKAT_*-prefixed overrides via
ResolverEnvironment::with_process_env(); that lookup is applied
inside the registry’s resolve path when it reads the env source.
Sourcepub fn synthesize_env_default_from_lookup<F>(
provider: Provider,
env_lookup: F,
) -> Self
pub fn synthesize_env_default_from_lookup<F>( provider: Provider, env_lookup: F, ) -> Self
Testable variant of Self::synthesize_env_default that lets callers
inject the env lookup used to select the OpenAI public-vs-Azure default.
Sourcepub fn synthesize_inline_default(provider: Provider, secret: String) -> Self
pub fn synthesize_inline_default(provider: Provider, secret: String) -> Self
Synthesize a default realm with an inline secret instead of an env lookup. Used when callers have already read the api key from a config file (legacy credential-map path).
Sourcepub fn lookup_binding(
&self,
id: &str,
) -> Result<(&ProviderBinding, &BackendProfile, &AuthProfile), ProviderBindingError>
pub fn lookup_binding( &self, id: &str, ) -> Result<(&ProviderBinding, &BackendProfile, &AuthProfile), ProviderBindingError>
Resolve a binding by id. Returns the binding plus its referenced backend and auth profiles.
Sourcepub fn lookup_auth_binding(
&self,
auth_binding: &AuthBindingRef,
) -> Result<(&ProviderBinding, &BackendProfile, &AuthProfile), ProviderBindingError>
pub fn lookup_auth_binding( &self, auth_binding: &AuthBindingRef, ) -> Result<(&ProviderBinding, &BackendProfile, &AuthProfile), ProviderBindingError>
Resolve a typed auth binding reference. AuthBindingRef.profile, when
present, overrides the binding’s configured auth profile while keeping
the binding’s backend and policy authoritative.
Trait Implementations§
Source§impl Clone for RealmConnectionSet
impl Clone for RealmConnectionSet
Source§fn clone(&self) -> RealmConnectionSet
fn clone(&self) -> RealmConnectionSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RealmConnectionSet
impl Debug for RealmConnectionSet
Source§impl<'de> Deserialize<'de> for RealmConnectionSet
impl<'de> Deserialize<'de> for RealmConnectionSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RealmConnectionSet
impl JsonSchema for RealmConnectionSet
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for RealmConnectionSet
impl PartialEq for RealmConnectionSet
Source§fn eq(&self, other: &RealmConnectionSet) -> bool
fn eq(&self, other: &RealmConnectionSet) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for RealmConnectionSet
impl Serialize for RealmConnectionSet
impl Eq for RealmConnectionSet
impl StructuralPartialEq for RealmConnectionSet
Auto Trait Implementations§
impl Freeze for RealmConnectionSet
impl RefUnwindSafe for RealmConnectionSet
impl Send for RealmConnectionSet
impl Sync for RealmConnectionSet
impl Unpin for RealmConnectionSet
impl UnsafeUnpin for RealmConnectionSet
impl UnwindSafe for RealmConnectionSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.