#[non_exhaustive]pub struct Profile {
pub name: String,
pub description: String,
pub abilities: Vec<Ability>,
pub context_length: u32,
pub pricing: Option<Pricing>,
}
Expand description
Represents a language model’s profile, including its name, description, abilities, context length, and optional pricing.
A model profile provides comprehensive information about a language model’s capabilities, limitations, and pricing structure. This allows applications to make informed decisions about which model to use for specific tasks.
§Examples
use ai_types::llm::model::{Profile, Ability, Pricing};
let profile = Profile::new("gpt-4", "GPT-4 Turbo", 128000)
.with_ability(Ability::ToolUse)
.with_ability(Ability::Vision);
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.name: String
The name of the model.
description: String
A description of the model.
abilities: Vec<Ability>
The abilities supported by the model.
context_length: u32
The maximum context length supported by the model.
pricing: Option<Pricing>
Optional pricing information for the model.
Implementations§
Source§impl Profile
impl Profile
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
context_length: u32,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, context_length: u32, ) -> Self
Creates a new Profile
with the given name, description, and context length.
§Arguments
name
- The name of the model (e.g., “gpt-4”, “claude-3-opus”)description
- A human-readable description of the modelcontext_length
- Maximum number of tokens the model can process
§Examples
use ai_types::llm::model::Profile;
let profile = Profile::new("gpt-4", "GPT-4 Turbo", 128000);
Sourcepub fn with_ability(self, ability: Ability) -> Self
pub fn with_ability(self, ability: Ability) -> Self
Sourcepub fn with_abilities(
self,
abilities: impl IntoIterator<Item = Ability>,
) -> Self
pub fn with_abilities( self, abilities: impl IntoIterator<Item = Ability>, ) -> Self
Adds multiple abilities to the profile.
§Arguments
abilities
- An iterable collection of abilities to add
§Examples
use ai_types::llm::model::{Profile, Ability};
let abilities = [Ability::ToolUse, Ability::Vision, Ability::Audio];
let profile = Profile::new("multimodal", "A multimodal model", 32768)
.with_abilities(abilities);
Sourcepub const fn with_pricing(self, pricing: Pricing) -> Self
pub const fn with_pricing(self, pricing: Pricing) -> Self
Sets the pricing information for the profile.
§Arguments
pricing
- The pricing structure for this model
§Examples
use ai_types::llm::model::{Profile, Pricing};
let mut pricing = Pricing::default();
pricing.prompt = 0.01;
pricing.completion = 0.03;
let profile = Profile::new("paid-model", "A paid model", 4096)
.with_pricing(pricing);
Trait Implementations§
Source§impl PartialOrd for Profile
impl PartialOrd for Profile
impl StructuralPartialEq for Profile
Auto Trait Implementations§
impl Freeze for Profile
impl RefUnwindSafe for Profile
impl Send for Profile
impl Sync for Profile
impl Unpin for Profile
impl UnwindSafe for Profile
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