Struct Profile

Source
#[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

Source

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 model
  • context_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);
Source

pub fn with_ability(self, ability: Ability) -> Self

Adds a single ability to the profile.

§Arguments
  • ability - The ability to add to this profile
§Examples
use ai_types::llm::model::{Profile, Ability};

let profile = Profile::new("vision-model", "A vision-capable model", 8192)
    .with_ability(Ability::Vision);
Source

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);
Source

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 Clone for Profile

Source§

fn clone(&self) -> Profile

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Profile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Profile

Source§

fn eq(&self, other: &Profile) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Profile

Source§

fn partial_cmp(&self, other: &Profile) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Profile

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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> ErasedDestructor for T
where T: 'static,