Add native Qwen reasoning events usage and continuation
This commit is contained in:
+591
-50
@@ -202,6 +202,7 @@ impl CreateRequest {
|
||||
return Err(("text.format", "json_schema needs a valid local schema"));
|
||||
}
|
||||
}
|
||||
reasoning_effort(self)?;
|
||||
let mut names = HashSet::new();
|
||||
for tool in &self.tools {
|
||||
let Some(name) = tool.get("name").and_then(Value::as_str) else {
|
||||
@@ -455,10 +456,10 @@ pub async fn create(
|
||||
.unwrap_or(&[])
|
||||
.to_vec();
|
||||
let tokenizer_for_decode = tokenizer.clone();
|
||||
let thinking = reasoning_enabled(&request);
|
||||
let finish = done.finish;
|
||||
let output = match tokio::task::spawn_blocking(move || {
|
||||
tokenizer_for_decode
|
||||
.decode(&output_ids)
|
||||
.map_err(|error| error.to_string())
|
||||
decode_generation(&tokenizer_for_decode, &output_ids, thinking, finish)
|
||||
})
|
||||
.await
|
||||
{
|
||||
@@ -490,7 +491,7 @@ pub async fn create(
|
||||
now.as_nanos(),
|
||||
NEXT_RESPONSE_ID.fetch_add(1, Ordering::Relaxed)
|
||||
);
|
||||
let items = match parse_output_items(&request, output, &id) {
|
||||
let (items, reasoning_tokens) = match decoded_items(&request, output, &id) {
|
||||
Ok(items) => items,
|
||||
Err(message) => {
|
||||
return api_error(
|
||||
@@ -505,7 +506,7 @@ pub async fn create(
|
||||
let usage = Usage {
|
||||
input_tokens: done.prompt_tokens,
|
||||
output_tokens: done.generated,
|
||||
reasoning_tokens: 0,
|
||||
reasoning_tokens,
|
||||
cached_tokens: done.reused.unwrap_or(0),
|
||||
};
|
||||
match ResponseTrace::build_with_terminal(
|
||||
@@ -576,6 +577,160 @@ fn parse_output_items(
|
||||
Ok(items)
|
||||
}
|
||||
|
||||
fn reasoning_effort(request: &CreateRequest) -> Result<Effort, (&'static str, &'static str)> {
|
||||
let Some(value) = &request.reasoning else {
|
||||
return Ok(Effort::XHigh);
|
||||
};
|
||||
let fields = value
|
||||
.as_object()
|
||||
.ok_or(("reasoning", "reasoning must be an object"))?;
|
||||
if fields
|
||||
.keys()
|
||||
.any(|key| !matches!(key.as_str(), "effort" | "summary"))
|
||||
{
|
||||
return Err(("reasoning", "only effort and summary are supported"));
|
||||
}
|
||||
if fields
|
||||
.get("summary")
|
||||
.is_some_and(|value| !value.is_null() && value != "auto")
|
||||
{
|
||||
return Err((
|
||||
"reasoning.summary",
|
||||
"only auto or null is supported; this runtime returns raw reasoning content with an empty summary",
|
||||
));
|
||||
}
|
||||
match fields.get("effort") {
|
||||
None | Some(Value::Null) => Ok(Effort::XHigh),
|
||||
Some(Value::String(effort)) => match effort.as_str() {
|
||||
"none" => Ok(Effort::None),
|
||||
"low" => Ok(Effort::Low),
|
||||
"medium" => Ok(Effort::Medium),
|
||||
"high" => Ok(Effort::High),
|
||||
"xhigh" => Ok(Effort::XHigh),
|
||||
_ => Err(("reasoning.effort", "use none, low, medium, high or xhigh")),
|
||||
},
|
||||
_ => Err(("reasoning.effort", "effort must be a string or null")),
|
||||
}
|
||||
}
|
||||
|
||||
fn reasoning_enabled(request: &CreateRequest) -> bool {
|
||||
reasoning_effort(request).is_ok_and(|effort| effort != Effort::None)
|
||||
}
|
||||
|
||||
struct DecodedGeneration {
|
||||
answer: String,
|
||||
reasoning: Option<(String, bool)>,
|
||||
reasoning_tokens: u64,
|
||||
}
|
||||
|
||||
fn decode_generation(
|
||||
tokenizer: &Tokenizer,
|
||||
ids: &[u32],
|
||||
reasoning: bool,
|
||||
finish: Finish,
|
||||
) -> Result<DecodedGeneration, String> {
|
||||
let bytes = tokenizer.decode_bytes(ids).map_err(|e| e.to_string())?;
|
||||
if !reasoning {
|
||||
return Ok(DecodedGeneration {
|
||||
answer: String::from_utf8_lossy(&bytes).into_owned(),
|
||||
reasoning: None,
|
||||
reasoning_tokens: 0,
|
||||
});
|
||||
}
|
||||
let marker = b"</think>";
|
||||
let boundary = bytes.windows(marker.len()).position(|part| part == marker);
|
||||
let Some(boundary) = boundary else {
|
||||
if finish != Finish::Length {
|
||||
return Err("reasoning ended without </think>".into());
|
||||
}
|
||||
return Ok(DecodedGeneration {
|
||||
answer: String::new(),
|
||||
reasoning: Some((String::from_utf8_lossy(&bytes).into_owned(), false)),
|
||||
reasoning_tokens: ids.len() as u64,
|
||||
});
|
||||
};
|
||||
let mut consumed = 0;
|
||||
let mut reasoning_tokens = 0;
|
||||
for id in ids {
|
||||
consumed += tokenizer
|
||||
.decode_bytes(&[*id])
|
||||
.map_err(|e| e.to_string())?
|
||||
.len();
|
||||
reasoning_tokens += 1;
|
||||
if consumed >= boundary + marker.len() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(DecodedGeneration {
|
||||
answer: String::from_utf8_lossy(&bytes[boundary + marker.len()..])
|
||||
.trim_start_matches('\n')
|
||||
.to_owned(),
|
||||
reasoning: Some((
|
||||
String::from_utf8_lossy(&bytes[..boundary]).into_owned(),
|
||||
true,
|
||||
)),
|
||||
reasoning_tokens,
|
||||
})
|
||||
}
|
||||
|
||||
fn decoded_items(
|
||||
request: &CreateRequest,
|
||||
decoded: DecodedGeneration,
|
||||
id: &str,
|
||||
) -> Result<(Vec<OutputItem>, u64), String> {
|
||||
let mut items = Vec::new();
|
||||
let mut reasoning_incomplete = false;
|
||||
if let Some((text, complete)) = decoded.reasoning {
|
||||
items.push(OutputItem::Reasoning {
|
||||
deltas: vec![text],
|
||||
complete,
|
||||
});
|
||||
reasoning_incomplete = !complete;
|
||||
}
|
||||
if !reasoning_incomplete {
|
||||
items.extend(parse_output_items(request, decoded.answer, id)?);
|
||||
}
|
||||
Ok((items, decoded.reasoning_tokens))
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct ReasoningStream {
|
||||
pending: Vec<u8>,
|
||||
ended: bool,
|
||||
}
|
||||
|
||||
impl ReasoningStream {
|
||||
fn push(&mut self, bytes: &[u8]) -> String {
|
||||
if self.ended {
|
||||
return String::new();
|
||||
}
|
||||
self.pending.extend_from_slice(bytes);
|
||||
let marker = b"</think>";
|
||||
if let Some(at) = self
|
||||
.pending
|
||||
.windows(marker.len())
|
||||
.position(|part| part == marker)
|
||||
{
|
||||
let text = String::from_utf8_lossy(&self.pending[..at]).into_owned();
|
||||
self.pending.clear();
|
||||
self.ended = true;
|
||||
return text;
|
||||
}
|
||||
let keep = (1..marker.len())
|
||||
.rev()
|
||||
.find(|n| self.pending.ends_with(&marker[..*n]))
|
||||
.unwrap_or(0);
|
||||
let tail = self.pending.split_off(self.pending.len() - keep);
|
||||
let text = drain_utf8(&mut self.pending, false);
|
||||
self.pending.extend_from_slice(&tail);
|
||||
text
|
||||
}
|
||||
|
||||
fn finish(&mut self) -> String {
|
||||
drain_utf8(&mut self.pending, true)
|
||||
}
|
||||
}
|
||||
|
||||
fn is_structured(request: &CreateRequest) -> bool {
|
||||
request
|
||||
.text
|
||||
@@ -584,9 +739,9 @@ fn is_structured(request: &CreateRequest) -> bool {
|
||||
}
|
||||
|
||||
fn render_request_prompt(request: &CreateRequest) -> Result<String, String> {
|
||||
let mut owned = Vec::<(Role, String)>::new();
|
||||
let mut owned = Vec::<(Role, String, Option<String>)>::new();
|
||||
if let Some(instructions) = &request.instructions {
|
||||
owned.push((Role::System, instructions.clone()));
|
||||
owned.push((Role::System, instructions.clone(), None));
|
||||
}
|
||||
if let Some(options) = &request.text {
|
||||
let instruction = match &options.format {
|
||||
@@ -598,11 +753,11 @@ fn render_request_prompt(request: &CreateRequest) -> Result<String, String> {
|
||||
if !request.tools.is_empty() {
|
||||
instruction.push_str(" Function calls still use the tool-call format; this JSON requirement applies to your final text answer after any necessary tool results.");
|
||||
}
|
||||
owned.push((Role::System, instruction));
|
||||
owned.push((Role::System, instruction, None));
|
||||
}
|
||||
}
|
||||
if let Some(input) = request.input.as_str() {
|
||||
owned.push((Role::User, input.to_owned()));
|
||||
owned.push((Role::User, input.to_owned(), None));
|
||||
} else {
|
||||
let items = request
|
||||
.input
|
||||
@@ -610,12 +765,39 @@ fn render_request_prompt(request: &CreateRequest) -> Result<String, String> {
|
||||
.ok_or("input must be a string or array")?;
|
||||
let mut calls = Vec::<(String, String)>::new();
|
||||
let mut outputs = Vec::<(String, String)>::new();
|
||||
let mut reasoning = None::<String>;
|
||||
for item in items {
|
||||
let kind = item
|
||||
.get("type")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("message");
|
||||
match kind {
|
||||
"reasoning" => {
|
||||
if reasoning.is_some() || !calls.is_empty() {
|
||||
return Err(
|
||||
"reasoning must precede its assistant message or tool calls".into()
|
||||
);
|
||||
}
|
||||
if item.get("encrypted_content").is_some_and(|v| !v.is_null()) {
|
||||
return Err("encrypted reasoning replay is not supported".into());
|
||||
}
|
||||
let parts = item
|
||||
.get("content")
|
||||
.and_then(Value::as_array)
|
||||
.ok_or("reasoning replay requires raw reasoning_text content")?;
|
||||
let mut text = String::new();
|
||||
for part in parts {
|
||||
if part.get("type").and_then(Value::as_str) != Some("reasoning_text") {
|
||||
return Err("reasoning replay requires reasoning_text parts".into());
|
||||
}
|
||||
text.push_str(
|
||||
part.get("text")
|
||||
.and_then(Value::as_str)
|
||||
.ok_or("reasoning_text needs text")?,
|
||||
);
|
||||
}
|
||||
reasoning = Some(text);
|
||||
}
|
||||
"message" => {
|
||||
if !calls.is_empty() {
|
||||
return Err(
|
||||
@@ -651,7 +833,12 @@ fn render_request_prompt(request: &CreateRequest) -> Result<String, String> {
|
||||
}
|
||||
_ => return Err("input message needs text content".into()),
|
||||
};
|
||||
owned.push((role, content));
|
||||
if role != Role::Assistant
|
||||
&& let Some(thought) = reasoning.take()
|
||||
{
|
||||
owned.push((Role::Assistant, String::new(), Some(thought)));
|
||||
}
|
||||
owned.push((role, content, reasoning.take()));
|
||||
}
|
||||
"function_call" => {
|
||||
if !outputs.is_empty() {
|
||||
@@ -733,8 +920,8 @@ fn render_request_prompt(request: &CreateRequest) -> Result<String, String> {
|
||||
.map(|(_, value)| format!("<tool_response>\n{value}\n</tool_response>"))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
owned.push((Role::Assistant, call_text));
|
||||
owned.push((Role::User, output_text));
|
||||
owned.push((Role::Assistant, call_text, reasoning.take()));
|
||||
owned.push((Role::User, output_text, None));
|
||||
calls.clear();
|
||||
outputs.clear();
|
||||
}
|
||||
@@ -745,16 +932,27 @@ fn render_request_prompt(request: &CreateRequest) -> Result<String, String> {
|
||||
if !calls.is_empty() {
|
||||
return Err("replayed function calls need all tool outputs".into());
|
||||
}
|
||||
if reasoning.is_some() {
|
||||
return Err(
|
||||
"reasoning replay needs a following assistant message, tool call, or user turn"
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
}
|
||||
let messages = owned
|
||||
.iter()
|
||||
.map(|(role, content)| Message {
|
||||
.map(|(role, content, reasoning)| Message {
|
||||
role: *role,
|
||||
content,
|
||||
reasoning: None,
|
||||
reasoning: reasoning.as_deref(),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
prompt::render_with_tools(&messages, Effort::None, &request.tools).map_err(str::to_owned)
|
||||
prompt::render_with_tools(
|
||||
&messages,
|
||||
reasoning_effort(request).map_err(|(_, message)| message.to_owned())?,
|
||||
&request.tools,
|
||||
)
|
||||
.map_err(str::to_owned)
|
||||
}
|
||||
|
||||
fn stream_live_text(
|
||||
@@ -763,8 +961,8 @@ fn stream_live_text(
|
||||
mut source: mpsc::Receiver<Result<Event, String>>,
|
||||
history: Option<Arc<RwLock<ResponseHistory>>>,
|
||||
) -> Response {
|
||||
if is_structured(&request) {
|
||||
return stream_live_structured(request, tokenizer, source, history);
|
||||
if is_structured(&request) || reasoning_enabled(&request) {
|
||||
return stream_live_buffered(request, tokenizer, source, history);
|
||||
}
|
||||
if !request.tools.is_empty() {
|
||||
return stream_live_tools(request, tokenizer, source, history);
|
||||
@@ -924,7 +1122,7 @@ fn stream_live_text(
|
||||
// Structured output is withheld until DONE so schema-invalid text cannot be
|
||||
// mistaken for a successful result by a streaming client. Disconnect still
|
||||
// drops the live engine receiver immediately.
|
||||
fn stream_live_structured(
|
||||
fn stream_live_buffered(
|
||||
request: CreateRequest,
|
||||
tokenizer: Arc<Tokenizer>,
|
||||
mut source: mpsc::Receiver<Result<Event, String>>,
|
||||
@@ -939,11 +1137,21 @@ fn stream_live_structured(
|
||||
NEXT_RESPONSE_ID.fetch_add(1, Ordering::Relaxed)
|
||||
);
|
||||
let created_at = now.as_secs();
|
||||
let thinking = reasoning_enabled(&request);
|
||||
let initial_item = if thinking {
|
||||
OutputItem::Reasoning {
|
||||
deltas: vec![],
|
||||
complete: false,
|
||||
}
|
||||
} else {
|
||||
OutputItem::Text { deltas: vec![] }
|
||||
};
|
||||
let reasoning_id = format!("rs_{}_0", &id[5..]);
|
||||
// An incomplete trace permits empty text; only its in-progress envelope
|
||||
// is sent here. Completed output is validated separately below.
|
||||
let initial = ResponseTrace::build_with_terminal(
|
||||
&request,
|
||||
&[OutputItem::Text { deltas: vec![] }],
|
||||
&[initial_item],
|
||||
Usage {
|
||||
input_tokens: 0,
|
||||
output_tokens: 0,
|
||||
@@ -960,7 +1168,11 @@ fn stream_live_structured(
|
||||
let (sender, receiver) = mpsc::channel(16);
|
||||
tokio::spawn(async move {
|
||||
let mut sequence = 0;
|
||||
for event in initial.events.into_iter().take(2) {
|
||||
for event in initial
|
||||
.events
|
||||
.into_iter()
|
||||
.take(if thinking { 4 } else { 2 })
|
||||
{
|
||||
if sender.send(event).await.is_err() {
|
||||
return;
|
||||
}
|
||||
@@ -970,6 +1182,7 @@ fn stream_live_structured(
|
||||
tokenizer.special_id("<|im_end|>"),
|
||||
tokenizer.special_id("<|endoftext|>"),
|
||||
];
|
||||
let mut reasoning_stream = ReasoningStream::default();
|
||||
let mut tokens = Vec::new();
|
||||
let mut ended = false;
|
||||
let mut done = None;
|
||||
@@ -984,6 +1197,17 @@ fn stream_live_structured(
|
||||
if terminal.contains(&Some(token)) {
|
||||
ended = true;
|
||||
} else {
|
||||
if thinking {
|
||||
let bytes = match tokenizer.decode_bytes(&[token]) {
|
||||
Ok(bytes) => bytes,
|
||||
Err(error) => {
|
||||
failure = Some(error.to_string());
|
||||
break;
|
||||
}
|
||||
};
|
||||
let delta = reasoning_stream.push(&bytes);
|
||||
if !delta.is_empty() && !send_stream_event(&sender, &mut sequence, "response.reasoning_text.delta", json!({"response_id":id,"item_id":reasoning_id,"output_index":0,"content_index":0,"delta":delta})).await { return; }
|
||||
}
|
||||
tokens.push(token);
|
||||
}
|
||||
}
|
||||
@@ -999,22 +1223,26 @@ fn stream_live_structured(
|
||||
}
|
||||
}
|
||||
if let Some(done) = done.filter(|done| done.finish != Finish::Cancel) {
|
||||
if thinking && done.finish == Finish::Length {
|
||||
let delta = reasoning_stream.finish();
|
||||
if !delta.is_empty() && !send_stream_event(&sender, &mut sequence, "response.reasoning_text.delta", json!({"response_id":id,"item_id":reasoning_id,"output_index":0,"content_index":0,"delta":delta})).await { return; }
|
||||
}
|
||||
let decoded = tokio::task::spawn_blocking(move || {
|
||||
tokenizer.decode(&tokens).map_err(|e| e.to_string())
|
||||
decode_generation(&tokenizer, &tokens, thinking, done.finish)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
.and_then(|result| result);
|
||||
let assembled = decoded
|
||||
.and_then(|output| parse_output_items(&request, output, &id))
|
||||
.and_then(|items| {
|
||||
.and_then(|output| decoded_items(&request, output, &id))
|
||||
.and_then(|(items, reasoning_tokens)| {
|
||||
ResponseTrace::build_with_terminal(
|
||||
&request,
|
||||
&items,
|
||||
Usage {
|
||||
input_tokens: done.prompt_tokens,
|
||||
output_tokens: done.generated,
|
||||
reasoning_tokens: 0,
|
||||
reasoning_tokens,
|
||||
cached_tokens: done.reused.unwrap_or(0),
|
||||
},
|
||||
&id,
|
||||
@@ -1040,10 +1268,16 @@ fn stream_live_structured(
|
||||
failure = Some(error.to_owned());
|
||||
}
|
||||
if failure.is_none() {
|
||||
for event in trace.events.into_iter().skip(2) {
|
||||
for mut event in trace.events.into_iter().skip(if thinking { 4 } else { 2 })
|
||||
{
|
||||
if thinking && event["type"] == "response.reasoning_text.delta" {
|
||||
continue;
|
||||
}
|
||||
event["sequence_number"] = json!(sequence);
|
||||
if sender.send(event).await.is_err() {
|
||||
return;
|
||||
}
|
||||
sequence += 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1417,29 +1651,6 @@ async fn send_stream_event(
|
||||
}
|
||||
|
||||
fn validate_live_subset(request: &CreateRequest) -> Result<(), (&'static str, &'static str)> {
|
||||
if request
|
||||
.reasoning
|
||||
.as_ref()
|
||||
.and_then(|value| value.get("effort"))
|
||||
.and_then(Value::as_str)
|
||||
!= Some("none")
|
||||
{
|
||||
return Err((
|
||||
"reasoning",
|
||||
"the text inference preview requires reasoning.effort=none",
|
||||
));
|
||||
}
|
||||
if request
|
||||
.reasoning
|
||||
.as_ref()
|
||||
.and_then(Value::as_object)
|
||||
.is_none_or(|fields| fields.keys().any(|key| key != "effort"))
|
||||
{
|
||||
return Err((
|
||||
"reasoning",
|
||||
"the text inference preview only supports effort=none",
|
||||
));
|
||||
}
|
||||
if request
|
||||
.tool_choice
|
||||
.as_ref()
|
||||
@@ -1474,6 +1685,10 @@ fn api_error(
|
||||
#[derive(Clone, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum OutputItem {
|
||||
Reasoning {
|
||||
deltas: Vec<String>,
|
||||
complete: bool,
|
||||
},
|
||||
Text {
|
||||
deltas: Vec<String>,
|
||||
},
|
||||
@@ -1585,6 +1800,31 @@ impl ResponseTrace {
|
||||
.collect();
|
||||
for (index, item) in items.iter().enumerate() {
|
||||
match item {
|
||||
OutputItem::Reasoning { deltas, complete } => {
|
||||
if !complete && !incomplete {
|
||||
return Err("unfinished reasoning needs an incomplete response".into());
|
||||
}
|
||||
let item_id = format!("rs_{}_{}", &id[5..], index);
|
||||
let pending = json!({"id":item_id,"type":"reasoning","status":"in_progress","summary":[],"content":[]});
|
||||
emitter.push(
|
||||
"response.output_item.added",
|
||||
json!({"response_id":id,"output_index":index,"item":pending}),
|
||||
);
|
||||
emitter.push("response.content_part.added", json!({"response_id":id,"item_id":item_id,"output_index":index,"content_index":0,"part":{"type":"reasoning_text","text":""}}));
|
||||
let whole = deltas.concat();
|
||||
for delta in deltas {
|
||||
emitter.push("response.reasoning_text.delta", json!({"response_id":id,"item_id":item_id,"output_index":index,"content_index":0,"delta":delta}));
|
||||
}
|
||||
emitter.push("response.reasoning_text.done", json!({"response_id":id,"item_id":item_id,"output_index":index,"content_index":0,"text":whole}));
|
||||
let part = json!({"type":"reasoning_text","text":whole});
|
||||
emitter.push("response.content_part.done", json!({"response_id":id,"item_id":item_id,"output_index":index,"content_index":0,"part":part}));
|
||||
let done = json!({"id":item_id,"type":"reasoning","status":if *complete {"completed"} else {"incomplete"},"summary":[],"content":[part]});
|
||||
emitter.push(
|
||||
"response.output_item.done",
|
||||
json!({"response_id":id,"output_index":index,"item":done}),
|
||||
);
|
||||
output.push(done);
|
||||
}
|
||||
OutputItem::Text { deltas } => {
|
||||
has_text = true;
|
||||
let item_id = format!("msg_{}_{}", &id[5..], index);
|
||||
@@ -2028,6 +2268,7 @@ mod tests {
|
||||
#[test]
|
||||
fn stateless_function_result_replay_keeps_call_ids_and_text() {
|
||||
let request = make_request(json!({
|
||||
"reasoning":{"effort":"none"},
|
||||
"input": [
|
||||
{"role":"user","content":[{"type":"input_text","text":"Weather in Oslo?"}]},
|
||||
{"type":"function_call","call_id":"call_1","name":"lookup","arguments":"{\"city\":\"Oslo\",\"days\":2}"},
|
||||
@@ -2449,6 +2690,303 @@ mod tests {
|
||||
fs::remove_dir_all(root).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reasoning_marker_and_unicode_split_at_every_byte() {
|
||||
let input = "Коротка думка</think>\n\n4".as_bytes();
|
||||
for split in 0..=input.len() {
|
||||
let mut stream = ReasoningStream::default();
|
||||
let text = stream.push(&input[..split]) + &stream.push(&input[split..]);
|
||||
assert_eq!(text, "Коротка думка");
|
||||
assert!(stream.ended);
|
||||
assert!(stream.finish().is_empty());
|
||||
}
|
||||
let (tokenizer, root) = test_tokenizer();
|
||||
for special in [false, true] {
|
||||
let ids = tokenizer.encode("Reason.</think>\n\n4", special).unwrap();
|
||||
let decoded = decode_generation(&tokenizer, &ids, true, Finish::Stop).unwrap();
|
||||
assert_eq!(decoded.reasoning, Some(("Reason.".into(), true)));
|
||||
assert_eq!(decoded.answer, "4");
|
||||
assert_eq!(decoded.reasoning_tokens, if special { 8 } else { 15 });
|
||||
}
|
||||
fs::remove_dir_all(root).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reasoning_effort_uses_pinned_template_and_validates_options() {
|
||||
let default = make_request(json!({}));
|
||||
assert_eq!(reasoning_effort(&default).unwrap(), Effort::XHigh);
|
||||
assert!(
|
||||
render_request_prompt(&default)
|
||||
.unwrap()
|
||||
.ends_with("<think>\n")
|
||||
);
|
||||
for effort in ["none", "low", "medium", "high", "xhigh"] {
|
||||
let r = make_request(json!({"reasoning":{"effort":effort,"summary":"auto"}}));
|
||||
assert!(r.validate().is_ok());
|
||||
let prompt = render_request_prompt(&r).unwrap();
|
||||
assert_eq!(prompt.ends_with("</think>\n\n"), effort == "none");
|
||||
if effort == "low" {
|
||||
assert!(prompt.contains("Keep your thinking brief"));
|
||||
}
|
||||
}
|
||||
for value in [
|
||||
json!({"effort":"invalid"}),
|
||||
json!({"effort":7}),
|
||||
json!({"summary":"detailed"}),
|
||||
json!("low"),
|
||||
] {
|
||||
assert!(make_request(json!({"reasoning":value})).validate().is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn live_reasoning_routes_separate_content_usage_tools_and_structured_output() {
|
||||
for stream in [false, true] {
|
||||
for (answer, finish, expected, structured) in [
|
||||
("Сума.</think>\n\n4", Finish::Stop, "completed", false),
|
||||
(
|
||||
"Сума.</think>\n\n{\"answer\":4}",
|
||||
Finish::Stop,
|
||||
"completed",
|
||||
true,
|
||||
),
|
||||
(
|
||||
"Tool.</think>\n\n<tool_call>\n<function=lookup>\n<parameter=city>\nOslo\n</parameter>\n</function>\n</tool_call>",
|
||||
Finish::Stop,
|
||||
"completed",
|
||||
false,
|
||||
),
|
||||
("Not finished</th", Finish::Length, "incomplete", true),
|
||||
("Missing boundary", Finish::Stop, "failed", false),
|
||||
] {
|
||||
let (tokenizer, root) = test_tokenizer();
|
||||
let ids = tokenizer.encode(answer, false).unwrap();
|
||||
let (commands, mut received) = mpsc::channel::<GenerationCommand>(1);
|
||||
let mut state = AppState::default();
|
||||
state.worker.write().await.state = WorkerState::Ready;
|
||||
state.tokenizer = Some(tokenizer.clone());
|
||||
state.generation = Some(commands);
|
||||
let worker = tokio::spawn(async move {
|
||||
let command = received.recv().await.unwrap();
|
||||
assert!(
|
||||
tokenizer
|
||||
.decode(&command.request.token_ids)
|
||||
.unwrap()
|
||||
.ends_with("<think>\n")
|
||||
);
|
||||
let generated = ids.len() as u64;
|
||||
let mut events = ids.into_iter().map(Event::Token).collect::<Vec<_>>();
|
||||
events.push(Event::Done(Done {
|
||||
generated,
|
||||
prompt_tokens: command.request.token_ids.len() as u64,
|
||||
prompt_ms: 1.0,
|
||||
decode_ms: 2.0,
|
||||
finish,
|
||||
drafts_accepted: None,
|
||||
drafts_offered: None,
|
||||
reused: None,
|
||||
expert_hits: None,
|
||||
expert_lookups: None,
|
||||
}));
|
||||
match command.result {
|
||||
GenerationResult::Buffered(sender) => {
|
||||
sender.send(Ok(events)).unwrap();
|
||||
}
|
||||
GenerationResult::Streaming(sender) => {
|
||||
for event in events {
|
||||
sender.send(Ok(event)).await.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
let mut payload = json!({"model":"strata-local","input":"Compute","stream":stream,"reasoning":{"effort":"low","summary":"auto"},"tools":[{"type":"function","name":"lookup","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}]});
|
||||
if structured {
|
||||
payload["text"] = json!({"format":{"type":"json_object"}});
|
||||
}
|
||||
let response = create(State(state.clone()), Ok(Json(payload))).await;
|
||||
let mut deltas = String::new();
|
||||
let final_response = if stream {
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
let mut body = response.into_body();
|
||||
let mut events = Vec::new();
|
||||
while let Some(frame) = body.frame().await {
|
||||
let event = parse_sse(&frame.unwrap().into_data().unwrap());
|
||||
if event["type"] == "response.reasoning_text.delta" {
|
||||
deltas.push_str(event["delta"].as_str().unwrap());
|
||||
}
|
||||
events.push(event);
|
||||
}
|
||||
for (n, event) in events.iter().enumerate() {
|
||||
assert_eq!(event["sequence_number"], n);
|
||||
}
|
||||
assert_eq!(
|
||||
events.last().unwrap()["type"],
|
||||
format!("response.{expected}")
|
||||
);
|
||||
assert_eq!(
|
||||
events
|
||||
.iter()
|
||||
.filter(|e| matches!(
|
||||
e["type"].as_str(),
|
||||
Some(
|
||||
"response.completed"
|
||||
| "response.incomplete"
|
||||
| "response.failed"
|
||||
)
|
||||
))
|
||||
.count(),
|
||||
1
|
||||
);
|
||||
events.last().unwrap()["response"].clone()
|
||||
} else {
|
||||
assert_eq!(
|
||||
response.status(),
|
||||
if expected == "failed" {
|
||||
StatusCode::BAD_GATEWAY
|
||||
} else {
|
||||
StatusCode::OK
|
||||
}
|
||||
);
|
||||
serde_json::from_slice::<Value>(
|
||||
&to_bytes(response.into_body(), usize::MAX).await.unwrap(),
|
||||
)
|
||||
.unwrap()
|
||||
};
|
||||
if expected != "failed" {
|
||||
let reasoning = &final_response["output"][0];
|
||||
assert_eq!(reasoning["type"], "reasoning");
|
||||
assert_eq!(reasoning["summary"], json!([]));
|
||||
let thought = answer.split("</think>").next().unwrap();
|
||||
assert_eq!(reasoning["content"][0]["text"], thought);
|
||||
if stream {
|
||||
assert_eq!(deltas, thought);
|
||||
}
|
||||
let count =
|
||||
final_response["usage"]["output_tokens_details"]["reasoning_tokens"]
|
||||
.as_u64()
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
count,
|
||||
if finish == Finish::Length {
|
||||
answer.len()
|
||||
} else {
|
||||
thought.len() + 8
|
||||
} as u64
|
||||
);
|
||||
assert!(count <= final_response["usage"]["output_tokens"].as_u64().unwrap());
|
||||
if finish == Finish::Length {
|
||||
assert_eq!(final_response["output"].as_array().unwrap().len(), 1);
|
||||
assert_eq!(reasoning["status"], "incomplete");
|
||||
} else if answer.starts_with("Tool") {
|
||||
assert_eq!(final_response["output"][1]["type"], "function_call");
|
||||
} else {
|
||||
assert_eq!(
|
||||
final_response["output"][1]["content"][0]["text"],
|
||||
answer.split("</think>\n\n").nth(1).unwrap()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
assert!(state.response_history.read().await.entries.is_empty());
|
||||
}
|
||||
worker.await.unwrap();
|
||||
fs::remove_dir_all(root).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn reasoning_stream_publishes_thought_before_done_and_keeps_final_separate() {
|
||||
let (tokenizer, root) = test_tokenizer();
|
||||
let (sender, source) = mpsc::channel(128);
|
||||
let request = make_request(json!({"reasoning":{"effort":"low"}}));
|
||||
let mut body = stream_live_text(request, tokenizer.clone(), source, None).into_body();
|
||||
for _ in 0..4 {
|
||||
body.frame().await.unwrap().unwrap();
|
||||
}
|
||||
sender.send(Ok(Event::Token(65))).await.unwrap();
|
||||
let frame = tokio::time::timeout(std::time::Duration::from_secs(1), body.frame())
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let event = parse_sse(&frame.into_data().unwrap());
|
||||
assert_eq!(event["type"], "response.reasoning_text.delta");
|
||||
assert_eq!(event["delta"], "A");
|
||||
for id in tokenizer.encode("</think>\n\n4", false).unwrap() {
|
||||
sender.send(Ok(Event::Token(id))).await.unwrap();
|
||||
}
|
||||
assert!(
|
||||
tokio::time::timeout(std::time::Duration::from_millis(25), body.frame())
|
||||
.await
|
||||
.is_err()
|
||||
);
|
||||
sender
|
||||
.send(Ok(Event::Done(Done {
|
||||
generated: 12,
|
||||
prompt_tokens: 4,
|
||||
prompt_ms: 1.0,
|
||||
decode_ms: 2.0,
|
||||
finish: Finish::Stop,
|
||||
drafts_accepted: None,
|
||||
drafts_offered: None,
|
||||
reused: None,
|
||||
expert_hits: None,
|
||||
expert_lookups: None,
|
||||
})))
|
||||
.await
|
||||
.unwrap();
|
||||
drop(sender);
|
||||
let mut last = None;
|
||||
while let Some(frame) = body.frame().await {
|
||||
last = Some(parse_sse(&frame.unwrap().into_data().unwrap()));
|
||||
}
|
||||
assert_eq!(
|
||||
last.unwrap()["response"]["output"][1]["content"][0]["text"],
|
||||
"4"
|
||||
);
|
||||
fs::remove_dir_all(root).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reasoning_replay_preserves_tool_context_and_rejects_opaque_substitution() {
|
||||
let output = json!([
|
||||
{"type":"reasoning","summary":[],"content":[{"type":"reasoning_text","text":"Need the checked code."}]},
|
||||
{"type":"function_call","call_id":"call_1","name":"lookup","arguments":"{}"}
|
||||
]);
|
||||
let mut history = ResponseHistory::default();
|
||||
history
|
||||
.insert(
|
||||
"resp_checked",
|
||||
"strata-local",
|
||||
&json!("Check the code"),
|
||||
&output,
|
||||
)
|
||||
.unwrap();
|
||||
let mut transcript = history
|
||||
.get("resp_checked", "strata-local")
|
||||
.unwrap()
|
||||
.to_vec();
|
||||
transcript.push(json!({"type":"function_call_output","call_id":"call_1","output":"731"}));
|
||||
let request = make_request(json!({"input":transcript,"reasoning":{"effort":"low"}}));
|
||||
let prompt = render_request_prompt(&request).unwrap();
|
||||
assert!(prompt.contains("<think>\nNeed the checked code.\n</think>\n\n<tool_call>"));
|
||||
assert!(prompt.contains("<tool_response>\n731\n</tool_response>"));
|
||||
let mut invalid = request.clone();
|
||||
invalid.input[1] =
|
||||
json!({"type":"reasoning","summary":[{"type":"summary_text","text":"short"}]});
|
||||
assert!(render_request_prompt(&invalid).is_err());
|
||||
invalid.input[1] = json!({"type":"reasoning","content":[],"encrypted_content":"opaque"});
|
||||
assert!(render_request_prompt(&invalid).is_err());
|
||||
let truncated = make_request(
|
||||
json!({"input":[{"role":"user","content":"Check"},{"type":"reasoning","content":[{"type":"reasoning_text","text":"Unfinished"}]},{"role":"user","content":"Continue"}]}),
|
||||
);
|
||||
assert!(
|
||||
render_request_prompt(&truncated)
|
||||
.unwrap()
|
||||
.contains("<think>\nUnfinished\n</think>")
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn structured_live_routes_validate_text_and_preserve_tools_and_length() {
|
||||
let tool_xml = "<tool_call>\n<function=lookup>\n<parameter=city>\nOslo\n</parameter>\n</function>\n</tool_call>";
|
||||
@@ -2658,7 +3196,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn disconnected_sse_cancels_idle_text_and_tool_sources() {
|
||||
for mode in 0..3 {
|
||||
for mode in 0..4 {
|
||||
let with_tools = mode == 1;
|
||||
let (tokenizer, root) = test_tokenizer();
|
||||
let (engine_events, source) = mpsc::channel(2);
|
||||
@@ -2670,10 +3208,13 @@ mod tests {
|
||||
if mode == 2 {
|
||||
value["text"] = json!({"format":{"type":"json_object"}});
|
||||
}
|
||||
if mode == 3 {
|
||||
value["reasoning"] = json!({"effort":"low"});
|
||||
}
|
||||
let request = make_request(value);
|
||||
let mut body = stream_live_text(request, tokenizer, source, None).into_body();
|
||||
// Read the initial events so the relay reaches its idle source read.
|
||||
for _ in 0..if mode != 0 { 2 } else { 4 } {
|
||||
for _ in 0..if mode == 1 || mode == 2 { 2 } else { 4 } {
|
||||
tokio::time::timeout(std::time::Duration::from_secs(1), body.frame())
|
||||
.await
|
||||
.unwrap()
|
||||
|
||||
+42
-5
@@ -1,14 +1,14 @@
|
||||
# Responses contract status
|
||||
|
||||
The Rust control plane has a `POST /v1/responses` route and a reusable response trace builder. The route parses a subset of Responses requests and returns OpenAI-shaped JSON errors. It returns `503 worker_not_ready` until the engine handshake completes. With a configured native tokenizer it can execute a text, function-call and validated structured-output preview with `reasoning.effort: "none"`. It accepts string input or a text-only array of messages and paired function calls/results. Non-streaming and live SSE paths are connected to the resident worker; the latter sends text deltas and complete, schema-validated function calls before worker `DONE`. Unsupported live features return `501 unsupported_live_feature`; a ready worker without tokenizer returns `501 inference_adapter_missing`. Text/tool JSON and SSE, continuation, cancellation and crash recovery have passed small real-model Linux GPU checks; full recorded-agent qualification remains open.
|
||||
The Rust control plane has a `POST /v1/responses` route and a reusable response trace builder. The route parses a subset of Responses requests and returns OpenAI-shaped JSON errors. It returns `503 worker_not_ready` until the engine handshake completes. With a configured native tokenizer it can execute a text, function-call, reasoning and validated structured-output preview. It accepts string input or a text-only array of messages and paired function calls/results. Non-streaming and live SSE paths are connected to the resident worker; ordinary unstructured streams with effort none send text deltas and complete, schema-validated function calls before worker `DONE`. Reasoning streams send live reasoning deltas and buffer final answer/tool items; structured text is validated before publication. Unsupported live features return `501 unsupported_live_feature`; a ready worker without tokenizer returns `501 inference_adapter_missing`. Text/tool JSON and SSE, continuation, cancellation and crash recovery have passed small real-model Linux GPU checks; full recorded-agent qualification remains open.
|
||||
|
||||
The offline trace builder accepts text fragments, function-call argument fragments, and token usage. It assembles a non-streaming response or an ordered SSE stream ending in `response.completed`. Tool arguments must form a JSON object. `text.format` supports `text`, `json_object`, and `json_schema` validation in both live serving and the offline builder. External schema references are rejected. The synthetic fixture at `benchmarks/fixtures/responses/structured-tool.json` demonstrates text plus a tool call; it is not evidence of live Codex compatibility.
|
||||
|
||||
`control-plane/src/wire.rs` encodes the upstream `GEN` request line and parses the current `T`, `PP`, `DONE`, and `ERR` output lines. The supervisor accepts an internal token-ID generation command, checks its context budget, and sends it to a resident worker. It can return a buffered result or stream bounded token events. Dropping the SSE receiver cancels generation. Native Qwen prompt assembly matches pinned text-only and one representative tool golden case byte-for-byte. The live Qwen parser holds split call markers and rejects incomplete calls; it validates full argument objects before publishing function-call events.
|
||||
|
||||
Current request parsing supports `model`, string or array `input`, `stream`, `instructions`, `max_output_tokens`, `previous_response_id`, `parallel_tool_calls`, `reasoning`, `text`, named function `tools`, `tool_choice`, `temperature`, `top_p`, `truncation`, `metadata`, and `store`. Unknown fields are rejected. Terminal responses are stored by default; `store: false` disables this. `previous_response_id` replays a stored response with the new input, including function calls and matching results. The store is process-local and bounded to 64 responses or 128 MiB, whichever is reached first; old IDs become unavailable after eviction or restart. Parsing support does not imply execution support for reasoning or multimodal input. The body limit is 16 MiB.
|
||||
Current request parsing supports `model`, string or array `input`, `stream`, `instructions`, `max_output_tokens`, `previous_response_id`, `parallel_tool_calls`, `reasoning`, `text`, named function `tools`, `tool_choice`, `temperature`, `top_p`, `truncation`, `metadata`, and `store`. Unknown fields are rejected. Terminal responses are stored by default; `store: false` disables this. `previous_response_id` replays a stored response with the new input, including function calls and matching results. The store is process-local and bounded to 64 responses or 128 MiB, whichever is reached first; old IDs become unavailable after eviction or restart. Multimodal input remains unsupported. The body limit is 16 MiB.
|
||||
|
||||
Before switching the testing runtime, exercise all engine stop conditions and tool calls with the real tokenizer and model on Linux GPU, and compare sanitized real Codex replays against the upstream Python server. Live reasoning remains unsupported. Do not mark Gate A complete based on synthetic fixtures.
|
||||
Before switching the testing runtime, exercise all engine stop conditions and tool calls with the real tokenizer and model on Linux GPU, and compare sanitized real Codex replays against the upstream Python server. Native reasoning now has its own output items, streaming events and continuation path. Do not mark Gate A complete based on synthetic fixtures.
|
||||
|
||||
## Engine prefix metadata
|
||||
|
||||
@@ -51,7 +51,7 @@ operator. A real-model reload has passed; sustained soak remains open.
|
||||
|
||||
## Live structured text
|
||||
|
||||
Requests with `reasoning.effort: "none"` may select `text.format.type` as
|
||||
Requests may select `text.format.type` as
|
||||
`json_object` or `json_schema`. The runtime adds JSON-format instructions and,
|
||||
for schemas, the schema itself to the model prompt. Invalid schemas and external
|
||||
references are rejected before worker admission. Completed text must parse as
|
||||
@@ -83,4 +83,41 @@ Example format:
|
||||
|
||||
The field names and incomplete-result handling follow the
|
||||
[OpenAI structured output contract](https://developers.openai.com/api/docs/guides/structured-outputs).
|
||||
Native reasoning and recorded Codex/MCP replay remain separate milestones.
|
||||
Recorded Codex/MCP replay remains a separate milestone.
|
||||
|
||||
## Native Qwen reasoning
|
||||
|
||||
`reasoning.effort` accepts `none`, `low`, `medium`, `high`, or `xhigh`.
|
||||
Omitted/null effort uses upstream's `xhigh` default. The pinned model template
|
||||
maps `high` to its xhigh instruction; `none` closes the thinking block in the
|
||||
prompt. Effort is a template instruction, not a separate token budget.
|
||||
`max_output_tokens` includes both reasoning and answer tokens.
|
||||
|
||||
Generated reasoning is returned as an output item with `type: "reasoning"`,
|
||||
`content: [{"type":"reasoning_text","text":"..."}]` and `summary: []`.
|
||||
SSE emits `response.reasoning_text.delta` during generation, followed by its
|
||||
text/content/item done events and the normal answer or function-call events.
|
||||
The current reasoning path buffers the final answer/tool items until DONE;
|
||||
structured answers are validated before publication. `effort: none` plain-text
|
||||
and tool streaming retain their incremental behavior. Disconnect during
|
||||
reasoning cancels the worker generation.
|
||||
|
||||
The first Qwen `</think>` marker separates reasoning from answer text, even
|
||||
when split over tokens. A normal stop without that marker fails; a token-budget
|
||||
stop while thinking returns an incomplete reasoning item and no invented final
|
||||
answer. `usage.output_tokens_details.reasoning_tokens` counts original emitted
|
||||
tokens up to and including the closing-marker token; if one token straddles the
|
||||
boundary it is assigned to reasoning. Truncated thinking counts all its tokens.
|
||||
EOS tokens remain in total output usage, not reasoning usage.
|
||||
|
||||
Stored continuation and stateless replay preserve raw reasoning alongside
|
||||
assistant messages/tool calls in the Qwen template. Reasoning-only incomplete
|
||||
turns can precede a new user message. Summary-only and encrypted reasoning
|
||||
cannot reconstruct this local model's raw context and are rejected explicitly.
|
||||
`reasoning.summary: "auto"` or null is accepted, but no summarizer is implemented:
|
||||
summary remains empty, and raw text is never mislabeled as a summary. Explicit
|
||||
`concise`/`detailed` summaries are unsupported.
|
||||
|
||||
The reasoning content and event shapes follow the
|
||||
[Responses raw-reasoning extension](https://developers.openai.com/cookbook/articles/gpt-oss/handle-raw-cot).
|
||||
This local Qwen implementation does not provide OpenAI encrypted reasoning.
|
||||
|
||||
@@ -367,3 +367,50 @@ The test toolchain was installed into ignored `artifacts/tool-venv/` for this ru
|
||||
were removed after checks. Source model shards and production profiles were
|
||||
unchanged. Native reasoning remains a separate feature; full agent replay
|
||||
and soak are still required for production qualification.
|
||||
|
||||
## 2026-10-04 — native reasoning feature
|
||||
|
||||
- Added effort selection (`none/low/medium/high/xhigh`, default upstream xhigh),
|
||||
raw reasoning output items, live `response.reasoning_text.delta` events,
|
||||
separate final answer/tool items, original-token reasoning usage, and raw
|
||||
reasoning replay in stored/stateless tool continuation. Closing Qwen markers
|
||||
split across tokens are handled without leaking them into either text field.
|
||||
Thinking truncated by the output budget returns incomplete reasoning without
|
||||
inventing an answer; a normal stop missing the boundary fails explicitly.
|
||||
- Reasoning deltas stream live; final answer/tool items on this path are
|
||||
buffered until DONE. Structured answers remain schema-validated. There is no
|
||||
summarizer: `summary:auto` returns an empty summary plus raw reasoning content;
|
||||
raw thoughts are never labeled as summaries. Encrypted/summary-only context
|
||||
replay is unsupported. These limits are documented in `api-contract.md`.
|
||||
- **110 Rust tests**, formatting, Clippy with warnings denied, and diff checks
|
||||
passed. New tests cover UTF-8/marker splits at every byte, original special-
|
||||
token counting, effort validation/template selection, JSON/SSE parity,
|
||||
structured answers, typed tools, unfinished reasoning, live deltas before
|
||||
DONE, context replay, and idle cancellation. Existing no-reasoning paths pass.
|
||||
- **8/8 actual IQ3_S RTX 5090 feature checks passed** on the same baseline
|
||||
engine/hardware/configuration as the native Responses report. Requests were
|
||||
greedy, low effort unless marked default, maximum 512 output tokens except
|
||||
the one-token limit tests. SSE reasoning deltas concatenate exactly to final
|
||||
reasoning content; event sequences are contiguous with one terminal.
|
||||
|
||||
| Case | Reasoning / total output tokens | First reasoning delta | HTTP wall | Result |
|
||||
| --- | ---: | ---: | ---: | --- |
|
||||
| Low text JSON | 23 / 26 | N/A | 0.6743 s | Answer `4` |
|
||||
| One-token JSON | 1 / 1 | N/A | 0.0382 s | Incomplete reasoning |
|
||||
| Low text SSE | 23 / 26 | 0.0379 s | 0.2239 s | Answer `4` |
|
||||
| One-token SSE | 1 / 1 | 0.0337 s | 0.0342 s | Incomplete reasoning |
|
||||
| Reasoning + schema SSE | 26 / 33 | 0.3309 s | 0.6854 s | `{"answer":4}` |
|
||||
| Default effort SSE | 35 / 38 | 0.4384 s | 0.7320 s | Answer `4` |
|
||||
| Reasoning + tool JSON | 26 / 53 | N/A | 1.4660 s | Typed `record_value(7)` |
|
||||
| Tool result continuation SSE | 27 / 36 | 0.1575 s | 0.4135 s | `RECORDED-731` |
|
||||
|
||||
These are single sequential functional checks with mixed prefix reuse, not a
|
||||
paired throughput result or full model-quality evaluation. Private evidence:
|
||||
`/home/para/.cache/strata-next/native-reasoning-20261004` (includes the driver,
|
||||
raw responses/events, token usage and logs). Model files were not rehashed.
|
||||
Static CLI: **17,083,088 bytes**, SHA-256
|
||||
`949696b3e915cc662f6622cb284eab46fd8d372bc82233276a0d04a1bb82eb3b`.
|
||||
The isolated worker and temporary uploaded CLI/tokenizer/config were removed
|
||||
after measurement; the latest CLI is retained privately on the laptop.
|
||||
Production profiles remain unchanged. Full console-harness replay and sustained
|
||||
soak still remain; hosted Actions has not run.
|
||||
|
||||
Reference in New Issue
Block a user