From ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 22 May 2024 21:29:23 +0800 Subject: feat: allow patching req body with client config (#534) --- src/client/ollama.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/client/ollama.rs') diff --git a/src/client/ollama.rs b/src/client/ollama.rs index 24d2dfe..37a3667 100644 --- a/src/client/ollama.rs +++ b/src/client/ollama.rs @@ -1,6 +1,6 @@ use super::{ - catch_error, message::*, CompletionOutput, ExtraConfig, Model, ModelData, OllamaClient, - PromptAction, PromptKind, SendData, SseHandler, + catch_error, message::*, Client, CompletionOutput, ExtraConfig, Model, ModelData, ModelPatches, + OllamaClient, PromptAction, PromptKind, SendData, SseHandler, }; use anyhow::{anyhow, bail, Result}; @@ -16,6 +16,7 @@ pub struct OllamaConfig { pub api_auth: Option, pub chat_endpoint: Option, pub models: Vec, + pub patches: Option, pub extra: Option, } @@ -40,7 +41,7 @@ impl OllamaClient { let api_auth = self.get_api_auth().ok(); let mut body = build_body(data, &self.model)?; - self.model.merge_extra_fields(&mut body); + self.patch_request_body(&mut body); let chat_endpoint = self.config.chat_endpoint.as_deref().unwrap_or("/api/chat"); -- cgit v1.2.3