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() -> Self

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) -> Self

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) -> Self

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

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<Self::Model, Self::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<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> 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,