Skip to main content

RealmConnectionSet

Struct RealmConnectionSet 

Source
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

Source

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.

Source

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" with source = 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.

Source

pub fn synthesize_env_default_from_lookup<F>( provider: Provider, env_lookup: F, ) -> Self
where F: Fn(&str) -> Option<String>,

Testable variant of Self::synthesize_env_default that lets callers inject the env lookup used to select the OpenAI public-vs-Azure default.

Source

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).

Source

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.

Source

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

Source§

fn clone(&self) -> RealmConnectionSet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RealmConnectionSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RealmConnectionSet

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for RealmConnectionSet

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for RealmConnectionSet

Source§

fn eq(&self, other: &RealmConnectionSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for RealmConnectionSet

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for RealmConnectionSet

Source§

impl StructuralPartialEq for RealmConnectionSet

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,