From 8c1f39af453bd2afcc71cf903ba0c803ff313092 Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Sat, 24 May 2025 12:06:23 +0000 Subject: [PATCH] Add "raw" parameter to GenerationRequest --- ollama-rs/src/generation/completion/request.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ollama-rs/src/generation/completion/request.rs b/ollama-rs/src/generation/completion/request.rs index 7e6b588..3803081 100644 --- a/ollama-rs/src/generation/completion/request.rs +++ b/ollama-rs/src/generation/completion/request.rs @@ -28,6 +28,8 @@ pub struct GenerationRequest<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub template: Option>, #[serde(skip_serializing_if = "Option::is_none")] + pub raw: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub context: Option, #[serde(skip_serializing_if = "Option::is_none")] pub format: Option, @@ -46,6 +48,7 @@ impl<'a> GenerationRequest<'a> { options: None, system: None, template: None, + raw: None, context: None, format: None, keep_alive: None, @@ -96,6 +99,12 @@ impl<'a> GenerationRequest<'a> { self } + /// If `true` no formatting will be applied to the prompt. You may choose to use the `raw` parameter if you are specifying a full templated prompt in your request to the API + pub fn raw(mut self, raw: bool) -> Self { + self.raw = Some(raw); + self + } + /// The context parameter returned from a previous request to /generate, this can be used to keep a short conversational memory pub fn context(mut self, context: GenerationContext) -> Self { self.context = Some(context);