pub struct OllamaClient {
pub endpoint: String,
pub model: String,
/* private fields */
}
Fields§
§endpoint: String
§model: String
Implementations§
Source§impl OllamaClient
impl OllamaClient
pub fn new(endpoint: String, model: String) -> Self
pub fn set_debug_mode(&mut self, debug: bool)
pub fn debug_mode(&self) -> bool
pub async fn add_tool(&mut self, tool: Tool) -> Result<(), Box<dyn Error>>
pub async fn is_fallback_mode(&self) -> bool
pub async fn supports_tool_calls(&self) -> Result<bool, Box<dyn Error>>
pub async fn list_local_models(&self) -> Result<Vec<Model>, Box<dyn Error>>
pub async fn get_available_models(&self) -> Result<Vec<Model>, Box<dyn Error>>
pub async fn show_model_info( &self, model_name: &str, ) -> Result<ModelInfo, Box<dyn Error>>
pub async fn pull_model(&self, model_name: &str) -> Result<(), Box<dyn Error>>
pub async fn pull_model_stream( &self, model_name: &str, ) -> Result<Pin<Box<dyn Stream<Item = Result<PullProgress, String>> + Send>>, Box<dyn Error>>
pub async fn send_chat_request_with_images( &self, messages: &[Message], image_paths: Vec<String>, ) -> Result<Pin<Box<dyn Stream<Item = Result<ChatStreamItem, String>> + Send>>, Box<dyn Error>>
pub async fn send_chat_request_with_images_no_stream( &self, messages: &[Message], image_paths: Vec<String>, ) -> Result<(String, Option<Vec<ToolCall>>), Box<dyn Error>>
pub async fn send_chat_request_with_images_stream_and_options( &self, messages: &[Message], image_paths: Vec<String>, options: Option<OllamaOptions>, ) -> Result<Pin<Box<dyn Stream<Item = Result<ChatStreamItem, String>> + Send>>, Box<dyn Error>>
pub async fn send_chat_request_with_images_no_stream_and_options( &self, messages: &[Message], image_paths: Vec<String>, options: Option<OllamaOptions>, ) -> Result<(String, Option<Vec<ToolCall>>), Box<dyn Error>>
pub async fn send_chat_request_with_images_data( &self, messages: &[Message], images_data: Vec<Vec<u8>>, ) -> Result<Pin<Box<dyn Stream<Item = Result<ChatStreamItem, String>> + Send>>, Box<dyn Error>>
pub async fn send_chat_request_with_images_data_no_stream( &self, messages: &[Message], images_data: Vec<Vec<u8>>, ) -> Result<(String, Option<Vec<ToolCall>>), Box<dyn Error>>
pub async fn send_chat_request_with_images_data_stream_and_options( &self, messages: &[Message], images_data: Vec<Vec<u8>>, options: Option<OllamaOptions>, ) -> Result<Pin<Box<dyn Stream<Item = Result<ChatStreamItem, String>> + Send>>, Box<dyn Error>>
pub async fn send_chat_request_with_images_data_no_stream_and_options( &self, messages: &[Message], images_data: Vec<Vec<u8>>, options: Option<OllamaOptions>, ) -> Result<(String, Option<Vec<ToolCall>>), 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 send_chat_request_no_stream_with_options( &self, messages: &[Message], options: Option<OllamaOptions>, ) -> Result<(String, Option<Vec<ToolCall>>), Box<dyn Error>>
pub async fn send_chat_request_stream( &self, messages: &[Message], ) -> Result<Pin<Box<dyn Stream<Item = Result<ChatStreamItem, String>> + Send>>, Box<dyn Error>>
pub async fn send_chat_request_stream_with_options( &self, messages: &[Message], options: Option<OllamaOptions>, ) -> Result<Pin<Box<dyn Stream<Item = Result<ChatStreamItem, String>> + Send>>, Box<dyn Error>>
pub async fn generate(&self, prompt: &str) -> Result<String, Box<dyn Error>>
pub async fn generate_with_options( &self, prompt: &str, options: Option<OllamaOptions>, ) -> Result<String, Box<dyn Error>>
pub async fn generate_stream( &self, prompt: &str, ) -> Result<Pin<Box<dyn Stream<Item = Result<String, String>> + Send>>, Box<dyn Error>>
pub async fn generate_stream_with_options( &self, prompt: &str, options: Option<OllamaOptions>, ) -> Result<Pin<Box<dyn Stream<Item = Result<String, String>> + Send>>, 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 OllamaClient
impl !RefUnwindSafe for OllamaClient
impl Send for OllamaClient
impl Sync for OllamaClient
impl Unpin for OllamaClient
impl !UnwindSafe for OllamaClient
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