AnthropicCompatibleChatModelBuilder

Struct AnthropicCompatibleChatModelBuilder 

Source
pub struct AnthropicCompatibleChatModelBuilder<const WITH_NAME: bool> { /* private fields */ }
Expand description

A builder for an Anthropic compatible chat model.

Implementations§

Source§

impl AnthropicCompatibleChatModelBuilder<false>

Source

pub fn new() -> AnthropicCompatibleChatModelBuilder<false>

Creates a new builder

Source§

impl<const WITH_NAME: bool> AnthropicCompatibleChatModelBuilder<WITH_NAME>

Source

pub fn with_model( self, model: impl ToString, ) -> AnthropicCompatibleChatModelBuilder<true>

Set the name of the model to use.

Source

pub fn with_max_tokens( self, max_tokens: u32, ) -> AnthropicCompatibleChatModelBuilder<WITH_NAME>

Set the default max tokens to use when generating text.

Source

pub fn with_claude_3_5_sonnet(self) -> AnthropicCompatibleChatModelBuilder<true>

Set the model to claude-3-5-sonnet-20241022

Source

pub fn with_claude_3_5_haiku(self) -> AnthropicCompatibleChatModelBuilder<true>

Set the model to claude-3-5-haiku-20241022

Source

pub fn with_claude_3_opus(self) -> AnthropicCompatibleChatModelBuilder<true>

Set the model to claude-3-opus-20240229

Source

pub fn with_claude_3_sonnet(self) -> AnthropicCompatibleChatModelBuilder<true>

Set the model to claude-3-sonnet-20240229

Source

pub fn with_claude_3_haiku(self) -> AnthropicCompatibleChatModelBuilder<true>

Set the model to claude-3-haiku-20240307

Source

pub fn with_client( self, client: AnthropicCompatibleClient, ) -> AnthropicCompatibleChatModelBuilder<WITH_NAME>

Set the client used to make requests to the Anthropic API.

Source§

impl AnthropicCompatibleChatModelBuilder<true>

Source

pub fn build(self) -> AnthropicCompatibleChatModel

Build the model.

Trait Implementations§

Source§

impl<const WITH_NAME: bool> Debug for AnthropicCompatibleChatModelBuilder<WITH_NAME>

Source§

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

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

impl<const WITH_NAME: bool> Default for AnthropicCompatibleChatModelBuilder<WITH_NAME>

Source§

fn default() -> AnthropicCompatibleChatModelBuilder<WITH_NAME>

Returns the “default value” for a type. Read more
Source§

impl ModelBuilder for AnthropicCompatibleChatModelBuilder<true>

Source§

type Model = AnthropicCompatibleChatModel

The model that this trait creates.
Source§

type Error = Infallible

An error that can occur when creating the model.
Source§

async fn start_with_loading_handler( self, _: impl FnMut(ModelLoadingProgress) + Send + Sync + 'static, ) -> Result<<AnthropicCompatibleChatModelBuilder<true> as ModelBuilder>::Model, <AnthropicCompatibleChatModelBuilder<true> as ModelBuilder>::Error>

Start the model with a loading handler.
Source§

fn requires_download(&self) -> bool

Check if the model will need to be downloaded before use (default: false)
Source§

fn start(self) -> impl Future<Output = Result<Self::Model, Self::Error>>
where Self: Sized,

Start the model.

Auto Trait Implementations§

§

impl<const WITH_NAME: bool> !Freeze for AnthropicCompatibleChatModelBuilder<WITH_NAME>

§

impl<const WITH_NAME: bool> !RefUnwindSafe for AnthropicCompatibleChatModelBuilder<WITH_NAME>

§

impl<const WITH_NAME: bool> Send for AnthropicCompatibleChatModelBuilder<WITH_NAME>

§

impl<const WITH_NAME: bool> Sync for AnthropicCompatibleChatModelBuilder<WITH_NAME>

§

impl<const WITH_NAME: bool> Unpin for AnthropicCompatibleChatModelBuilder<WITH_NAME>

§

impl<const WITH_NAME: bool> !UnwindSafe for AnthropicCompatibleChatModelBuilder<WITH_NAME>

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<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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<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<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

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