From 6b95a61acabb3470c1b1f61cf9a7301189209015 Mon Sep 17 00:00:00 2001 From: Behnam M <58621210+ibehnam@users.noreply.github.com> Date: Tue, 9 Jan 2024 00:42:39 -0500 Subject: [PATCH] simplified the `completion_probabilities` JSON schema It's now easier to understand what the structure of `completion_probabilities` looks like. --- examples/server/README.md | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/examples/server/README.md b/examples/server/README.md index 369153a31..bfef7351e 100644 --- a/examples/server/README.md +++ b/examples/server/README.md @@ -179,29 +179,25 @@ node index.js * Note: When using streaming mode (`stream`) only `content` and `stop` will be returned until end of completion. -- `completion_probabilities: List[Completion]`: A list of probabilities for each token in the completion, if available. Note the type/schema of Completion is: +- `completion_probabilities`: An array of token probabilities for each completion. The array's length is `n_predict`. Each item in the array has the following structure: ``` -{'$defs': {'Probability': {'properties': {'prob': {'description': 'The probability of the token.', - 'title': 'Prob', - 'type': 'number'}, - 'tok_str': {'description': 'The string representation of the token.', - 'title': 'Tok Str', - 'type': 'string'}}, - 'required': ['prob', 'tok_str'], - 'title': 'Probability', - 'type': 'object'}}, - 'properties': {'content': {'description': 'The content associated with the probabilities.', - 'title': 'Content', - 'type': 'string'}, - 'probs': {'description': 'A list of probabilities for each token.', - 'items': {'$ref': '#/$defs/Probability'}, - 'title': 'Probs', - 'type': 'array'}}, - 'required': ['content', 'probs'], - 'title': 'Completion', - 'type': 'object'} - ``` +{ + "content": "", + "probs": [ + { + "prob": float, + "tok_str": "" + }, + { + "prob": float, + "tok_str": "" + }, + ... + ] +}, +``` +Notice that each `probs` is an array of length `n_probs`. - `content`: Completion result as a string (excluding `stopping_word` if any). In case of streaming mode, will contain the next token as a string. - `stop`: Boolean for use with `stream` to check whether the generation has stopped (Note: This is not related to stopping words array `stop` from input options)