summaryrefslogtreecommitdiffstats
path: root/src/client/ollama.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/ollama.rs')
-rw-r--r--src/client/ollama.rs25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/client/ollama.rs b/src/client/ollama.rs
index f2340c6..a801242 100644
--- a/src/client/ollama.rs
+++ b/src/client/ollama.rs
@@ -1,12 +1,11 @@
use super::{
- catch_error, message::*, Client, ExtraConfig, Model, ModelConfig, OllamaClient, PromptType,
+ catch_error, message::*, ExtraConfig, Model, ModelConfig, OllamaClient, PromptType,
ReplyHandler, SendData,
};
use crate::utils::PromptKind;
use anyhow::{anyhow, bail, Result};
-use async_trait::async_trait;
use futures_util::StreamExt;
use reqwest::{Client as ReqwestClient, RequestBuilder};
use serde::Deserialize;
@@ -22,26 +21,6 @@ pub struct OllamaConfig {
pub extra: Option<ExtraConfig>,
}
-#[async_trait]
-impl Client for OllamaClient {
- client_common_fns!();
-
- async fn send_message_inner(&self, client: &ReqwestClient, data: SendData) -> Result<String> {
- let builder = self.request_builder(client, data)?;
- send_message(builder).await
- }
-
- async fn send_message_streaming_inner(
- &self,
- client: &ReqwestClient,
- handler: &mut ReplyHandler,
- data: SendData,
- ) -> Result<()> {
- let builder = self.request_builder(client, data)?;
- send_message_streaming(builder, handler).await
- }
-}
-
impl OllamaClient {
list_models_fn!(OllamaConfig);
config_get_fn!(api_key, get_api_key);
@@ -79,6 +58,8 @@ impl OllamaClient {
}
}
+impl_client_trait!(OllamaClient, send_message, send_message_streaming);
+
async fn send_message(builder: RequestBuilder) -> Result<String> {
let res = builder.send().await?;
let status = res.status();