pub struct OpenAiProvider { /* private fields */ }Expand description
OpenAI-compatible HTTP provider.
Implementations§
Source§impl OpenAiProvider
impl OpenAiProvider
Sourcepub fn new(
base_url: impl Into<String>,
api_key: impl Into<String>,
max_concurrency: usize,
) -> Result<Self, ProviderError>
pub fn new( base_url: impl Into<String>, api_key: impl Into<String>, max_concurrency: usize, ) -> Result<Self, ProviderError>
Build a provider for base_url (e.g. https://api.openai.com/v1),
authenticating with api_key and issuing at most max_concurrency
concurrent chat requests per batch.
§Errors
Returns ProviderError::Transport if the HTTP client cannot be built.
Trait Implementations§
Source§impl InferenceProvider for OpenAiProvider
impl InferenceProvider for OpenAiProvider
Source§fn infer_batch<'life0, 'async_trait>(
&'life0 self,
request: InferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<InferenceResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn infer_batch<'life0, 'async_trait>(
&'life0 self,
request: InferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<InferenceResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run one batch of inputs through the model. Read more
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable backend-kind identity for logging and the
laminar.ai_calls
log (e.g. anthropic, openai, local). Constant per implementor.Source§fn intrinsic_labels(&self, _model: &str) -> Option<Vec<String>>
fn intrinsic_labels(&self, _model: &str) -> Option<Vec<String>>
Classifier labels intrinsic to a model, discovered from its own metadata.
Returns
None for backends that have none (remote providers, embedding
models). A local classifier returns its config.json id2label once the
model is on disk — the seam that lets a lazily downloaded classifier score
without the labels having been known at startup. The default is None.Auto Trait Implementations§
impl Freeze for OpenAiProvider
impl !RefUnwindSafe for OpenAiProvider
impl Send for OpenAiProvider
impl Sync for OpenAiProvider
impl Unpin for OpenAiProvider
impl UnsafeUnpin for OpenAiProvider
impl !UnwindSafe for OpenAiProvider
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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