pub enum Provider {
OpenAi(OpenAiProvider),
Anthropic(AnthropicProvider),
Mock(MockProvider),
}Expand description
统一的 Provider 枚举,包装所有 Provider 实现
通过此枚举可以在需要动态分发时避免 dyn trait 的限制。
Variants§
Trait Implementations§
Source§impl LlmProvider for Provider
impl LlmProvider for Provider
async fn complete(&self, messages: &[Message]) -> Result<String>
async fn complete_stream(&self, messages: &[Message]) -> Result<Vec<String>>
Source§async fn complete_with_budget(
&self,
messages: &[Message],
max_output_tokens: Option<u32>,
) -> Result<String>
async fn complete_with_budget( &self, messages: &[Message], max_output_tokens: Option<u32>, ) -> Result<String>
带输出预算上限的完整(非流式)调用。 Read more
Source§fn call_count(&self) -> usize
fn call_count(&self) -> usize
返回已完成的 LLM 调用次数
Auto Trait Implementations§
impl !Freeze for Provider
impl !RefUnwindSafe for Provider
impl !UnwindSafe for Provider
impl Send for Provider
impl Sync for Provider
impl Unpin for Provider
impl UnsafeUnpin for Provider
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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