ray.serve.llm.openai_api_models.CompletionStreamResponse#

pydantic model ray.serve.llm.openai_api_models.CompletionStreamResponse[source]#

CompletionStreamResponse is the response body for the completion API.

This model is compatible with vLLM’s OpenAI API models.

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

Show JSON schema
{
   "title": "CompletionStreamResponse",
   "description": "CompletionStreamResponse is the response body for the completion API.\n\nThis model is compatible with vLLM's OpenAI API models.\n\n**PublicAPI (alpha):** This API is in alpha and may change before becoming stable.",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "object": {
         "default": "text_completion",
         "title": "Object",
         "type": "string"
      },
      "created": {
         "title": "Created",
         "type": "integer"
      },
      "model": {
         "title": "Model",
         "type": "string"
      },
      "choices": {
         "items": {
            "$ref": "#/$defs/CompletionResponseStreamChoice"
         },
         "title": "Choices",
         "type": "array"
      },
      "usage": {
         "anyOf": [
            {
               "$ref": "#/$defs/UsageInfo"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "CompletionLogProbs": {
         "properties": {
            "text_offset": {
               "items": {
                  "type": "integer"
               },
               "title": "Text Offset",
               "type": "array"
            },
            "token_logprobs": {
               "items": {
                  "anyOf": [
                     {
                        "type": "number"
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "title": "Token Logprobs",
               "type": "array"
            },
            "tokens": {
               "items": {
                  "type": "string"
               },
               "title": "Tokens",
               "type": "array"
            },
            "top_logprobs": {
               "items": {
                  "anyOf": [
                     {
                        "additionalProperties": {
                           "type": "number"
                        },
                        "type": "object"
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "title": "Top Logprobs",
               "type": "array"
            }
         },
         "title": "CompletionLogProbs",
         "type": "object"
      },
      "CompletionResponseStreamChoice": {
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "text": {
               "title": "Text",
               "type": "string"
            },
            "logprobs": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CompletionLogProbs"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "finish_reason": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Finish Reason"
            },
            "stop_reason": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The stop string or token id that caused the completion to stop, None if the completion finished for some other reason including encountering the EOS token",
               "title": "Stop Reason"
            }
         },
         "required": [
            "index",
            "text"
         ],
         "title": "CompletionResponseStreamChoice",
         "type": "object"
      },
      "PromptTokenUsageInfo": {
         "properties": {
            "cached_tokens": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Cached Tokens"
            }
         },
         "title": "PromptTokenUsageInfo",
         "type": "object"
      },
      "UsageInfo": {
         "properties": {
            "prompt_tokens": {
               "default": 0,
               "title": "Prompt Tokens",
               "type": "integer"
            },
            "total_tokens": {
               "default": 0,
               "title": "Total Tokens",
               "type": "integer"
            },
            "completion_tokens": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 0,
               "title": "Completion Tokens"
            },
            "prompt_tokens_details": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/PromptTokenUsageInfo"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "UsageInfo",
         "type": "object"
      }
   },
   "required": [
      "model",
      "choices"
   ]
}

field choices: List[CompletionResponseStreamChoice] [Required]#
field created: int [Optional]#
field id: str [Optional]#
field model: str [Required]#
field object: str = 'text_completion'#
field usage: UsageInfo | None = None#