CohereChatResponse

class oci.generative_ai_inference.models.CohereChatResponse(**kwargs)

Bases: oci.generative_ai_inference.models.base_chat_response.BaseChatResponse

The response to the chat conversation.

Attributes

API_FORMAT_COHERE str(object=’’) -> str
API_FORMAT_GENERIC str(object=’’) -> str
FINISH_REASON_COMPLETE A constant which can be used with the finish_reason property of a CohereChatResponse.
FINISH_REASON_ERROR A constant which can be used with the finish_reason property of a CohereChatResponse.
FINISH_REASON_ERROR_LIMIT A constant which can be used with the finish_reason property of a CohereChatResponse.
FINISH_REASON_ERROR_TOXIC A constant which can be used with the finish_reason property of a CohereChatResponse.
FINISH_REASON_MAX_TOKENS A constant which can be used with the finish_reason property of a CohereChatResponse.
FINISH_REASON_USER_CANCEL A constant which can be used with the finish_reason property of a CohereChatResponse.
api_format [Required] Gets the api_format of this BaseChatResponse.
chat_history Gets the chat_history of this CohereChatResponse.
citations Gets the citations of this CohereChatResponse.
documents Gets the documents of this CohereChatResponse.
error_message Gets the error_message of this CohereChatResponse.
finish_reason [Required] Gets the finish_reason of this CohereChatResponse.
is_search_required Gets the is_search_required of this CohereChatResponse.
prompt Gets the prompt of this CohereChatResponse.
search_queries Gets the search_queries of this CohereChatResponse.
text [Required] Gets the text of this CohereChatResponse.
tool_calls Gets the tool_calls of this CohereChatResponse.

Methods

__init__(**kwargs) Initializes a new CohereChatResponse object with values from keyword arguments.
get_subtype(object_dictionary) Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
API_FORMAT_COHERE = 'COHERE'
API_FORMAT_GENERIC = 'GENERIC'
FINISH_REASON_COMPLETE = 'COMPLETE'

A constant which can be used with the finish_reason property of a CohereChatResponse. This constant has a value of “COMPLETE”

FINISH_REASON_ERROR = 'ERROR'

A constant which can be used with the finish_reason property of a CohereChatResponse. This constant has a value of “ERROR”

FINISH_REASON_ERROR_LIMIT = 'ERROR_LIMIT'

A constant which can be used with the finish_reason property of a CohereChatResponse. This constant has a value of “ERROR_LIMIT”

FINISH_REASON_ERROR_TOXIC = 'ERROR_TOXIC'

A constant which can be used with the finish_reason property of a CohereChatResponse. This constant has a value of “ERROR_TOXIC”

FINISH_REASON_MAX_TOKENS = 'MAX_TOKENS'

A constant which can be used with the finish_reason property of a CohereChatResponse. This constant has a value of “MAX_TOKENS”

FINISH_REASON_USER_CANCEL = 'USER_CANCEL'

A constant which can be used with the finish_reason property of a CohereChatResponse. This constant has a value of “USER_CANCEL”

__init__(**kwargs)

Initializes a new CohereChatResponse object with values from keyword arguments. The default value of the api_format attribute of this class is COHERE and it should not be changed. The following keyword arguments are supported (corresponding to the getters/setters of this class):

Parameters:
  • api_format (str) – The value to assign to the api_format property of this CohereChatResponse. Allowed values for this property are: “COHERE”, “GENERIC”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
  • text (str) – The value to assign to the text property of this CohereChatResponse.
  • chat_history (list[oci.generative_ai_inference.models.CohereMessage]) – The value to assign to the chat_history property of this CohereChatResponse.
  • citations (list[oci.generative_ai_inference.models.Citation]) – The value to assign to the citations property of this CohereChatResponse.
  • is_search_required (bool) – The value to assign to the is_search_required property of this CohereChatResponse.
  • finish_reason (str) – The value to assign to the finish_reason property of this CohereChatResponse. Allowed values for this property are: “COMPLETE”, “ERROR_TOXIC”, “ERROR_LIMIT”, “ERROR”, “USER_CANCEL”, “MAX_TOKENS”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
  • error_message (str) – The value to assign to the error_message property of this CohereChatResponse.
  • search_queries (list[oci.generative_ai_inference.models.SearchQuery]) – The value to assign to the search_queries property of this CohereChatResponse.
  • documents (list[object]) – The value to assign to the documents property of this CohereChatResponse.
  • tool_calls (list[oci.generative_ai_inference.models.CohereToolCall]) – The value to assign to the tool_calls property of this CohereChatResponse.
  • prompt (str) – The value to assign to the prompt property of this CohereChatResponse.
api_format

[Required] Gets the api_format of this BaseChatResponse. The API format for the model’s response.

Allowed values for this property are: “COHERE”, “GENERIC”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.

Returns:The api_format of this BaseChatResponse.
Return type:str
chat_history

Gets the chat_history of this CohereChatResponse. The list of previous messages between the user and the model. The chat history gives the model context for responding to the user’s inputs.

Returns:The chat_history of this CohereChatResponse.
Return type:list[oci.generative_ai_inference.models.CohereMessage]
citations

Gets the citations of this CohereChatResponse. Inline citations for the generated response.

Returns:The citations of this CohereChatResponse.
Return type:list[oci.generative_ai_inference.models.Citation]
documents

Gets the documents of this CohereChatResponse. The documents that the model can refer to when generating a response. Each document is a JSON string that represents the field and values of the document.

Example: ‘[

{
“id”: “doc_0”, “snippet”: “Emperor penguins are the tallest.”, “title”: “Tall penguins”

}, {

“id”: “doc_1”, “snippet”: “Emperor penguins only live in Antarctica.”, “title”: “Penguin habitats”

}

]’

Returns:The documents of this CohereChatResponse.
Return type:list[object]
error_message

Gets the error_message of this CohereChatResponse. If there is an error during the streaming scenario, then the errorMessage parameter contains details for the error.

Returns:The error_message of this CohereChatResponse.
Return type:str
finish_reason

[Required] Gets the finish_reason of this CohereChatResponse. Why the generation stopped.

Allowed values for this property are: “COMPLETE”, “ERROR_TOXIC”, “ERROR_LIMIT”, “ERROR”, “USER_CANCEL”, “MAX_TOKENS”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.

Returns:The finish_reason of this CohereChatResponse.
Return type:str
static get_subtype(object_dictionary)

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.

is_search_required

Gets the is_search_required of this CohereChatResponse. If set to true, a search for documents is required.

Returns:The is_search_required of this CohereChatResponse.
Return type:bool
prompt

Gets the prompt of this CohereChatResponse. The full prompt that was sent to the model if isEcho is true when request.

Returns:The prompt of this CohereChatResponse.
Return type:str
search_queries

Gets the search_queries of this CohereChatResponse. The generated search queries.

Returns:The search_queries of this CohereChatResponse.
Return type:list[oci.generative_ai_inference.models.SearchQuery]
text

[Required] Gets the text of this CohereChatResponse. Contents of the response that the model generates.

Returns:The text of this CohereChatResponse.
Return type:str
tool_calls

Gets the tool_calls of this CohereChatResponse. A list of tool calls generated by the model.

Returns:The tool_calls of this CohereChatResponse.
Return type:list[oci.generative_ai_inference.models.CohereToolCall]