Show / Hide Table of Contents

Class CohereChatRequestV2

Details for the chat request for Cohere models.

Inheritance
object
BaseChatRequest
CohereChatRequestV2
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Oci.GenerativeaiinferenceService.Models
Assembly: OCI.DotNetSDK.Generativeaiinference.dll
Syntax
public class CohereChatRequestV2 : BaseChatRequest

Properties

CitationOptions

Declaration
[JsonProperty(PropertyName = "citationOptions")]
public CitationOptionsV2 CitationOptions { get; set; }
Property Value
Type Description
CitationOptionsV2

Documents

Declaration
[JsonProperty(PropertyName = "documents")]
public List<object> Documents { get; set; }
Property Value
Type Description
List<object>

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.

FrequencyPenalty

Declaration
[JsonProperty(PropertyName = "frequencyPenalty")]
public double FrequencyPenalty { get; set; }
Property Value
Type Description
double

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.

IsLogProbsEnabled

Declaration
[JsonProperty(PropertyName = "isLogProbsEnabled")]
public bool? IsLogProbsEnabled { get; set; }
Property Value
Type Description
bool?

The log probabilities of the generated tokens will be included in the response.

IsRawPrompting

Declaration
[JsonProperty(PropertyName = "isRawPrompting")]
public bool? IsRawPrompting { get; set; }
Property Value
Type Description
bool?

When enabled, the user\u2019s message will be sent to the model without any preprocessing.

IsSearchQueriesOnly

Declaration
[JsonProperty(PropertyName = "isSearchQueriesOnly")]
public bool? IsSearchQueriesOnly { get; set; }
Property Value
Type Description
bool?

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.

IsStream

Declaration
[JsonProperty(PropertyName = "isStream")]
public bool? IsStream { get; set; }
Property Value
Type Description
bool?

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.

IsStrictToolsEnabled

Declaration
[JsonProperty(PropertyName = "isStrictToolsEnabled")]
public bool? IsStrictToolsEnabled { get; set; }
Property Value
Type Description
bool?

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.

MaxTokens

Declaration
[JsonProperty(PropertyName = "maxTokens")]
public int? MaxTokens { get; set; }
Property Value
Type Description
int?

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.

Messages

Declaration
[Required(ErrorMessage = "Messages is required.")]
[JsonProperty(PropertyName = "messages")]
public List<CohereMessageV2> Messages { get; set; }
Property Value
Type Description
List<CohereMessageV2>

A list of chat messages in chronological order, representing a conversation between the user and the model.

Remarks

Required

PresencePenalty

Declaration
[JsonProperty(PropertyName = "presencePenalty")]
public double PresencePenalty { get; set; }
Property Value
Type Description
double

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.

Priority

Declaration
[JsonProperty(PropertyName = "priority")]
public int? Priority { get; set; }
Property Value
Type Description
int?

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.

ResponseFormat

Declaration
[JsonProperty(PropertyName = "responseFormat")]
public CohereResponseFormat ResponseFormat { get; set; }
Property Value
Type Description
CohereResponseFormat

SafetyMode

Declaration
[JsonProperty(PropertyName = "safetyMode")]
[JsonConverter(typeof(StringEnumConverter))]
public CohereChatRequestV2.SafetyModeEnum? SafetyMode { get; set; }
Property Value
Type Description
CohereChatRequestV2.SafetyModeEnum?

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.

Seed

Declaration
[JsonProperty(PropertyName = "seed")]
public int? Seed { get; set; }
Property Value
Type Description
int?

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.

StopSequences

Declaration
[JsonProperty(PropertyName = "stopSequences")]
public List<string> StopSequences { get; set; }
Property Value
Type Description
List<string>

Stop the model generation when it reaches a stop sequence defined in this parameter.

StreamOptions

Declaration
[JsonProperty(PropertyName = "streamOptions")]
public StreamOptions StreamOptions { get; set; }
Property Value
Type Description
StreamOptions

Temperature

Declaration
[JsonProperty(PropertyName = "temperature")]
public double Temperature { get; set; }
Property Value
Type Description
double

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.

Thinking

Declaration
[JsonProperty(PropertyName = "thinking")]
public CohereThinkingV2 Thinking { get; set; }
Property Value
Type Description
CohereThinkingV2

Tools

Declaration
[JsonProperty(PropertyName = "tools")]
public List<CohereToolV2> Tools { get; set; }
Property Value
Type Description
List<CohereToolV2>

A list of available tools (functions) that the model may suggest invoking before producing a text response.

ToolsChoice

Declaration
[JsonProperty(PropertyName = "toolsChoice")]
[JsonConverter(typeof(StringEnumConverter))]
public CohereChatRequestV2.ToolsChoiceEnum? ToolsChoice { get; set; }
Property Value
Type Description
CohereChatRequestV2.ToolsChoiceEnum?

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.

TopK

Declaration
[JsonProperty(PropertyName = "topK")]
public int? TopK { get; set; }
Property Value
Type Description
int?

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.

TopP

Declaration
[JsonProperty(PropertyName = "topP")]
public double TopP { get; set; }
Property Value
Type Description
double
In this article
Back to top