MCPcopy Create free account
hub / github.com/AI45Lab/Code / build_parse_failure_repair

Function build_parse_failure_repair

core/src/llm/structured.rs:1107–1115  ·  view source on GitHub ↗

Repair prompt for when nothing parseable was produced at all.

(raw_text: &str)

Source from the content-addressed store, hash-verified

1105
1106/// Repair prompt for when nothing parseable was produced at all.
1107fn build_parse_failure_repair(raw_text: &str) -> String {
1108 if raw_text.trim().is_empty() {
1109 return "Your previous response contained no JSON. Respond with ONLY a single valid JSON object that matches the schema — no prose, no markdown, no analysis, and put the object in your reply content (not in a thinking/reasoning aside).".to_string();
1110 }
1111 format!(
1112 "Your previous output could not be parsed as a JSON object:\n\n{}\n\nReturn ONLY a single valid JSON object matching the schema — no prose, no markdown.",
1113 truncate_utf8(raw_text, 2000)
1114 )
1115}
1116
1117fn build_repair_message(raw_text: &str, errors: &[String]) -> String {
1118 // Truncate raw output in repair message to avoid blowing context

Callers 1

generate_blockingFunction · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected