Repository navigation
server: allow filtering llama server response fields - #10940
Conversation
ngxson
left a comment
There was a problem hiding this comment.
Please also include a guide in the /completion endpoint section of server's documentation.
Adding test case is optional, but is highly recommended. See an example in examples/server/tests/unit/test_completion.py
|
When filtering nested response fields, is this new option un-nesting them? In the example provided: curl --request POST \
--url http://localhost:8080/completion \
--header "Content-Type: application/json" \
--data '{"prompt": "Building a website can be done in 10 simple steps:","n_predict": 128, "response_fields": ["content", "generation_settings/n_predict"]}'{"content":" 1. Choose a domain name...","generation_settings/n_predict":128}It seems like it's changing the previous format of Is this intended or am I misunderstanding somewhere? If it's intended it should probably be mentioned in the docs for the server, since it's a bit confusing behavior for a "filter" to actually change the response format IMO. |
|
I've thought about it, but again haven't come to any sort of consensus. |
|
I don't have any preference either. In a logical sense, if we only need pick some fields inside Also I'm not sure if many users gonna use this functionality, so probably not urgent to change anything right now. |
Alright, sounds good. I might create a PR just to add a quick docs update in case anyone runs into this when using this field if that works. EDIT: Opened #10995 |
* llama_server_response_fields * llama_server_response_fields_fix_issues * params fixes * fix * clarify docs * change to "response_fields" --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
* llama_server_response_fields * llama_server_response_fields_fix_issues * params fixes * fix * clarify docs * change to "response_fields" --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
* llama_server_response_fields * llama_server_response_fields_fix_issues * params fixes * fix * clarify docs * change to "response_fields" --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
* llama_server_response_fields * llama_server_response_fields_fix_issues * params fixes * fix * clarify docs * change to "response_fields" --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
* llama_server_response_fields * llama_server_response_fields_fix_issues * params fixes * fix * clarify docs * change to "response_fields" --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
* llama_server_response_fields * llama_server_response_fields_fix_issues * params fixes * fix * clarify docs * change to "response_fields" --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
* llama_server_response_fields * llama_server_response_fields_fix_issues * params fixes * fix * clarify docs * change to "response_fields" --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
* llama_server_response_fields * llama_server_response_fields_fix_issues * params fixes * fix * clarify docs * change to "response_fields" --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
* llama_server_response_fields * llama_server_response_fields_fix_issues * params fixes * fix * clarify docs * change to "response_fields" --------- Co-authored-by: Xuan Son Nguyen <[email protected]>
This adds a new feature. Allow Filtering LLama Server Response Fields from #10819.
Usage:
Curl:
curl --request POST \ --url http://localhost:8080/completion \ --header "Content-Type: application/json" \ --data '{"prompt": "Building a website can be done in 10 simple steps:","n_predict": 128, "response_fields": ["content", "generation_settings/n_predict"]}'Response:
{"content":" 1. Choose a domain name...","generation_settings/n_predict":128}Retrievals from multiple nested lists are also supported, example: Given the original data: {"key1" : {"key2": 3}} With response_fields = ["key1/key2"] Then, the final response will be: {"key1/key2": 3}.If response does not contain a path, we will return empty json for path.