pub struct AnthropicProvider { /* private fields */ }Implementations§
Source§impl AnthropicProvider
impl AnthropicProvider
pub fn new( base_url: impl Into<String>, api_key: impl Into<String>, model: impl Into<String>, ) -> Self
pub fn with_temperature(self, t: f64) -> Self
pub fn with_max_tokens(self, n: u32) -> Self
pub fn with_retry_policy(self, policy: RetryPolicy) -> Self
Sourcepub fn with_search_engine(self, engine: Arc<dyn ToolSearchEngine>) -> Self
pub fn with_search_engine(self, engine: Arc<dyn ToolSearchEngine>) -> Self
Replace the default KeywordSearchEngine with a custom
implementation. Useful for tests that want to assert on
which tools the search returns.
Trait Implementations§
Source§impl Clone for AnthropicProvider
impl Clone for AnthropicProvider
Source§fn clone(&self) -> AnthropicProvider
fn clone(&self) -> AnthropicProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AnthropicProvider
impl Debug for AnthropicProvider
Source§impl LlmProvider for AnthropicProvider
impl LlmProvider for AnthropicProvider
Source§fn complete_with_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
eager_tools: &'life2 [(ToolSpec, Option<String>)],
deferred_tools: &'life3 [(ToolSpec, Option<String>)],
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn complete_with_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
eager_tools: &'life2 [(ToolSpec, Option<String>)],
deferred_tools: &'life3 [(ToolSpec, Option<String>)],
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Search-aware completion: model sees eager tools + the
ToolSearchTool; deferred tools are sent with
defer_loading: true and only become callable after the
model asks for them via ToolSearchTool.
fn complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
stream_tx: Option<StreamSender>,
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
stream_tx: Option<StreamSender>,
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stream a completion token-by-token. Read more
Source§fn complete_structured<'life0, 'async_trait>(
&'life0 self,
_req: StructuredRequest,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete_structured<'life0, 'async_trait>(
&'life0 self,
_req: StructuredRequest,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Request a JSON response conforming to a caller-supplied schema.
Default impl returns an error. Providers that support structured
output (e.g. OpenAI-compatible) override this.
Source§fn complete_simple<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
_temperature: f32,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete_simple<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
_temperature: f32,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Simple completion with a single user prompt. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for AnthropicProvider
impl !UnwindSafe for AnthropicProvider
impl Freeze for AnthropicProvider
impl Send for AnthropicProvider
impl Sync for AnthropicProvider
impl Unpin for AnthropicProvider
impl UnsafeUnpin for AnthropicProvider
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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