ray.serve.llm.openai_api_models.CompletionResponse#
- pydantic model ray.serve.llm.openai_api_models.CompletionResponse[source]#
CompletionResponse 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": "CompletionResponse", "description": "CompletionResponse 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/CompletionResponseChoice" }, "title": "Choices", "type": "array" }, "usage": { "$ref": "#/$defs/UsageInfo" } }, "$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" }, "CompletionResponseChoice": { "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" }, "prompt_logprobs": { "anyOf": [ { "items": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Logprob" }, "type": "object" }, { "type": "null" } ] }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Prompt Logprobs" } }, "required": [ "index", "text" ], "title": "CompletionResponseChoice", "type": "object" }, "Logprob": { "description": "Infos for supporting OpenAI compatible logprobs and token ranks.\n\nAttributes:\n logprob: The logprob of chosen token\n rank: The vocab rank of chosen token (>=1)\n decoded_token: The decoded chosen token index", "properties": { "logprob": { "title": "Logprob", "type": "number" }, "rank": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Rank" }, "decoded_token": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Decoded Token" } }, "required": [ "logprob" ], "title": "Logprob", "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", "usage" ] }
- field choices: List[CompletionResponseChoice] [Required]#
- field usage: UsageInfo [Required]#