From d478497205fe7b24f54e2b828d5a4350368da89d Mon Sep 17 00:00:00 2001 From: Dan Hicks Date: Sun, 23 Mar 2025 14:25:24 -0700 Subject: [PATCH 1/2] set via an argument in --- r/R/llm-use.R | 2 ++ r/R/m-backend-submit.R | 2 +- r/mall.Rproj | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/r/R/llm-use.R b/r/R/llm-use.R index ac4bedf..f640306 100644 --- a/r/R/llm-use.R +++ b/r/R/llm-use.R @@ -45,6 +45,7 @@ llm_use <- function( backend = NULL, model = NULL, + output = "text", ..., .silent = FALSE, .cache = NULL, @@ -91,6 +92,7 @@ llm_use <- function( m_defaults_set( backend = backend, model = model, + output = output, .cache = cache, ... ) diff --git a/r/R/m-backend-submit.R b/r/R/m-backend-submit.R index 4f78546..559c4f7 100644 --- a/r/R/m-backend-submit.R +++ b/r/R/m-backend-submit.R @@ -28,7 +28,7 @@ m_backend_submit.mall_ollama <- function(backend, x, prompt, preview = FALSE) { \(x) { .args <- c( messages = list(map(prompt, \(i) map(i, \(j) glue(j, x = x)))), - output = "text", + # output = "text", m_defaults_args(backend) ) res <- NULL diff --git a/r/mall.Rproj b/r/mall.Rproj index eaa6b81..8238950 100644 --- a/r/mall.Rproj +++ b/r/mall.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: 80851bf4-539e-478d-944c-84a2f4c9527b RestoreWorkspace: Default SaveWorkspace: Default From 69bd15b451f4064e73ce022ae456c9fe5fedba43 Mon Sep 17 00:00:00 2001 From: Dan Hicks Date: Sun, 23 Mar 2025 14:33:36 -0700 Subject: [PATCH 2/2] m_backend_submit.mall_ollama doesn't assume text output --- r/R/m-backend-submit.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/r/R/m-backend-submit.R b/r/R/m-backend-submit.R index 559c4f7..c9298c4 100644 --- a/r/R/m-backend-submit.R +++ b/r/R/m-backend-submit.R @@ -20,8 +20,10 @@ m_backend_submit.mall_ollama <- function(backend, x, prompt, preview = FALSE) { if (preview) { x <- head(x, 1) map_here <- map - } else { + } else if (identical(m_defaults_args(backend)$output, "text")) { map_here <- map_chr + } else { + map_here <- map } map_here( x,