]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server: add "verbose" field to schema (#24864)
authorXuan-Son Nguyen <redacted>
Sun, 21 Jun 2026 11:03:14 +0000 (13:03 +0200)
committerGitHub <redacted>
Sun, 21 Jun 2026 11:03:14 +0000 (13:03 +0200)
tools/server/server-schema.cpp
tools/server/tests/unit/test_chat_completion.py

index d5d747a6540a18b6cc285043212700d5cb37258a..ed4bda24122bc0a2649d4cde76a40e0fe03518a6 100644 (file)
@@ -14,6 +14,9 @@ std::vector<std::unique_ptr<field>> make_llama_cmpl_schema(const common_params &
         fields.emplace_back(f);
     };
 
+    add((new field_bool("verbose", params.verbose))
+        ->set_desc("Include __verbose field in the response with additional debug information"));
+
     add((new field_bool("timings_per_token", params.timings_per_token))
         ->set_desc("Include prompt processing and text generation speed information in each response"));
 
index b00aac649d7ad6ea1d26aaf4f3165892b999c2f4..0258b539ed870a7ed90ff4acc6bbd5ee233286aa 100644 (file)
@@ -603,3 +603,23 @@ def test_chat_completions_token_count():
         })
         assert res.status_code == 200
         assert res.body["input_tokens"] > 5
+
+
+def test_verbose_debug():
+    global server
+    server.start()
+    for verbose in [True, False]:
+        res = server.make_request("POST", "/chat/completions", data={
+            "max_tokens": 2,
+            "messages": [
+                {"role": "system", "content": "Book"},
+                {"role": "user", "content": "What is the best book"},
+            ],
+            "verbose": verbose,
+        })
+        assert res.status_code == 200
+        if verbose:
+            assert "__verbose" in res.body
+            assert "Book" in res.body["__verbose"]["prompt"]
+        else:
+            assert "__verbose" not in res.body