Class CohereChatRequestV2
- java.lang.Object
-
- com.oracle.bmc.http.client.internal.ExplicitlySetBmcModel
-
- com.oracle.bmc.generativeaiinference.model.BaseChatRequest
-
- com.oracle.bmc.generativeaiinference.model.CohereChatRequestV2
-
@Generated(value="OracleSDKGenerator", comments="API Version: 20231130") public final class CohereChatRequestV2 extends BaseChatRequestDetails for the chat request for Cohere models.
Note: Objects should always be created or deserialized using theCohereChatRequestV2.Builder. This model distinguishes fields that are null because they are unset from fields that are explicitly set to null. This is done in the setter methods of theCohereChatRequestV2.Builder, which maintain a set of all explicitly set fields calledCohereChatRequestV2.Builder.__explicitlySet__. ThehashCode()andequals(Object)methods are implemented to take the explicitly set fields into account. The constructor, on the other hand, does not take the explicitly set fields into account (since the constructor cannot distinguish explicit null from unset null).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCohereChatRequestV2.Builderstatic classCohereChatRequestV2.SafetyModeSafety mode: Adds a safety instruction for the model to use when generating responses.static classCohereChatRequestV2.ToolsChoiceUsed to control whether or not the model will be forced to use a tool when answering.-
Nested classes/interfaces inherited from class com.oracle.bmc.generativeaiinference.model.BaseChatRequest
BaseChatRequest.ApiFormat
-
-
Constructor Summary
Constructors Constructor Description CohereChatRequestV2(List<CohereMessageV2> messages, List<Object> documents, CitationOptionsV2 citationOptions, CohereChatRequestV2.ToolsChoice toolsChoice, List<CohereToolV2> tools, Boolean isStrictToolsEnabled, Boolean isLogProbsEnabled, CohereThinkingV2 thinking, CohereResponseFormat responseFormat, Boolean isSearchQueriesOnly, StreamOptions streamOptions, Boolean isStream, Integer maxTokens, Double temperature, Integer topK, Double topP, Double frequencyPenalty, Double presencePenalty, Integer seed, List<String> stopSequences, Integer priority, Boolean isRawPrompting, CohereChatRequestV2.SafetyMode safetyMode)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CohereChatRequestV2.Builderbuilder()Create a new builder.booleanequals(Object o)CitationOptionsV2getCitationOptions()List<Object>getDocuments()A list of relevant documents that the model can refer to for generating grounded responses to the user’s requests.DoublegetFrequencyPenalty()To reduce repetitiveness of generated tokens, this number penalizes new tokens based on their frequency in the generated text so far.BooleangetIsLogProbsEnabled()The log probabilities of the generated tokens will be included in the response.BooleangetIsRawPrompting()When enabled, the user\u2019s message will be sent to the model without any preprocessing.BooleangetIsSearchQueriesOnly()When set to true, the response contains only a list of generated search queries without the search results and the model will not respond to the user’s message.BooleangetIsStream()Whether to stream the partial progress of the model’s response.BooleangetIsStrictToolsEnabled()When set to true, tool calls in the Assistant message will be forced to follow the tool definition strictly.IntegergetMaxTokens()The maximum number of output tokens that the model will generate for the response.List<CohereMessageV2>getMessages()A list of chat messages in chronological order, representing a conversation between the user and the model.DoublegetPresencePenalty()To reduce repetitiveness of generated tokens, this number penalizes new tokens based on whether they’ve appeared in the generated text so far.IntegergetPriority()The priority of the request (lower means earlier handling; default 0 highest priority).CohereResponseFormatgetResponseFormat()CohereChatRequestV2.SafetyModegetSafetyMode()Safety mode: Adds a safety instruction for the model to use when generating responses.IntegergetSeed()If specified, the backend will make a best effort to sample tokens deterministically, so that repeated requests with the same seed and parameters yield the same result.List<String>getStopSequences()Stop the model generation when it reaches a stop sequence defined in this parameter.StreamOptionsgetStreamOptions()DoublegetTemperature()A number that sets the randomness of the generated output.CohereThinkingV2getThinking()List<CohereToolV2>getTools()A list of available tools (functions) that the model may suggest invoking before producing a text response.CohereChatRequestV2.ToolsChoicegetToolsChoice()Used to control whether or not the model will be forced to use a tool when answering.IntegergetTopK()A sampling method in which the model chooses the next token randomly from the top k most likely tokens.DoublegetTopP()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.inthashCode()CohereChatRequestV2.BuildertoBuilder()StringtoString()StringtoString(boolean includeByteArrayContents)Return a string representation of the object.
-
-
-
Constructor Detail
-
CohereChatRequestV2
@Deprecated public CohereChatRequestV2(List<CohereMessageV2> messages, List<Object> documents, CitationOptionsV2 citationOptions, CohereChatRequestV2.ToolsChoice toolsChoice, List<CohereToolV2> tools, Boolean isStrictToolsEnabled, Boolean isLogProbsEnabled, CohereThinkingV2 thinking, CohereResponseFormat responseFormat, Boolean isSearchQueriesOnly, StreamOptions streamOptions, Boolean isStream, Integer maxTokens, Double temperature, Integer topK, Double topP, Double frequencyPenalty, Double presencePenalty, Integer seed, List<String> stopSequences, Integer priority, Boolean isRawPrompting, CohereChatRequestV2.SafetyMode safetyMode)
Deprecated.
-
-
Method Detail
-
builder
public static CohereChatRequestV2.Builder builder()
Create a new builder.
-
toBuilder
public CohereChatRequestV2.Builder toBuilder()
-
getMessages
public List<CohereMessageV2> getMessages()
A list of chat messages in chronological order, representing a conversation between the user and the model.- Returns:
- the value
-
getDocuments
public List<Object> getDocuments()
A list of relevant documents that the model can refer to for generating grounded responses to the user’s requests.Some example keys that you can add to the dictionary are “text”, “author”, and “date”. Keep the total word count of the strings in the dictionary to 300 words or less.
- Returns:
- the value
-
getCitationOptions
public CitationOptionsV2 getCitationOptions()
-
getToolsChoice
public CohereChatRequestV2.ToolsChoice getToolsChoice()
Used to control whether or not the model will be forced to use a tool when answering.When REQUIRED is specified, the model will be forced to use at least one of the user-defined tools, and the tools parameter must be passed in the request. When NONE is specified, the model will be forced not to use one of the specified tools, and give a direct response. If tool_choice isn\u2019t specified, then the model is free to choose whether to use the specified tools or not. Note:This parameter is only compatible with models Command-r7b and newer.
- Returns:
- the value
-
getTools
public List<CohereToolV2> getTools()
A list of available tools (functions) that the model may suggest invoking before producing a text response.- Returns:
- the value
-
getIsStrictToolsEnabled
public Boolean getIsStrictToolsEnabled()
When set to true, tool calls in the Assistant message will be forced to follow the tool definition strictly.Note:The first few requests with a new set of tools will take longer to process.
- Returns:
- the value
-
getIsLogProbsEnabled
public Boolean getIsLogProbsEnabled()
The log probabilities of the generated tokens will be included in the response.- Returns:
- the value
-
getThinking
public CohereThinkingV2 getThinking()
-
getResponseFormat
public CohereResponseFormat getResponseFormat()
-
getIsSearchQueriesOnly
public Boolean getIsSearchQueriesOnly()
When set to true, the response contains only a list of generated search queries without the search results and the model will not respond to the user’s message.- Returns:
- the value
-
getStreamOptions
public StreamOptions getStreamOptions()
-
getIsStream
public Boolean getIsStream()
Whether to stream the partial progress of the model’s response.When set to true, as tokens become available, they are sent as data-only server-sent events.
- Returns:
- the value
-
getMaxTokens
public Integer getMaxTokens()
The maximum number of output tokens that the model will generate for the response.The token count of your prompt plus maxTokens must not exceed the model’s context length. For on-demand inferencing, the response length is capped at 4,000 tokens for each run.
- Returns:
- the value
-
getTemperature
public Double getTemperature()
A number that sets the randomness of the generated output.A lower temperature means less random generations. Use lower numbers for tasks 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 value
-
getTopK
public Integer getTopK()
A sampling method in which the model chooses the next token randomly from the top k most likely tokens.A higher value for k generates more random output, which makes the output text sound more natural. The default value for k is 0 which disables this method and considers all tokens. To set a number for the likely tokens, choose an integer between 1 and 500.
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 only the probabilities of the top 10 add up to the value of p, then only the top 10 tokens are chosen.
- Returns:
- the value
-
getTopP
public Double getTopP()
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.0 to consider all tokens and set to 0 to disable. If both k and p are enabled, p acts after k.
- Returns:
- the value
-
getFrequencyPenalty
public Double getFrequencyPenalty()
To reduce repetitiveness of generated tokens, this number penalizes new tokens based on their frequency in the generated text so far.Greater numbers encourage the model to use new tokens, while lower numbers encourage the model to repeat the tokens. Set to 0 to disable.
- Returns:
- the value
-
getPresencePenalty
public Double getPresencePenalty()
To reduce repetitiveness of generated tokens, this number penalizes new tokens based on whether they’ve appeared in the generated text so far.Greater numbers encourage the model to use new tokens, while lower numbers encourage the model to repeat the 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 value
-
getSeed
public Integer getSeed()
If specified, the backend will make a best effort to sample tokens deterministically, so that repeated requests with the same seed and parameters yield the same result.However, determinism cannot be fully guaranteed.
- Returns:
- the value
-
getStopSequences
public List<String> getStopSequences()
Stop the model generation when it reaches a stop sequence defined in this parameter.- Returns:
- the value
-
getPriority
public Integer getPriority()
The priority of the request (lower means earlier handling; default 0 highest priority).Higher priority requests are handled first, and dropped last when the system is under load.
- Returns:
- the value
-
getIsRawPrompting
public Boolean getIsRawPrompting()
When enabled, the user\u2019s message will be sent to the model without any preprocessing.- Returns:
- the value
-
getSafetyMode
public CohereChatRequestV2.SafetyMode getSafetyMode()
Safety mode: Adds a safety instruction for the model to use when generating responses.Contextual: (Default) Puts fewer constraints on the output. It maintains core protections by aiming to reject harmful or illegal suggestions, but it allows profanity and some toxic content, sexually explicit and violent content, and content that contains medical, financial, or legal information. Contextual mode is suited for entertainment, creative, or academic use. Strict: Aims to avoid sensitive topics, such as violent or sexual acts and profanity. This mode aims to provide a safer experience by prohibiting responses or recommendations that it finds inappropriate. Strict mode is suited for corporate use, such as for corporate communications and customer service. Off: No safety mode is applied. Note: This parameter is only compatible with models cohere.command-r-08-2024, cohere.command-r-plus-08-2024 and Cohere models released after these models. See release dates.
- Returns:
- the value
-
toString
public String toString()
- Overrides:
toStringin classBaseChatRequest
-
toString
public String toString(boolean includeByteArrayContents)
Return a string representation of the object.- Overrides:
toStringin classBaseChatRequest- Parameters:
includeByteArrayContents- true to include the full contents of byte arrays- Returns:
- string representation
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classBaseChatRequest
-
hashCode
public int hashCode()
- Overrides:
hashCodein classBaseChatRequest
-
-