pub struct ModelManager { /* private fields */ }
Implementations§
Source§impl ModelManager
impl ModelManager
pub fn new() -> Self
pub fn get_model_entries(&self) -> Vec<ModelEntry>
pub fn has_model_any(&self, model: &str) -> bool
pub fn model_display_names(&self) -> HashSet<String>
pub fn list_chat_completions_models(&self) -> Vec<String>
pub fn list_completions_models(&self) -> Vec<String>
pub fn list_embeddings_models(&self) -> Vec<String>
pub fn list_tensor_models(&self) -> Vec<String>
pub fn add_completions_model( &self, model: &str, engine: OpenAICompletionsStreamingEngine, ) -> Result<(), ModelManagerError>
pub fn add_chat_completions_model( &self, model: &str, engine: OpenAIChatCompletionsStreamingEngine, ) -> Result<(), ModelManagerError>
pub fn add_embeddings_model( &self, model: &str, engine: OpenAIEmbeddingsStreamingEngine, ) -> Result<(), ModelManagerError>
pub fn add_tensor_model( &self, model: &str, engine: TensorStreamingEngine, ) -> Result<(), ModelManagerError>
pub fn remove_completions_model( &self, model: &str, ) -> Result<(), ModelManagerError>
pub fn remove_chat_completions_model( &self, model: &str, ) -> Result<(), ModelManagerError>
pub fn remove_embeddings_model( &self, model: &str, ) -> Result<(), ModelManagerError>
pub fn remove_tensor_model(&self, model: &str) -> Result<(), ModelManagerError>
pub fn get_embeddings_engine( &self, model: &str, ) -> Result<OpenAIEmbeddingsStreamingEngine, ModelManagerError>
pub fn get_completions_engine( &self, model: &str, ) -> Result<OpenAICompletionsStreamingEngine, ModelManagerError>
pub fn get_chat_completions_engine( &self, model: &str, ) -> Result<OpenAIChatCompletionsStreamingEngine, ModelManagerError>
pub fn get_tensor_engine( &self, model: &str, ) -> Result<TensorStreamingEngine, ModelManagerError>
Sourcepub fn save_model_entry(&self, key: &str, entry: ModelEntry)
pub fn save_model_entry(&self, key: &str, entry: ModelEntry)
Save a ModelEntry under an instance’s etcd models/
key so we can fetch it later when the key is
deleted from etcd.
Sourcepub fn remove_model_entry(&self, key: &str) -> Option<ModelEntry>
pub fn remove_model_entry(&self, key: &str) -> Option<ModelEntry>
Remove and return model entry for this instance’s etcd key. We do this when the instance stops.
pub async fn kv_chooser_for( &self, model_name: &str, component: &Component, kv_cache_block_size: u32, kv_router_config: Option<KvRouterConfig>, ) -> Result<Arc<KvRouter>>
pub fn get_model_tool_call_parser(&self, model: &str) -> Option<String>
Sourcepub fn get_parsing_options(&self, model: &str) -> ParsingOptions
pub fn get_parsing_options(&self, model: &str) -> ParsingOptions
Creates parsing options with tool call parser and reasoning parser for the specified model. Currently reasoning parser is not implemented (returns None).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ModelManager
impl !RefUnwindSafe for ModelManager
impl Send for ModelManager
impl Sync for ModelManager
impl Unpin for ModelManager
impl !UnwindSafe for ModelManager
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> 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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
Source§impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
fn overflowing_into(self) -> (U, bool)
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);