pub struct OpenAIProvider { /* private fields */ }
Expand description
OpenAI provider implementation
Implementations§
Source§impl OpenAIProvider
impl OpenAIProvider
Sourcepub fn new(config: LLMProviderConfig) -> LLMResult<Self>
pub fn new(config: LLMProviderConfig) -> LLMResult<Self>
Create new OpenAI provider
Trait Implementations§
Source§impl Debug for OpenAIProvider
impl Debug for OpenAIProvider
Source§impl LLMProvider for OpenAIProvider
impl LLMProvider for OpenAIProvider
Source§fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 LLMRequest,
) -> Pin<Box<dyn Future<Output = LLMResult<LLMResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 LLMRequest,
) -> Pin<Box<dyn Future<Output = LLMResult<LLMResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate a response for the given request Read more
Source§fn list_models<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = LLMResult<Vec<ModelInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_models<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = LLMResult<Vec<ModelInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List available models for this provider
Source§fn capabilities(&self) -> &LLMCapabilities
fn capabilities(&self) -> &LLMCapabilities
Get provider capabilities
Source§fn get_model_info<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 str,
) -> Pin<Box<dyn Future<Output = LLMResult<ModelInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_model_info<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 str,
) -> Pin<Box<dyn Future<Output = LLMResult<ModelInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get information about a specific model
Source§fn supports_model<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 str,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn supports_model<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 str,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a model is supported
Source§fn estimate_tokens(&self, text: &str) -> usize
fn estimate_tokens(&self, text: &str) -> usize
Estimate token count for text (optional override)
Source§fn validate_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 LLMRequest,
) -> Pin<Box<dyn Future<Output = LLMResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 LLMRequest,
) -> Pin<Box<dyn Future<Output = LLMResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate a request before sending
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = LLMResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = LLMResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Health check for the provider
Source§fn handle_create_message<'life0, 'async_trait>(
&'life0 self,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = LLMResult<CreateMessageResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_create_message<'life0, 'async_trait>(
&'life0 self,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = LLMResult<CreateMessageResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle MCP CreateMessageRequest (adapts to LLM types) Read more
Auto Trait Implementations§
impl Freeze for OpenAIProvider
impl RefUnwindSafe for OpenAIProvider
impl Send for OpenAIProvider
impl Sync for OpenAIProvider
impl Unpin 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