pub struct OpenAIClient { /* private fields */ }Expand description
OpenAI client implementation
Implementations§
Source§impl OpenAIClient
impl OpenAIClient
Sourcepub fn new(
api_key: String,
model: String,
temperature: f32,
max_tokens: u32,
retry_attempts: u32,
retry_delay_ms: u64,
) -> Self
pub fn new( api_key: String, model: String, temperature: f32, max_tokens: u32, retry_attempts: u32, retry_delay_ms: u64, ) -> Self
Create new OpenAIClient (using default base_url)
Sourcepub fn new_with_base_url(
api_key: String,
model: String,
temperature: f32,
max_tokens: u32,
retry_attempts: u32,
retry_delay_ms: u64,
base_url: String,
) -> Self
pub fn new_with_base_url( api_key: String, model: String, temperature: f32, max_tokens: u32, retry_attempts: u32, retry_delay_ms: u64, base_url: String, ) -> Self
Create a new OpenAIClient with custom base_url support
Sourcepub fn new_with_base_url_and_timeout(
api_key: String,
model: String,
temperature: f32,
max_tokens: u32,
retry_attempts: u32,
retry_delay_ms: u64,
base_url: String,
request_timeout_seconds: u64,
) -> Self
pub fn new_with_base_url_and_timeout( api_key: String, model: String, temperature: f32, max_tokens: u32, retry_attempts: u32, retry_delay_ms: u64, base_url: String, request_timeout_seconds: u64, ) -> Self
Create a new OpenAIClient with custom base_url and timeout support
Sourcepub fn from_config(config: &AIConfig) -> Result<Self>
pub fn from_config(config: &AIConfig) -> Result<Self>
Create client from unified configuration
Trait Implementations§
Source§impl AIProvider for OpenAIClient
impl AIProvider for OpenAIClient
Source§fn analyze_content<'life0, 'async_trait>(
&'life0 self,
request: AnalysisRequest,
) -> Pin<Box<dyn Future<Output = Result<MatchResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn analyze_content<'life0, 'async_trait>(
&'life0 self,
request: AnalysisRequest,
) -> Pin<Box<dyn Future<Output = Result<MatchResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Analyze multimedia files and subtitle files for matching results. Read more
Source§fn verify_match<'life0, 'async_trait>(
&'life0 self,
verification: VerificationRequest,
) -> Pin<Box<dyn Future<Output = Result<ConfidenceScore>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn verify_match<'life0, 'async_trait>(
&'life0 self,
verification: VerificationRequest,
) -> Pin<Box<dyn Future<Output = Result<ConfidenceScore>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Verify file matching confidence. Read more
Source§impl Debug for OpenAIClient
impl Debug for OpenAIClient
Source§impl HttpRetryClient for OpenAIClient
impl HttpRetryClient for OpenAIClient
Source§fn retry_attempts(&self) -> u32
fn retry_attempts(&self) -> u32
Number of retry attempts.
Source§fn retry_delay_ms(&self) -> u64
fn retry_delay_ms(&self) -> u64
Delay between retries in milliseconds.
Source§async fn make_request_with_retry(
&self,
request: RequestBuilder,
) -> Result<Response>
async fn make_request_with_retry( &self, request: RequestBuilder, ) -> Result<Response>
Make an HTTP request with retry logic.
Source§impl PromptBuilder for OpenAIClient
impl PromptBuilder for OpenAIClient
Source§fn build_analysis_prompt(&self, request: &AnalysisRequest) -> String
fn build_analysis_prompt(&self, request: &AnalysisRequest) -> String
Build analysis prompt.
Source§fn build_verification_prompt(&self, request: &VerificationRequest) -> String
fn build_verification_prompt(&self, request: &VerificationRequest) -> String
Build verification prompt.
Source§fn get_analysis_system_message() -> &'static str
fn get_analysis_system_message() -> &'static str
System message for analysis prompt.
Source§fn get_verification_system_message() -> &'static str
fn get_verification_system_message() -> &'static str
System message for verification prompt.
Source§impl ResponseParser for OpenAIClient
impl ResponseParser for OpenAIClient
Source§fn parse_match_result(&self, response: &str) -> Result<MatchResult>
fn parse_match_result(&self, response: &str) -> Result<MatchResult>
Parse match result.
Source§fn parse_confidence_score(&self, response: &str) -> Result<ConfidenceScore>
fn parse_confidence_score(&self, response: &str) -> Result<ConfidenceScore>
Parse confidence score.
Auto Trait Implementations§
impl Freeze for OpenAIClient
impl !RefUnwindSafe for OpenAIClient
impl Send for OpenAIClient
impl Sync for OpenAIClient
impl Unpin for OpenAIClient
impl !UnwindSafe for OpenAIClient
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