GenericChatRequest¶
-
class
oci.generative_ai_inference.models.
GenericChatRequest
(**kwargs)¶ Bases:
oci.generative_ai_inference.models.base_chat_request.BaseChatRequest
Details for the chat request.
Attributes
API_FORMAT_COHERE
str(object=’’) -> str API_FORMAT_GENERIC
str(object=’’) -> str api_format
[Required] Gets the api_format of this BaseChatRequest. frequency_penalty
Gets the frequency_penalty of this GenericChatRequest. is_echo
Gets the is_echo of this GenericChatRequest. is_stream
Gets the is_stream of this GenericChatRequest. log_probs
Gets the log_probs of this GenericChatRequest. logit_bias
Gets the logit_bias of this GenericChatRequest. max_tokens
Gets the max_tokens of this GenericChatRequest. messages
Gets the messages of this GenericChatRequest. num_generations
Gets the num_generations of this GenericChatRequest. presence_penalty
Gets the presence_penalty of this GenericChatRequest. stop
Gets the stop of this GenericChatRequest. temperature
Gets the temperature of this GenericChatRequest. top_k
Gets the top_k of this GenericChatRequest. top_p
Gets the top_p of this GenericChatRequest. Methods
__init__
(**kwargs)Initializes a new GenericChatRequest 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'¶
-
__init__
(**kwargs)¶ Initializes a new GenericChatRequest object with values from keyword arguments. The default value of the
api_format
attribute of this class isGENERIC
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 GenericChatRequest. Allowed values for this property are: “COHERE”, “GENERIC”
- messages (list[oci.generative_ai_inference.models.Message]) – The value to assign to the messages property of this GenericChatRequest.
- is_stream (bool) – The value to assign to the is_stream property of this GenericChatRequest.
- num_generations (int) – The value to assign to the num_generations property of this GenericChatRequest.
- is_echo (bool) – The value to assign to the is_echo property of this GenericChatRequest.
- top_k (int) – The value to assign to the top_k property of this GenericChatRequest.
- top_p (float) – The value to assign to the top_p property of this GenericChatRequest.
- temperature (float) – The value to assign to the temperature property of this GenericChatRequest.
- frequency_penalty (float) – The value to assign to the frequency_penalty property of this GenericChatRequest.
- presence_penalty (float) – The value to assign to the presence_penalty property of this GenericChatRequest.
- stop (list[str]) – The value to assign to the stop property of this GenericChatRequest.
- log_probs (int) – The value to assign to the log_probs property of this GenericChatRequest.
- max_tokens (int) – The value to assign to the max_tokens property of this GenericChatRequest.
- logit_bias (object) – The value to assign to the logit_bias property of this GenericChatRequest.
-
api_format
¶ [Required] Gets the api_format of this BaseChatRequest. The API format for the model’s family group. COHERE is for the Cohere family models such as the cohere.command-r-16k and cohere.command-r-plus models. GENERIC is for other model families such as the meta.llama-3-70b-instruct model.
Allowed values for this property are: “COHERE”, “GENERIC”
Returns: The api_format of this BaseChatRequest. Return type: str
-
frequency_penalty
¶ Gets the frequency_penalty of this GenericChatRequest. To reduce repetitiveness of generated tokens, this number penalizes new tokens based on their frequency in the generated text so far. Values > 0 encourage the model to use new tokens and values < 0 encourage the model to repeat tokens. Set to 0 to disable.
Returns: The frequency_penalty of this GenericChatRequest. Return type: float
-
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_echo
¶ Gets the is_echo of this GenericChatRequest. Whether to include the user prompt in the response. Applies only to non-stream results.
Returns: The is_echo of this GenericChatRequest. Return type: bool
-
is_stream
¶ Gets the is_stream of this GenericChatRequest. Whether to stream back partial progress. If set to true, as tokens become available, they are sent as data-only server-sent events.
Returns: The is_stream of this GenericChatRequest. Return type: bool
-
log_probs
¶ Gets the log_probs of this GenericChatRequest. Includes the logarithmic probabilities for the most likely output tokens and the chosen tokens.
For example, if the log probability is 5, the API returns a list of the 5 most likely tokens. The API returns the log probability of the sampled token, so there might be up to logprobs+1 elements in the response.
Returns: The log_probs of this GenericChatRequest. Return type: int
-
logit_bias
¶ Gets the logit_bias of this GenericChatRequest. Modifies the likelihood of specified tokens that appear in the completion.
Example: ‘{“6395”: 2, “8134”: 1, “21943”: 0.5, “5923”: -100}’
Returns: The logit_bias of this GenericChatRequest. Return type: object
-
max_tokens
¶ Gets the max_tokens of this GenericChatRequest. The maximum number of tokens that can be generated per output sequence. The token count of your prompt plus maxTokens must not exceed the model’s context length. Not setting a value for maxTokens results in the possible use of model’s full context length.
Returns: The max_tokens of this GenericChatRequest. Return type: int
-
messages
¶ Gets the messages of this GenericChatRequest. The series of messages in a chat request. Includes the previous messages in a conversation. Each message includes a role (USER or the CHATBOT) and content.
Returns: The messages of this GenericChatRequest. Return type: list[oci.generative_ai_inference.models.Message]
-
num_generations
¶ Gets the num_generations of this GenericChatRequest. The number of of generated texts that will be returned.
Returns: The num_generations of this GenericChatRequest. Return type: int
-
presence_penalty
¶ Gets the presence_penalty of this GenericChatRequest. To reduce repetitiveness of generated tokens, this number penalizes new tokens based on whether they’ve appeared in the generated text so far. Values > 0 encourage the model to use new tokens and values < 0 encourage the model to repeat tokens.
Similar to frequency penalty, a penalty is applied to previously present tokens, except that this penalty is applied equally to all tokens that have already appeared, regardless of how many times they’ve appeared. Set to 0 to disable.
Returns: The presence_penalty of this GenericChatRequest. Return type: float
-
stop
¶ Gets the stop of this GenericChatRequest. List of strings that stop the generation if they are generated for the response text. The returned output will not contain the stop strings.
Returns: The stop of this GenericChatRequest. Return type: list[str]
-
temperature
¶ Gets the temperature of this GenericChatRequest. A number that sets the randomness of the generated output. A lower temperature means a less random generations.
Use lower numbers for tasks with a correct answer such as question answering or summarizing. High temperatures can generate hallucinations or factually incorrect information. Start with temperatures lower than 1.0 and increase the temperature for more creative outputs, as you regenerate the prompts to refine the outputs.
Returns: The temperature of this GenericChatRequest. Return type: float
-
top_k
¶ Gets the top_k of this GenericChatRequest. An integer that sets up the model to use only the top k most likely tokens in the generated output. A higher k introduces more randomness into the output making the output text sound more natural. Default value is -1 which means to consider all tokens. Setting to 0 disables this method and considers all tokens.
If also using top p, then the model considers only the top tokens whose probabilities add up to p percent and ignores the rest of the k tokens. For example, if k is 20, but the probabilities of the top 10 add up to .75, then only the top 10 tokens are chosen.
Returns: The top_k of this GenericChatRequest. Return type: int
-
top_p
¶ Gets the top_p of this GenericChatRequest. If set to a probability 0.0 < p < 1.0, it ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step.
To eliminate tokens with low likelihood, assign p a minimum percentage for the next token’s likelihood. For example, when p is set to 0.75, the model eliminates the bottom 25 percent for the next token. Set to 1 to consider all tokens and set to 0 to disable. If both k and p are enabled, p acts after k.
Returns: The top_p of this GenericChatRequest. Return type: float
-