Model

Struct Model 

Source
pub struct Model<P, C>
where P: Provider, C: ?Sized,
{ /* private fields */ }

Implementationsยง

Sourceยง

impl<P, C> Model<P, C>
where P: Provider, C: ?Sized,

Source

pub fn new( provider: P, model_id: String, capabilities: Vec<Capability>, ) -> Result<Self>

Source

pub fn temperature(self, temp: f32) -> Self

Source

pub fn system_prompt(self, prompt: impl Into<String>) -> Self

Source

pub fn max_tokens(self, tokens: u32) -> Self

Source

pub fn capabilities(&self) -> &[Capability]

Trait Implementationsยง

Sourceยง

impl<P, C> Chat for Model<P, C>
where P: Provider + Chat, C: Chat + ?Sized + Send + Sync,

Sourceยง

fn chat<'life0, 'async_trait>( &'life0 self, messages: Vec<ChatMessage>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sourceยง

impl<P, C> Complete for Model<P, C>
where P: Provider + Complete, C: Complete + ?Sized + Send + Sync,

Sourceยง

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, prompt: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sourceยง

impl<P, C> Embed for Model<P, C>
where P: Provider + Embed, C: Embed + ?Sized + Send + Sync,

Sourceยง

fn embed_data<'life0, 'async_trait>( &'life0 self, texts: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sourceยง

impl<P, C> HasCapability for Model<P, C>
where P: Provider, C: ?Sized + Send + Sync,

Sourceยง

impl<P, C> ImageGen for Model<P, C>
where P: Provider + ImageGen, C: ImageGen + ?Sized + Send + Sync,

Sourceยง

fn generate_image<'life0, 'life1, 'async_trait>( &'life0 self, prompt: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sourceยง

impl<P, C> Structured for Model<P, C>
where P: Provider + Structured, C: Structured + ?Sized + Send + Sync,

Sourceยง

fn structured_complete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prompt: &'life1 str, schema: &'life2 Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Sourceยง

impl<P, C> Tokenize for Model<P, C>
where P: Provider + Tokenize, C: Tokenize + ?Sized + Send + Sync,

Sourceยง

fn tokenize<'life0, 'life1, 'async_trait>( &'life0 self, texts: Vec<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<usize>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sourceยง

impl<P, C> Vision for Model<P, C>
where P: Provider + Vision, C: Vision + ?Sized + Send + Sync,

Sourceยง

fn caption<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, image: &'life1 [u8], prompt: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Auto Trait Implementationsยง

ยง

impl<P, C> Freeze for Model<P, C>
where P: Freeze, C: ?Sized,

ยง

impl<P, C> RefUnwindSafe for Model<P, C>

ยง

impl<P, C> Send for Model<P, C>
where C: Send + ?Sized,

ยง

impl<P, C> Sync for Model<P, C>
where C: Sync + ?Sized,

ยง

impl<P, C> Unpin for Model<P, C>
where P: Unpin, C: Unpin + ?Sized,

ยง

impl<P, C> UnwindSafe for Model<P, C>
where P: UnwindSafe, C: UnwindSafe + ?Sized,

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> PolicyExt for T
where T: ?Sized,

Sourceยง

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Sourceยง

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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, 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<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<U, <U as TryFrom<T>>::Error>> + 'async_trait>>
where T: 'async_trait,

Performs the conversion.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

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
Sourceยง

impl<T> ErasedDestructor for T
where T: 'static,

Sourceยง

impl<T> LLM for T

Sourceยง

impl<T> StructuredLM for T
where T: LLM + Structured,

Sourceยง

impl<T> VisionLM for T
where T: LLM + Vision,