endpoint
str - API endpoint for the completion request.response_class
Type - Class used for parsing the non-streaming response.stream_response_class
Type - Class used for parsing the streaming response.model
str - Model name to use for the completion.prompt_or_messages
Union[str, List[ChatMessage]] - The prompt for Completion or a list of chat messages for ChatCompletion. If not specified, must specify either prompt
or messages
in kwargs.request_timeout
int, optional - Request timeout in seconds. Defaults to 600.stream
bool, optional - Whether to use streaming or not. Defaults to False.**kwargs
- Additional keyword arguments.Union[CompletionResponse, Generator[CompletionStreamResponse, None, None]]
:stream
argument, either returns a CompletionResponsemodel
str - Model name to use for the completion.request_timeout
int, optional - Request timeout in seconds. Defaults to 600.stream
bool, optional - Whether to use streaming or not. Defaults to False.**kwargs
- Additional keyword arguments.Union[CompletionResponse, AsyncGenerator[CompletionStreamResponse, None]]
:stream
argument, either returns a CompletionResponse or an async generator yielding CompletionStreamResponse.
index
int - The index of the completion choice.text
str - The completion response.logprobs
float, optional - The log probabilities of the most likely tokens.finish_reason
str - The reason the model stopped generating tokens. This will be “stop” if the model hit a natural stop point or a provided stop sequence, or “length” if the maximum number of tokens specified in the request was reached.id
str - A unique identifier of the response.object
str - The object type, which is always “text_completion”.created
int - The Unix time in seconds when the response was generated.choices
List[Choice] - The list of generated completion choices.index
int - The index of the completion choice.text
str - The completion response.logprobs
float, optional - The log probabilities of the most likely tokens.finish_reason
str - The reason the model stopped generating tokens. This will be “stop” if the model hit a natural stop point or a provided stop sequence, or “length” if the maximum number of tokens specified in the request was reached.id
str - A unique identifier of the response.object
str - The object type, which is always “text_completion”.created
int - The Unix time in seconds when the response was generated.model
str - The model used for the chat completion.id
str - The model name.object
str - The object type, which is always “model”.created
int - The Unix time in seconds when the model was generated.object
str - The object type, which is always “list”.data
List[Model] - The list of models.role
str - The role of the author of this message.content
str - The contents of the message.index
int - The index of the chat completion choice.message
ChatMessage - The chat completion message.finish_reason
Optional[str] - The reason the model stopped generating tokens. This will be “stop” if the model hit a natural stop point or a provided stop sequence, or “length” if the maximum number of tokens specified in the request was reached.prompt_tokens
int - The number of tokens in the prompt.total_tokens
int - The total number of tokens used in the request (prompt + completion).completion_tokens
Optional[int] - The number of tokens in the generated completion.id
str - A unique identifier of the response.object
str - The object type, which is always “chat.completion”.created
int - The Unix time in seconds when the response was generated.model
str - The model used for the chat completion.choices
List[ChatCompletionResponseChoice] - The list of chat completion choices.usage
UsageInfo - Usage statistics for the chat completion.role
str - The role of the author of this message.content
str - The contents of the chunk message.index
int - The index of the chat completion choice.delta
DeltaMessage - The message delta.finish_reason
str - The reason the model stopped generating tokens. This will be “stop” if the model hit a natural stop point or a provided stop sequence, or “length” if the maximum number of tokens specified in the request was reached.id
str - A unique identifier of the response.object
str - The object type, which is always “chat.completion”.created
int - The Unix time in seconds when the response was generated.model
str - The model used for the chat completion.request_timeout
int, optional - The request timeout in seconds. Default is 60.ListModelsResponse
- A list of available models.level
- the minimum level that prints out to console.