Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ollama-rs/src/generation/completion/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct GenerationRequest<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub template: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub raw: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub context: Option<GenerationContext>,
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<FormatType>,
Expand All @@ -46,6 +48,7 @@ impl<'a> GenerationRequest<'a> {
options: None,
system: None,
template: None,
raw: None,
context: None,
format: None,
keep_alive: None,
Expand Down Expand Up @@ -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);
Expand Down
Loading