true, CURLOPT_POST=>true, CURLOPT_TIMEOUT=>10, CURLOPT_SSL_VERIFYPEER=>false, CURLOPT_HTTPHEADER=>["Content-Type: application/json","Authorization: Bearer $key"], CURLOPT_POSTFIELDS=>json_encode(["model"=>"llama-3.3-70b-versatile", "messages"=>[["role"=>"system","content"=>$sys],["role"=>"user","content"=>$msg]], "max_tokens"=>100,"temperature"=>0])]); $r = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $d = json_decode($r, true); $text = $d["choices"][0]["message"]["content"] ?? "EMPTY"; // Parse $parsed = null; if (preg_match("/\{.*\}/s", $text, $m)) { $parsed = json_decode($m[0], true); } echo json_encode([ "groq_code" => $code, "llm_raw" => $text, "parsed" => $parsed, "tools" => $parsed["tools"] ?? [], "msg" => $msg ]); ?>