pub struct AgentCredentials {
pub default_provider: Option<String>,
pub default_model: Option<String>,
pub openai_api_key: Option<String>,
pub anthropic_api_key: Option<String>,
}Expand description
Credentials for LLM providers
Fields§
§default_provider: Option<String>Default provider to use
default_model: Option<String>Default model to use
openai_api_key: Option<String>OpenAI API key
anthropic_api_key: Option<String>Anthropic API key
Implementations§
Source§impl AgentCredentials
impl AgentCredentials
Sourcepub fn config_dir() -> Option<PathBuf>
pub fn config_dir() -> Option<PathBuf>
Get the syncable config directory (~/.syncable)
Sourcepub fn credentials_path() -> Option<PathBuf>
pub fn credentials_path() -> Option<PathBuf>
Get the credentials file path
Sourcepub fn load() -> AgentResult<Self>
pub fn load() -> AgentResult<Self>
Load credentials from file
Sourcepub fn save(&self) -> AgentResult<()>
pub fn save(&self) -> AgentResult<()>
Save credentials to file
Sourcepub fn has_credentials(&self, provider: ProviderType) -> bool
pub fn has_credentials(&self, provider: ProviderType) -> bool
Check if credentials exist for a provider
Sourcepub fn get_api_key(&self, provider: ProviderType) -> Option<&str>
pub fn get_api_key(&self, provider: ProviderType) -> Option<&str>
Get the API key for a provider
Sourcepub fn set_api_key(&mut self, provider: ProviderType, key: String)
pub fn set_api_key(&mut self, provider: ProviderType, key: String)
Set the API key for a provider
Sourcepub fn get_default_provider(&self) -> Option<ProviderType>
pub fn get_default_provider(&self) -> Option<ProviderType>
Get the default provider
Sourcepub fn set_default_provider(&mut self, provider: ProviderType)
pub fn set_default_provider(&mut self, provider: ProviderType)
Set the default provider
Trait Implementations§
Source§impl Clone for AgentCredentials
impl Clone for AgentCredentials
Source§fn clone(&self) -> AgentCredentials
fn clone(&self) -> AgentCredentials
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AgentCredentials
impl Debug for AgentCredentials
Source§impl Default for AgentCredentials
impl Default for AgentCredentials
Source§fn default() -> AgentCredentials
fn default() -> AgentCredentials
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AgentCredentials
impl<'de> Deserialize<'de> for AgentCredentials
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AgentCredentials
impl RefUnwindSafe for AgentCredentials
impl Send for AgentCredentials
impl Sync for AgentCredentials
impl Unpin for AgentCredentials
impl UnwindSafe for AgentCredentials
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more