learn: score_ranges is now required; short-circuit on empty
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 <poc@bcachefs.org>
This commit is contained in:
parent
e5dd8312c7
commit
77822992c8
1 changed files with 5 additions and 3 deletions
|
|
@ -129,16 +129,18 @@ async fn call_score(
|
|||
ranges: &[(usize, usize)],
|
||||
priority: Option<i32>,
|
||||
) -> anyhow::Result<Vec<ScoreResult>> {
|
||||
// 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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue