mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-06-27 23:50:20 -05:00
server: add "verbose" field to schema
This commit is contained in:
parent
8a118ee86c
commit
f1ef61fb1b
@ -14,6 +14,9 @@ std::vector<std::unique_ptr<field>> make_llama_cmpl_schema(const common_params &
|
|||||||
fields.emplace_back(f);
|
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))
|
add((new field_bool("timings_per_token", params.timings_per_token))
|
||||||
->set_desc("Include prompt processing and text generation speed information in each response"));
|
->set_desc("Include prompt processing and text generation speed information in each response"));
|
||||||
|
|
||||||
|
|||||||
@ -603,3 +603,23 @@ def test_chat_completions_token_count():
|
|||||||
})
|
})
|
||||||
assert res.status_code == 200
|
assert res.status_code == 200
|
||||||
assert res.body["input_tokens"] > 5
|
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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user