pub struct OpenAIClient {
pub model: String,
/* private fields */
}
Fields§
§model: String
Implementations§
Source§impl OpenAIClient
impl OpenAIClient
pub fn new(api_key: String, model: String) -> Self
pub async fn add_tool(&mut self, tool: Tool) -> Result<(), Box<dyn Error>>
pub async fn is_fallback_mode(&self) -> bool
pub fn set_debug_mode(&mut self, _debug: bool)
pub fn debug_mode(&self) -> bool
pub async fn supports_tool_calls(&self) -> Result<bool, Box<dyn Error>>
pub async fn get_available_models( &self, ) -> Result<Vec<OpenAIModel>, Box<dyn Error>>
pub async fn send_chat_request( &self, messages: &[Message], ) -> Result<Pin<Box<dyn Stream<Item = Result<ChatStreamItem, String>> + Send>>, Box<dyn Error>>
pub async fn send_chat_request_no_stream( &self, messages: &[Message], ) -> Result<(String, Option<Vec<ToolCall>>), Box<dyn Error>>
pub async fn handle_tool_calls(&self, tool_calls: Vec<ToolCall>) -> Vec<Message>
pub async fn process_fallback_response( &self, content: &str, ) -> (String, Option<Vec<ToolCall>>)
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