pub struct OllamaProvider { /* private fields */ }Expand description
Ollama服务提供商
由于Ollama具有特殊的模型管理功能,我们使用自定义Provider实现 而不是GenericProvider模式。
Implementations§
Source§impl OllamaProvider
impl OllamaProvider
Sourcepub fn new(base_url: &str) -> Result<Self, LlmConnectorError>
pub fn new(base_url: &str) -> Result<Self, LlmConnectorError>
Sourcepub fn with_config(
base_url: &str,
timeout_secs: Option<u64>,
proxy: Option<&str>,
) -> Result<Self, LlmConnectorError>
pub fn with_config( base_url: &str, timeout_secs: Option<u64>, proxy: Option<&str>, ) -> Result<Self, LlmConnectorError>
创建带有自定义配置的Ollama提供商
Sourcepub async fn pull_model(
&self,
model_name: &str,
) -> Result<(), LlmConnectorError>
pub async fn pull_model( &self, model_name: &str, ) -> Result<(), LlmConnectorError>
Sourcepub async fn delete_model(
&self,
model_name: &str,
) -> Result<(), LlmConnectorError>
pub async fn delete_model( &self, model_name: &str, ) -> Result<(), LlmConnectorError>
Sourcepub async fn show_model(
&self,
model_name: &str,
) -> Result<OllamaModelInfo, LlmConnectorError>
pub async fn show_model( &self, model_name: &str, ) -> Result<OllamaModelInfo, LlmConnectorError>
Sourcepub async fn model_exists(
&self,
model_name: &str,
) -> Result<bool, LlmConnectorError>
pub async fn model_exists( &self, model_name: &str, ) -> Result<bool, LlmConnectorError>
检查模型是否存在
Trait Implementations§
Source§impl Clone for OllamaProvider
impl Clone for OllamaProvider
Source§fn clone(&self) -> OllamaProvider
fn clone(&self) -> OllamaProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OllamaProvider
impl Debug for OllamaProvider
Source§impl Provider for OllamaProvider
impl Provider for OllamaProvider
Source§fn models<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, LlmConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn models<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, LlmConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
获取可用模型列表
Source§fn chat<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn chat<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
聊天完成
Auto Trait Implementations§
impl Freeze for OllamaProvider
impl !RefUnwindSafe for OllamaProvider
impl Send for OllamaProvider
impl Sync for OllamaProvider
impl Unpin for OllamaProvider
impl !UnwindSafe for OllamaProvider
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