pub struct OpenAI { /* private fields */ }Implementations§
Source§impl OpenAI
impl OpenAI
pub fn new(api_key: String) -> Self
pub fn with_model(self, model: OpenAIModel) -> Self
pub fn gpt4(self) -> Self
pub fn gpt4_turbo(self) -> Self
pub fn gpt35_turbo(self) -> Self
pub fn o1_preview(self) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
pub fn with_max_tokens(self, max_tokens: u32) -> Self
pub fn with_top_p(self, top_p: f32) -> Self
pub fn with_base_url(self, base_url: &str) -> Self
pub fn with_json_mode(self) -> Self
Trait Implementations§
Source§impl LLM for OpenAI
impl LLM for OpenAI
fn generate( &self, prompt: &str, ) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + '_>>
fn generate_with_options( &self, prompt: &str, options: LLMOptions, ) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + '_>>
fn chat( &self, messages: Vec<ChatMessage>, ) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + '_>>
fn get_model_name(&self) -> &str
fn get_provider_name(&self) -> &str
fn get_provider_enum(&self) -> ModelProvider
fn supports_function_calling(&self) -> bool
fn supports_json_mode(&self) -> bool
fn max_context_length(&self) -> Option<usize>
fn generate_batch( &self, prompts: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<LLMResult>>> + Send + '_>>
Auto Trait Implementations§
impl Freeze for OpenAI
impl !RefUnwindSafe for OpenAI
impl Send for OpenAI
impl Sync for OpenAI
impl Unpin for OpenAI
impl UnsafeUnpin for OpenAI
impl !UnwindSafe for OpenAI
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