From 77822992c86531d842bdb7bb0a9048ba2e69e46d Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 16 Apr 2026 12:19:28 -0400 Subject: [PATCH] learn: score_ranges is now required; short-circuit on empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vllm's /v1/score endpoint made score_ranges a required field (the messages-mode fallback that used to pattern-scan for assistant boundaries is gone). Always send the field, and if we have nothing to score, skip the HTTP round-trip entirely instead of letting the server 422 us. Response parsing is unchanged — serde ignores the renamed range_index field and the dropped role field since we only extract total_logprob. Co-Authored-By: Proof of Concept --- src/subconscious/learn.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/subconscious/learn.rs b/src/subconscious/learn.rs index c3ad348..9b65f2a 100644 --- a/src/subconscious/learn.rs +++ b/src/subconscious/learn.rs @@ -129,16 +129,18 @@ async fn call_score( ranges: &[(usize, usize)], priority: Option, ) -> anyhow::Result> { + // Nothing to score — skip the round-trip. + if ranges.is_empty() { + return Ok(Vec::new()); + } let url = format!("{}/score", client.base_url()); let auth = format!("Bearer {}", client.api_key()); let mut body = serde_json::json!({ "model": client.model, "prompt": prompt, + "score_ranges": ranges, "logprobs": 1, }); - if !ranges.is_empty() { - body["score_ranges"] = serde_json::json!(ranges); - } if let Some(p) = priority { body["priority"] = serde_json::json!(p); }