pub struct ModelList {
pub data: Vec<Model>,
}Expand description
Represents a complete list of models from a provider.
This struct contains all available models from a provider. Providers that support pagination internally handle fetching all pages before returning results.
§Fields
data: The complete list of available models
§Example
use rig_core::model::{Model, ModelList};
let list = ModelList::new(vec![
Model::from_id("gpt-4"),
Model::from_id("gpt-3.5-turbo"),
]);
println!("Found {} models", list.len());
for model in list.iter() {
println!("- {}", model.display_name());
}Fields§
§data: Vec<Model>The complete list of available models
Implementations§
Source§impl ModelList
impl ModelList
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the list is empty.
§Example
use rig_core::model::ModelList;
let empty = ModelList::new(vec![]);
assert!(empty.is_empty());
let non_empty = ModelList::new(vec![rig_core::model::Model::from_id("gpt-4")]);
assert!(!non_empty.is_empty());Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of models in this list.
§Example
use rig_core::model::{Model, ModelList};
let list = ModelList::new(vec![
Model::from_id("gpt-4"),
Model::from_id("gpt-3.5-turbo"),
]);
assert_eq!(list.len(), 2);Sourcepub fn iter(&self) -> Iter<'_, Model> ⓘ
pub fn iter(&self) -> Iter<'_, Model> ⓘ
Returns an iterator over the models in this list.
§Example
use rig_core::model::{Model, ModelList};
let list = ModelList::new(vec![
Model::from_id("gpt-4"),
Model::from_id("gpt-3.5-turbo"),
]);
for model in list.iter() {
println!("Model: {}", model.display_name());
}Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModelList
impl<'de> Deserialize<'de> for ModelList
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelList, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelList, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl IntoIterator for ModelList
impl IntoIterator for ModelList
Source§impl<'a> IntoIterator for &'a ModelList
impl<'a> IntoIterator for &'a ModelList
Source§impl Serialize for ModelList
impl Serialize for ModelList
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ModelList
impl RefUnwindSafe for ModelList
impl Send for ModelList
impl Sync for ModelList
impl Unpin for ModelList
impl UnsafeUnpin for ModelList
impl UnwindSafe for ModelList
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
impl<T> DebuggableStorage for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoToolOutput for Twhere
T: Serialize + 'static,
impl<T> IntoToolOutput for Twhere
T: Serialize + 'static,
Source§fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
Convert this value without routing structured data through a string.