From 72e0cd72314cbf1889d695da499ce8bf58a9ef64 Mon Sep 17 00:00:00 2001
From: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Date: Wed, 8 May 2024 10:34:28 +0000
Subject: [PATCH] SDK regeneration
---
CODEOWNERS | 1 -
build.gradle | 2 +-
src/main/java/com/cohere/api/Cohere.java | 39 +++++
.../java/com/cohere/api/CohereBuilder.java | 3 -
.../com/cohere/api/core/ClientOptions.java | 2 +-
.../com/cohere/api/requests/ChatRequest.java | 130 +++++++++-----
.../api/requests/ChatStreamRequest.java | 130 +++++++++-----
.../requests/DatasetsCreateRequest.java | 4 +-
...tasetsCreateResponseDatasetPartsItem.java} | 18 +-
.../cohere/api/types/CheckApiKeyResponse.java | 163 ++++++++++++++++++
.../com/cohere/api/types/DatasetPart.java | 46 ++++-
.../com/cohere/api/types/DatasetType.java | 2 -
.../java/com/cohere/api/types/Metrics.java | 33 +++-
.../cohere/api/types/MetricsEmbedData.java | 100 +++++++++++
.../api/types/MetricsEmbedDataFieldsItem.java | 124 +++++++++++++
.../api/types/TooManyRequestsErrorBody.java | 95 ++++++++++
16 files changed, 788 insertions(+), 104 deletions(-)
delete mode 100644 CODEOWNERS
rename src/main/java/com/cohere/api/resources/datasets/types/{DatasetsCreateResponseDatasetParts.java => DatasetsCreateResponseDatasetPartsItem.java} (88%)
create mode 100644 src/main/java/com/cohere/api/types/CheckApiKeyResponse.java
create mode 100644 src/main/java/com/cohere/api/types/MetricsEmbedData.java
create mode 100644 src/main/java/com/cohere/api/types/MetricsEmbedDataFieldsItem.java
create mode 100644 src/main/java/com/cohere/api/types/TooManyRequestsErrorBody.java
diff --git a/CODEOWNERS b/CODEOWNERS
deleted file mode 100644
index 77f6191..0000000
--- a/CODEOWNERS
+++ /dev/null
@@ -1 +0,0 @@
-* @cohere-ai/cohere-java
diff --git a/build.gradle b/build.gradle
index d4cb8fc..e3c8e47 100644
--- a/build.gradle
+++ b/build.gradle
@@ -50,7 +50,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.cohere'
artifactId = 'cohere-java'
- version = '1.0.4'
+ version = '1.0.5'
from components.java
pom {
name = 'cohere'
diff --git a/src/main/java/com/cohere/api/Cohere.java b/src/main/java/com/cohere/api/Cohere.java
index cb4f4fe..35ef380 100644
--- a/src/main/java/com/cohere/api/Cohere.java
+++ b/src/main/java/com/cohere/api/Cohere.java
@@ -25,6 +25,7 @@
import com.cohere.api.resources.embedjobs.EmbedJobsClient;
import com.cohere.api.resources.finetuning.FinetuningClient;
import com.cohere.api.resources.models.ModelsClient;
+import com.cohere.api.types.CheckApiKeyResponse;
import com.cohere.api.types.ClassifyResponse;
import com.cohere.api.types.DetokenizeResponse;
import com.cohere.api.types.EmbedResponse;
@@ -553,6 +554,44 @@ public DetokenizeResponse detokenize(DetokenizeRequest request, RequestOptions r
}
}
+ /**
+ * Checks that the api key in the Authorization header is valid and active
+ */
+ public CheckApiKeyResponse checkApiKey() {
+ return checkApiKey(null);
+ }
+
+ /**
+ * Checks that the api key in the Authorization header is valid and active
+ */
+ public CheckApiKeyResponse checkApiKey(RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("check-api-key")
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("POST", RequestBody.create("", null))
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .build();
+ try {
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ Response response = client.newCall(okhttpRequest).execute();
+ if (response.isSuccessful()) {
+ return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), CheckApiKeyResponse.class);
+ }
+ throw new ApiError(
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
public EmbedJobsClient embedJobs() {
return this.embedJobsClient.get();
}
diff --git a/src/main/java/com/cohere/api/CohereBuilder.java b/src/main/java/com/cohere/api/CohereBuilder.java
index 8d3f07d..f5e5f5a 100644
--- a/src/main/java/com/cohere/api/CohereBuilder.java
+++ b/src/main/java/com/cohere/api/CohereBuilder.java
@@ -47,9 +47,6 @@ public Cohere build() {
throw new RuntimeException("Please provide token or set the CO_API_KEY environment variable.");
}
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.token);
- if (clientName == null) {
- throw new RuntimeException("Please provide clientName");
- }
this.clientOptionsBuilder.addHeader("X-Client-Name", this.clientName);
clientOptionsBuilder.environment(this.environment);
return new Cohere(clientOptionsBuilder.build());
diff --git a/src/main/java/com/cohere/api/core/ClientOptions.java b/src/main/java/com/cohere/api/core/ClientOptions.java
index 746f68a..dc7e5e3 100644
--- a/src/main/java/com/cohere/api/core/ClientOptions.java
+++ b/src/main/java/com/cohere/api/core/ClientOptions.java
@@ -30,7 +30,7 @@ private ClientOptions(
"X-Fern-SDK-Name",
"com.cohere.fern:api-sdk",
"X-Fern-SDK-Version",
- "1.0.4",
+ "1.0.5",
"X-Fern-Language",
"JAVA"));
this.headerSuppliers = headerSuppliers;
diff --git a/src/main/java/com/cohere/api/requests/ChatRequest.java b/src/main/java/com/cohere/api/requests/ChatRequest.java
index eef485e..7a483b0 100644
--- a/src/main/java/com/cohere/api/requests/ChatRequest.java
+++ b/src/main/java/com/cohere/api/requests/ChatRequest.java
@@ -128,6 +128,7 @@ private ChatRequest(
/**
* @return Text input for the model to respond to.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
*/
@JsonProperty("message")
public String getMessage() {
@@ -136,7 +137,8 @@ public String getMessage() {
/**
* @return Defaults to command-r-plus
.
- *
The name of a compatible Cohere model or the ID of a fine-tuned model.
+ *The name of a compatible Cohere model or the ID of a fine-tuned model. + * Compatible Deployments: Cohere Platform, Private Deployments
*/ @JsonProperty("model") public OptionalSYSTEM
role.
- * The SYSTEM
role is also used for the contents of the optional chat_history=
parameter. When used with the chat_history=
parameter it adds content throughout a conversation. Conversely, when used with the preamble=
parameter it adds content at the start of the conversation only.
The SYSTEM
role is also used for the contents of the optional chat_history=
parameter. When used with the chat_history=
parameter it adds content throughout a conversation. Conversely, when used with the preamble=
parameter it adds content at the start of the conversation only.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
message
.
* Each item represents a single message in the chat history, excluding the current user turn. It has two properties: role
and message
. The role
identifies the sender (CHATBOT
, SYSTEM
, or USER
), while the message
contains the text content.
The chat_history parameter should not be used for SYSTEM
messages in most cases. Instead, to add a SYSTEM
role message at the beginning of a conversation, the preamble
parameter should be used.
The chat_history parameter should not be used for SYSTEM
messages in most cases. Instead, to add a SYSTEM
role message at the beginning of a conversation, the preamble
parameter should be used.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
chat_history
.
- * Providing a conversation_id
creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
Providing a conversation_id
creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
+ * Compatible Deployments: Cohere Platform
Dictates how the prompt will be constructed.
*With prompt_truncation
set to "AUTO", some elements from chat_history
and documents
will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance.
With prompt_truncation
set to "AUTO_PRESERVE_ORDER", some elements from chat_history
and documents
will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API.
With prompt_truncation
set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a TooManyTokens
error will be returned.
With prompt_truncation
set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a TooManyTokens
error will be returned.
+ * Compatible Deployments: Cohere Platform Only AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker, Private Deployments
{"id": "web-search"}
, and/or the "id"
for a custom connector, if you've created one.
- * When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG).
+ *When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG). + * Compatible Deployments: Cohere Platform
*/ @JsonProperty("connectors") public Optionalfalse
.
- * When true
, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's message
will be generated.
When true
, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's message
will be generated.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Some suggested keys are "text", "author", and "date". For better generation quality, it is recommended to keep the total word count of the strings in the dictionary to under 300 words.
*An id
field (string) can be optionally supplied to identify the document in the citations. This field will not be passed to the model.
An _excludes
field (array of strings) can be optionally supplied to omit some key-value pairs from being shown to the model. The omitted fields will still show up in the citation object. The "_excludes" field will not be passed to the model.
See 'Document Mode' in the guide for more information.
+ *See 'Document Mode' in the guide for more information. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
*/ @JsonProperty("documents") public Optional"accurate"
.
- * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want "accurate"
results or "fast"
results.
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want "accurate"
results or "fast"
results.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
0.3
.
* A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.
- *Randomness can be further maximized by increasing the value of the p
parameter.
Randomness can be further maximized by increasing the value of the p
parameter.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
max_input_tokens
is the model's context length limit minus a small buffer.
- * Input will be truncated according to the prompt_truncation
parameter.
Input will be truncated according to the prompt_truncation
parameter.
+ * Compatible Deployments: Cohere Platform
k
most likely tokens are considered for generation at each step.
* Defaults to 0
, min value of 0
, max value of 500
.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
*/
@JsonProperty("k")
public Optionalp
, are considered for generation at each step. If both k
and p
are enabled, p
acts after k
.
* Defaults to 0.75
. min value of 0.01
, max value of 0.99
.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
*/
@JsonProperty("p")
public Optional0.0
, min value of 0.0
, max value of 1.0
.
- * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
+ *Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
*/ @JsonProperty("frequency_penalty") public Optional0.0
, min value of 0.0
, max value of 1.0
.
- * Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty
, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty
, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
When tools
is passed (without tool_results
), the text
field in the response will be ""
and the tool_calls
field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the tool_calls
array will be empty.
When tools
is passed (without tool_results
), the text
field in the response will be ""
and the tool_calls
field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the tool_calls
array will be empty.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Note: Chat calls with tool_results
should not be included in the Chat history to avoid duplication of the message text.
Note: Chat calls with tool_results
should not be included in the Chat history to avoid duplication of the message text.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Text input for the model to respond to.
+ *Text input for the model to respond to. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -643,7 +670,8 @@ public _FinalStage message(String message) { * ... * ] * - *Note: Chat calls with tool_results
should not be included in the Chat history to avoid duplication of the message text.
Note: Chat calls with tool_results
should not be included in the Chat history to avoid duplication of the message text.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
A list of available tools (functions) that the model may suggest invoking before producing a text response.
- *When tools
is passed (without tool_results
), the text
field in the response will be ""
and the tool_calls
field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the tool_calls
array will be empty.
When tools
is passed (without tool_results
), the text
field in the response will be ""
and the tool_calls
field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the tool_calls
array will be empty.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
When enabled, the user's prompt will be sent to the model without any pre-processing.
+ *When enabled, the user's prompt will be sent to the model without + * any pre-processing. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -713,7 +744,8 @@ public _FinalStage rawPrompting(OptionalDefaults to 0.0
, min value of 0.0
, max value of 1.0
.
Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty
, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty
, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Defaults to 0.0
, min value of 0.0
, max value of 1.0
.
Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
+ *Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -748,7 +781,8 @@ public _FinalStage frequencyPenalty(OptionalA list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence.
+ *A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -765,7 +799,11 @@ public _FinalStage stopSequences(OptionalIf specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed.
+ *If specified, the backend will make a best effort to sample tokens + * deterministically, such that repeated requests with the same + * seed and parameters should return the same result. However, + * determinism cannot be totally guaranteed. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -783,7 +821,8 @@ public _FinalStage seed(OptionalEnsures that only the most likely tokens, with total probability mass of p
, are considered for generation at each step. If both k
and p
are enabled, p
acts after k
.
- * Defaults to 0.75
. min value of 0.01
, max value of 0.99
.
0.75
. min value of 0.01
, max value of 0.99
.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@@ -801,7 +840,8 @@ public _FinalStage p(OptionalEnsures only the top k
most likely tokens are considered for generation at each step.
- * Defaults to 0
, min value of 0
, max value of 500
.
0
, min value of 0
, max value of 500
.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@@ -819,7 +859,8 @@ public _FinalStage k(OptionalThe maximum number of input tokens to send to the model. If not specified, max_input_tokens
is the model's context length limit minus a small buffer.
Input will be truncated according to the prompt_truncation
parameter.
Input will be truncated according to the prompt_truncation
parameter.
+ * Compatible Deployments: Cohere Platform
The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.
+ *The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -855,7 +897,8 @@ public _FinalStage maxTokens(OptionalDefaults to 0.3
.
A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.
- *Randomness can be further maximized by increasing the value of the p
parameter.
Randomness can be further maximized by increasing the value of the p
parameter.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Defaults to "accurate"
.
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want "accurate"
results or "fast"
results.
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want "accurate"
results or "fast"
results.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Some suggested keys are "text", "author", and "date". For better generation quality, it is recommended to keep the total word count of the strings in the dictionary to under 300 words.
*An id
field (string) can be optionally supplied to identify the document in the citations. This field will not be passed to the model.
An _excludes
field (array of strings) can be optionally supplied to omit some key-value pairs from being shown to the model. The omitted fields will still show up in the citation object. The "_excludes" field will not be passed to the model.
See 'Document Mode' in the guide for more information.
+ *See 'Document Mode' in the guide for more information. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -915,7 +960,8 @@ public _FinalStage documents(OptionalDefaults to false
.
When true
, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's message
will be generated.
When true
, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's message
will be generated.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Accepts {"id": "web-search"}
, and/or the "id"
for a custom connector, if you've created one.
When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG).
+ *When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG). + * Compatible Deployments: Cohere Platform
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -954,7 +1001,8 @@ public _FinalStage connectors(OptionalDictates how the prompt will be constructed.
*With prompt_truncation
set to "AUTO", some elements from chat_history
and documents
will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance.
With prompt_truncation
set to "AUTO_PRESERVE_ORDER", some elements from chat_history
and documents
will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API.
With prompt_truncation
set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a TooManyTokens
error will be returned.
With prompt_truncation
set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a TooManyTokens
error will be returned.
+ * Compatible Deployments: Cohere Platform Only AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker, Private Deployments
An alternative to chat_history
.
Providing a conversation_id
creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
Providing a conversation_id
creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
+ * Compatible Deployments: Cohere Platform
A list of previous messages between the user and the model, giving the model conversational context for responding to the user's message
.
Each item represents a single message in the chat history, excluding the current user turn. It has two properties: role
and message
. The role
identifies the sender (CHATBOT
, SYSTEM
, or USER
), while the message
contains the text content.
The chat_history parameter should not be used for SYSTEM
messages in most cases. Instead, to add a SYSTEM
role message at the beginning of a conversation, the preamble
parameter should be used.
The chat_history parameter should not be used for SYSTEM
messages in most cases. Instead, to add a SYSTEM
role message at the beginning of a conversation, the preamble
parameter should be used.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
When specified, the default Cohere preamble will be replaced with the provided one. Preambles are a part of the prompt used to adjust the model's overall behavior and conversation style, and use the SYSTEM
role.
The SYSTEM
role is also used for the contents of the optional chat_history=
parameter. When used with the chat_history=
parameter it adds content throughout a conversation. Conversely, when used with the preamble=
parameter it adds content at the start of the conversation only.
The SYSTEM
role is also used for the contents of the optional chat_history=
parameter. When used with the chat_history=
parameter it adds content throughout a conversation. Conversely, when used with the preamble=
parameter it adds content at the start of the conversation only.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Defaults to command-r-plus
.
The name of a compatible Cohere model or the ID of a fine-tuned model.
+ *The name of a compatible Cohere model or the ID of a fine-tuned model. + * Compatible Deployments: Cohere Platform, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override diff --git a/src/main/java/com/cohere/api/requests/ChatStreamRequest.java b/src/main/java/com/cohere/api/requests/ChatStreamRequest.java index a6b10d2..bbd711d 100644 --- a/src/main/java/com/cohere/api/requests/ChatStreamRequest.java +++ b/src/main/java/com/cohere/api/requests/ChatStreamRequest.java @@ -128,6 +128,7 @@ private ChatStreamRequest( /** * @return Text input for the model to respond to. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments */ @JsonProperty("message") public String getMessage() { @@ -136,7 +137,8 @@ public String getMessage() { /** * @return Defaults tocommand-r-plus
.
- * The name of a compatible Cohere model or the ID of a fine-tuned model.
+ *The name of a compatible Cohere model or the ID of a fine-tuned model. + * Compatible Deployments: Cohere Platform, Private Deployments
*/ @JsonProperty("model") public OptionalSYSTEM
role.
- * The SYSTEM
role is also used for the contents of the optional chat_history=
parameter. When used with the chat_history=
parameter it adds content throughout a conversation. Conversely, when used with the preamble=
parameter it adds content at the start of the conversation only.
The SYSTEM
role is also used for the contents of the optional chat_history=
parameter. When used with the chat_history=
parameter it adds content throughout a conversation. Conversely, when used with the preamble=
parameter it adds content at the start of the conversation only.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
message
.
* Each item represents a single message in the chat history, excluding the current user turn. It has two properties: role
and message
. The role
identifies the sender (CHATBOT
, SYSTEM
, or USER
), while the message
contains the text content.
The chat_history parameter should not be used for SYSTEM
messages in most cases. Instead, to add a SYSTEM
role message at the beginning of a conversation, the preamble
parameter should be used.
The chat_history parameter should not be used for SYSTEM
messages in most cases. Instead, to add a SYSTEM
role message at the beginning of a conversation, the preamble
parameter should be used.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
chat_history
.
- * Providing a conversation_id
creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
Providing a conversation_id
creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
+ * Compatible Deployments: Cohere Platform
Dictates how the prompt will be constructed.
*With prompt_truncation
set to "AUTO", some elements from chat_history
and documents
will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance.
With prompt_truncation
set to "AUTO_PRESERVE_ORDER", some elements from chat_history
and documents
will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API.
With prompt_truncation
set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a TooManyTokens
error will be returned.
With prompt_truncation
set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a TooManyTokens
error will be returned.
+ * Compatible Deployments: Cohere Platform Only AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker, Private Deployments
{"id": "web-search"}
, and/or the "id"
for a custom connector, if you've created one.
- * When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG).
+ *When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG). + * Compatible Deployments: Cohere Platform
*/ @JsonProperty("connectors") public Optionalfalse
.
- * When true
, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's message
will be generated.
When true
, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's message
will be generated.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Some suggested keys are "text", "author", and "date". For better generation quality, it is recommended to keep the total word count of the strings in the dictionary to under 300 words.
*An id
field (string) can be optionally supplied to identify the document in the citations. This field will not be passed to the model.
An _excludes
field (array of strings) can be optionally supplied to omit some key-value pairs from being shown to the model. The omitted fields will still show up in the citation object. The "_excludes" field will not be passed to the model.
See 'Document Mode' in the guide for more information.
+ *See 'Document Mode' in the guide for more information. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
*/ @JsonProperty("documents") public Optional"accurate"
.
- * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want "accurate"
results or "fast"
results.
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want "accurate"
results or "fast"
results.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
0.3
.
* A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.
- *Randomness can be further maximized by increasing the value of the p
parameter.
Randomness can be further maximized by increasing the value of the p
parameter.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
max_input_tokens
is the model's context length limit minus a small buffer.
- * Input will be truncated according to the prompt_truncation
parameter.
Input will be truncated according to the prompt_truncation
parameter.
+ * Compatible Deployments: Cohere Platform
k
most likely tokens are considered for generation at each step.
* Defaults to 0
, min value of 0
, max value of 500
.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
*/
@JsonProperty("k")
public Optionalp
, are considered for generation at each step. If both k
and p
are enabled, p
acts after k
.
* Defaults to 0.75
. min value of 0.01
, max value of 0.99
.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
*/
@JsonProperty("p")
public Optional0.0
, min value of 0.0
, max value of 1.0
.
- * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
+ *Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
*/ @JsonProperty("frequency_penalty") public Optional0.0
, min value of 0.0
, max value of 1.0
.
- * Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty
, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty
, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
When tools
is passed (without tool_results
), the text
field in the response will be ""
and the tool_calls
field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the tool_calls
array will be empty.
When tools
is passed (without tool_results
), the text
field in the response will be ""
and the tool_calls
field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the tool_calls
array will be empty.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Note: Chat calls with tool_results
should not be included in the Chat history to avoid duplication of the message text.
Note: Chat calls with tool_results
should not be included in the Chat history to avoid duplication of the message text.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Text input for the model to respond to.
+ *Text input for the model to respond to. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -643,7 +670,8 @@ public _FinalStage message(String message) { * ... * ] * - *Note: Chat calls with tool_results
should not be included in the Chat history to avoid duplication of the message text.
Note: Chat calls with tool_results
should not be included in the Chat history to avoid duplication of the message text.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
A list of available tools (functions) that the model may suggest invoking before producing a text response.
- *When tools
is passed (without tool_results
), the text
field in the response will be ""
and the tool_calls
field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the tool_calls
array will be empty.
When tools
is passed (without tool_results
), the text
field in the response will be ""
and the tool_calls
field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the tool_calls
array will be empty.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
When enabled, the user's prompt will be sent to the model without any pre-processing.
+ *When enabled, the user's prompt will be sent to the model without + * any pre-processing. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -713,7 +744,8 @@ public _FinalStage rawPrompting(OptionalDefaults to 0.0
, min value of 0.0
, max value of 1.0
.
Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty
, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty
, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Defaults to 0.0
, min value of 0.0
, max value of 1.0
.
Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
+ *Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -748,7 +781,8 @@ public _FinalStage frequencyPenalty(OptionalA list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence.
+ *A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -765,7 +799,11 @@ public _FinalStage stopSequences(OptionalIf specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed.
+ *If specified, the backend will make a best effort to sample tokens + * deterministically, such that repeated requests with the same + * seed and parameters should return the same result. However, + * determinism cannot be totally guaranteed. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -783,7 +821,8 @@ public _FinalStage seed(OptionalEnsures that only the most likely tokens, with total probability mass of p
, are considered for generation at each step. If both k
and p
are enabled, p
acts after k
.
- * Defaults to 0.75
. min value of 0.01
, max value of 0.99
.
0.75
. min value of 0.01
, max value of 0.99
.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@@ -801,7 +840,8 @@ public _FinalStage p(OptionalEnsures only the top k
most likely tokens are considered for generation at each step.
- * Defaults to 0
, min value of 0
, max value of 500
.
0
, min value of 0
, max value of 500
.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@@ -819,7 +859,8 @@ public _FinalStage k(OptionalThe maximum number of input tokens to send to the model. If not specified, max_input_tokens
is the model's context length limit minus a small buffer.
Input will be truncated according to the prompt_truncation
parameter.
Input will be truncated according to the prompt_truncation
parameter.
+ * Compatible Deployments: Cohere Platform
The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.
+ *The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -855,7 +897,8 @@ public _FinalStage maxTokens(OptionalDefaults to 0.3
.
A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.
- *Randomness can be further maximized by increasing the value of the p
parameter.
Randomness can be further maximized by increasing the value of the p
parameter.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Defaults to "accurate"
.
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want "accurate"
results or "fast"
results.
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want "accurate"
results or "fast"
results.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Some suggested keys are "text", "author", and "date". For better generation quality, it is recommended to keep the total word count of the strings in the dictionary to under 300 words.
*An id
field (string) can be optionally supplied to identify the document in the citations. This field will not be passed to the model.
An _excludes
field (array of strings) can be optionally supplied to omit some key-value pairs from being shown to the model. The omitted fields will still show up in the citation object. The "_excludes" field will not be passed to the model.
See 'Document Mode' in the guide for more information.
+ *See 'Document Mode' in the guide for more information. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -915,7 +960,8 @@ public _FinalStage documents(OptionalDefaults to false
.
When true
, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's message
will be generated.
When true
, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's message
will be generated.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Accepts {"id": "web-search"}
, and/or the "id"
for a custom connector, if you've created one.
When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG).
+ *When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG). + * Compatible Deployments: Cohere Platform
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -954,7 +1001,8 @@ public _FinalStage connectors(OptionalDictates how the prompt will be constructed.
*With prompt_truncation
set to "AUTO", some elements from chat_history
and documents
will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance.
With prompt_truncation
set to "AUTO_PRESERVE_ORDER", some elements from chat_history
and documents
will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API.
With prompt_truncation
set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a TooManyTokens
error will be returned.
With prompt_truncation
set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a TooManyTokens
error will be returned.
+ * Compatible Deployments: Cohere Platform Only AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker, Private Deployments
An alternative to chat_history
.
Providing a conversation_id
creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
Providing a conversation_id
creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
+ * Compatible Deployments: Cohere Platform
A list of previous messages between the user and the model, giving the model conversational context for responding to the user's message
.
Each item represents a single message in the chat history, excluding the current user turn. It has two properties: role
and message
. The role
identifies the sender (CHATBOT
, SYSTEM
, or USER
), while the message
contains the text content.
The chat_history parameter should not be used for SYSTEM
messages in most cases. Instead, to add a SYSTEM
role message at the beginning of a conversation, the preamble
parameter should be used.
The chat_history parameter should not be used for SYSTEM
messages in most cases. Instead, to add a SYSTEM
role message at the beginning of a conversation, the preamble
parameter should be used.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
When specified, the default Cohere preamble will be replaced with the provided one. Preambles are a part of the prompt used to adjust the model's overall behavior and conversation style, and use the SYSTEM
role.
The SYSTEM
role is also used for the contents of the optional chat_history=
parameter. When used with the chat_history=
parameter it adds content throughout a conversation. Conversely, when used with the preamble=
parameter it adds content at the start of the conversation only.
The SYSTEM
role is also used for the contents of the optional chat_history=
parameter. When used with the chat_history=
parameter it adds content throughout a conversation. Conversely, when used with the preamble=
parameter it adds content at the start of the conversation only.
+ * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
Defaults to command-r-plus
.
The name of a compatible Cohere model or the ID of a fine-tuned model.
+ *The name of a compatible Cohere model or the ID of a fine-tuned model. + * Compatible Deployments: Cohere Platform, Private Deployments
* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override diff --git a/src/main/java/com/cohere/api/resources/datasets/requests/DatasetsCreateRequest.java b/src/main/java/com/cohere/api/resources/datasets/requests/DatasetsCreateRequest.java index 088a858..d8a0271 100644 --- a/src/main/java/com/cohere/api/resources/datasets/requests/DatasetsCreateRequest.java +++ b/src/main/java/com/cohere/api/resources/datasets/requests/DatasetsCreateRequest.java @@ -73,7 +73,7 @@ public String getName() { } /** - * @return The dataset type, which is used to validate the data. Valid types areembed-input
, reranker-finetune-input
, prompt-completion-finetune-input
, single-label-classification-finetune-input
, chat-finetune-input
, and multi-label-classification-finetune-input
.
+ * @return The dataset type, which is used to validate the data. Valid types are embed-input
, reranker-finetune-input
, single-label-classification-finetune-input
, chat-finetune-input
, and multi-label-classification-finetune-input
.
*/
@JsonProperty("type")
public DatasetType getType() {
@@ -275,7 +275,7 @@ public TypeStage name(String name) {
}
/**
- * The dataset type, which is used to validate the data. Valid types are embed-input
, reranker-finetune-input
, prompt-completion-finetune-input
, single-label-classification-finetune-input
, chat-finetune-input
, and multi-label-classification-finetune-input
.
The dataset type, which is used to validate the data. Valid types are embed-input
, reranker-finetune-input
, single-label-classification-finetune-input
, chat-finetune-input
, and multi-label-classification-finetune-input
.
The first few rows of the parsed file
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage samples(ListThe download url of the original file
* @return Reference to {@code this} so that method calls can be chained together. @@ -322,7 +361,8 @@ public _FinalStage url(Optional