pub struct CloudBackend { /* private fields */ }Expand description
Cloud backend. Builds a genai::Client once at construction; the
service holds an Arc<dyn SummarizerBackend> so this struct is
cheap to clone.
Implementations§
Source§impl CloudBackend
impl CloudBackend
Sourcepub fn new(
name: impl Into<String>,
provider: ProviderKind,
model: impl Into<String>,
base_url: Option<String>,
api_key: Option<String>,
) -> Result<Self, BackendError>
pub fn new( name: impl Into<String>, provider: ProviderKind, model: impl Into<String>, base_url: Option<String>, api_key: Option<String>, ) -> Result<Self, BackendError>
Build a cloud backend.
name— config-key name (e.g. “fast”).provider— parsed provider kind.model— the literal model id passed to genai (e.g. “gpt-4o-mini”).base_url— only used whenprovider == OpenAiCompat. For native providers, passNone.api_key— whenSome, installs an explicit auth override. WhenNone, genai’s default env-var resolution applies (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.).
Trait Implementations§
Source§impl Clone for CloudBackend
impl Clone for CloudBackend
Source§fn clone(&self) -> CloudBackend
fn clone(&self) -> CloudBackend
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 CloudBackend
impl Debug for CloudBackend
Source§impl SummarizerBackend for CloudBackend
impl SummarizerBackend for CloudBackend
fn compact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
content: &'life1 str,
opts: &'life2 CompactOpts,
) -> Pin<Box<dyn Future<Output = Result<String, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn model_id(&self) -> &str
fn model_id(&self) -> &str
Resolved model identifier for
params_hash. The default "" is
intended only for the extractive backend (which has no model). All
cloud / network-backed backends MUST override this with their
resolved model id so the cache key partitions across model versions.Source§fn uses_model_prompt(&self) -> bool
fn uses_model_prompt(&self) -> bool
Whether this backend feeds
content into a model prompt (and is thus an
injection target needing HIGH internal hardening). Prompt-free backends
(e.g. extractive TextRank) return false.Auto Trait Implementations§
impl !RefUnwindSafe for CloudBackend
impl !UnwindSafe for CloudBackend
impl Freeze for CloudBackend
impl Send for CloudBackend
impl Sync for CloudBackend
impl Unpin for CloudBackend
impl UnsafeUnpin for CloudBackend
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,
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