Struct FoundryLocalManager

Source
pub struct FoundryLocalManager { /* private fields */ }
Expand description

Manager for Foundry Local SDK operations.

Implementations§

Source§

impl FoundryLocalManager

Source

pub fn builder() -> FoundryLocalManagerBuilder

Create a new builder for FoundryLocalManager.

Source

pub fn service_uri(&self) -> Result<&str>

Get the service URI.

§Returns

URI of the Foundry service.

Source

pub fn endpoint(&self) -> Result<String>

Get the endpoint for the service.

§Returns

Endpoint URL.

Source

pub fn api_key(&self) -> String

Get the API key for authentication.

§Returns

API key.

Source

pub fn is_service_running(&mut self) -> bool

Check if the service is running. Will also set the service URI if it is not set.

§Returns

True if the service is running, False otherwise.

Source

pub fn start_service(&mut self) -> Result<()>

Start the service.

§Returns

Result indicating success or failure.

Source

pub async fn list_catalog_models(&mut self) -> Result<&Vec<FoundryModelInfo>>

Get a list of available models in the catalog.

§Returns

List of catalog models.

Source

pub fn refresh_catalog(&mut self)

Refresh the catalog.

Source

pub async fn get_model_info( &mut self, alias_or_model_id: &str, raise_on_not_found: bool, ) -> Result<FoundryModelInfo>

Get the model information by alias or ID.

§Arguments
  • alias_or_model_id - Alias or Model ID. If it is an alias, the most preferred model will be returned.
  • raise_on_not_found - If true, raise an error if the model is not found. Default is false.
§Returns

Model information, or None if not found and raise_on_not_found is false.

Source

pub async fn get_cache_location(&self) -> Result<String>

Get the cache location.

§Returns

Cache location as a string.

Source

pub async fn list_cached_models(&mut self) -> Result<Vec<FoundryModelInfo>>

List cached models.

§Returns

List of cached models.

Source

pub async fn download_model( &mut self, alias_or_model_id: &str, token: Option<&str>, force: bool, ) -> Result<FoundryModelInfo>

Download a model.

§Arguments
  • alias_or_model_id - Alias or Model ID.
  • token - Optional token for authentication.
  • force - If true, force re-download even if the model is already cached.
§Returns

Downloaded model information.

Source

pub async fn load_model( &mut self, alias_or_model_id: &str, ttl: Option<i32>, ) -> Result<FoundryModelInfo>

Load a model.

§Arguments
  • alias_or_model_id - Alias or Model ID.
  • ttl - Optional time-to-live in seconds. Default is 10 minutes (600 seconds).
§Returns

Loaded model information.

Source

pub async fn unload_model( &mut self, alias_or_model_id: &str, force: bool, ) -> Result<()>

Unload a model.

§Arguments
  • alias_or_model_id - Alias or Model ID.
  • force - If true, force unload even if the model is in use.
§Returns

Result indicating success or failure.

Source

pub async fn list_loaded_models(&mut self) -> Result<Vec<FoundryModelInfo>>

List loaded models.

§Returns

List of loaded models.

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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