You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -76,7 +81,7 @@ impl LlmGenerationClient for Client {
76
81
// println!("Anthropic API full response: {resp_json:?}");
77
82
78
83
let resp_content = &resp_json["content"];
79
-
let tool_name = "extraction";
84
+
let tool_name = "report_result";
80
85
letmut extracted_json:Option<Value> = None;
81
86
ifletSome(array) = resp_content.as_array(){
82
87
for item in array {
@@ -95,17 +100,17 @@ impl LlmGenerationClient for Client {
95
100
serde_json::to_string(&json)?
96
101
}else{
97
102
// Fallback: try text if no tool output found
98
-
match&resp_json["content"][0]["text"]{
103
+
match&mutresp_json["content"][0]["text"]{
99
104
Value::String(s) => {
100
105
// Try strict JSON parsing first
101
106
match serde_json::from_str::<serde_json::Value>(s){
102
-
Ok(_) => s.clone(),
107
+
Ok(_) => std::mem::take(s),
103
108
Err(e) => {
104
109
// Try permissive json5 parsing as fallback
105
110
match json5::from_str::<serde_json::Value>(s){
106
-
Ok(_) => {
111
+
Ok(value) => {
107
112
println!("[Anthropic] Used permissive JSON5 parser for output");
108
-
s.clone()
113
+
serde_json::to_string(&value)?
109
114
},
110
115
Err(e2) => returnErr(anyhow::anyhow!(format!("No structured tool output or text found in response, and permissive JSON5 parsing also failed: {e}; {e2}")))
0 commit comments