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 Optional getModel() { @@ -150,7 +152,8 @@ public Boolean getStream() { /** * @return 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

*/ @JsonProperty("preamble") public Optional getPreamble() { @@ -160,7 +163,8 @@ public Optional getPreamble() { /** * @return 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

*/ @JsonProperty("chat_history") public Optional> getChatHistory() { @@ -169,7 +173,8 @@ public Optional> getChatHistory() { /** * @return 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

*/ @JsonProperty("conversation_id") public Optional getConversationId() { @@ -181,7 +186,8 @@ public Optional getConversationId() { *

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

*/ @JsonProperty("prompt_truncation") public Optional getPromptTruncation() { @@ -190,7 +196,8 @@ public Optional getPromptTruncation() { /** * @return 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

*/ @JsonProperty("connectors") public Optional> getConnectors() { @@ -199,7 +206,8 @@ public Optional> getConnectors() { /** * @return Defaults 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

*/ @JsonProperty("search_queries_only") public Optional getSearchQueriesOnly() { @@ -214,7 +222,8 @@ public Optional getSearchQueriesOnly() { *

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>> getDocuments() { @@ -223,7 +232,8 @@ public Optional>> getDocuments() { /** * @return 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

*/ @JsonProperty("citation_quality") public Optional getCitationQuality() { @@ -233,7 +243,8 @@ public Optional getCitationQuality() { /** * @return Defaults 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

*/ @JsonProperty("temperature") public Optional getTemperature() { @@ -242,6 +253,7 @@ public Optional getTemperature() { /** * @return 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 */ @JsonProperty("max_tokens") public Optional getMaxTokens() { @@ -250,7 +262,8 @@ public Optional getMaxTokens() { /** * @return The 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

*/ @JsonProperty("max_input_tokens") public Optional getMaxInputTokens() { @@ -260,6 +273,7 @@ public Optional getMaxInputTokens() { /** * @return Ensures 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. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments */ @JsonProperty("k") public Optional getK() { @@ -269,6 +283,7 @@ public Optional getK() { /** * @return Ensures 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. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments */ @JsonProperty("p") public Optional getP() { @@ -276,7 +291,11 @@ public Optional getP() { } /** - * @return 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. + * @return 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 */ @JsonProperty("seed") public Optional getSeed() { @@ -285,6 +304,7 @@ public Optional getSeed() { /** * @return 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 */ @JsonProperty("stop_sequences") public Optional> getStopSequences() { @@ -293,7 +313,8 @@ public Optional> getStopSequences() { /** * @return 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

*/ @JsonProperty("frequency_penalty") public Optional getFrequencyPenalty() { @@ -302,7 +323,8 @@ public Optional getFrequencyPenalty() { /** * @return Defaults 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

*/ @JsonProperty("presence_penalty") public Optional getPresencePenalty() { @@ -310,7 +332,9 @@ public Optional getPresencePenalty() { } /** - * @return When enabled, the user's prompt will be sent to the model without any pre-processing. + * @return 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 */ @JsonProperty("raw_prompting") public Optional getRawPrompting() { @@ -327,7 +351,8 @@ public Optional getReturnPrompt() { /** * @return 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

*/ @JsonProperty("tools") public Optional> getTools() { @@ -353,7 +378,8 @@ public Optional> getTools() { * ... * ] * - *

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

*/ @JsonProperty("tool_results") public Optional> getToolResults() { @@ -614,7 +640,8 @@ public Builder from(ChatRequest other) { } /** - *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -661,7 +689,8 @@ public _FinalStage toolResults(Optional> toolRe /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -695,7 +724,9 @@ public _FinalStage returnPrompt(Optional returnPrompt) { } /** - *

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(Optional rawPrompting) { /** *

Defaults 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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -731,7 +763,8 @@ public _FinalStage presencePenalty(Optional presencePenalty) { /** *

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(Optional frequencyPenalty) { } /** - *

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.

+ *

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(Optional> stopSequences) { } /** - *

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.

+ *

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(Optional seed) { /** *

Ensures 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.

+ * Defaults to 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(Optional p) { /** *

Ensures 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.

+ * Defaults to 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(Optional k) { /** *

The 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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -836,7 +877,8 @@ public _FinalStage maxInputTokens(Optional maxInputTokens) { } /** - *

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(Optional maxTokens) { /** *

Defaults 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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -873,7 +916,8 @@ public _FinalStage temperature(Optional temperature) { /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -897,7 +941,8 @@ public _FinalStage citationQuality(Optional citation *

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(Optional>> documents) { /** *

Defaults 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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -933,7 +979,8 @@ public _FinalStage searchQueriesOnly(Optional searchQueriesOnly) { /** *

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(Optional> connectors) { *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -972,7 +1020,8 @@ public _FinalStage promptTruncation(Optional prompt /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -991,7 +1040,8 @@ public _FinalStage conversationId(Optional conversationId) { /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -1009,7 +1059,8 @@ public _FinalStage chatHistory(Optional> chatHistory) { /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -1027,7 +1078,8 @@ public _FinalStage preamble(Optional preamble) { /** *

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 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 Optional getModel() { @@ -150,7 +152,8 @@ public Boolean getStream() { /** * @return 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

*/ @JsonProperty("preamble") public Optional getPreamble() { @@ -160,7 +163,8 @@ public Optional getPreamble() { /** * @return 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

*/ @JsonProperty("chat_history") public Optional> getChatHistory() { @@ -169,7 +173,8 @@ public Optional> getChatHistory() { /** * @return 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

*/ @JsonProperty("conversation_id") public Optional getConversationId() { @@ -181,7 +186,8 @@ public Optional getConversationId() { *

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

*/ @JsonProperty("prompt_truncation") public Optional getPromptTruncation() { @@ -190,7 +196,8 @@ public Optional getPromptTruncation() { /** * @return 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

*/ @JsonProperty("connectors") public Optional> getConnectors() { @@ -199,7 +206,8 @@ public Optional> getConnectors() { /** * @return Defaults 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

*/ @JsonProperty("search_queries_only") public Optional getSearchQueriesOnly() { @@ -214,7 +222,8 @@ public Optional getSearchQueriesOnly() { *

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>> getDocuments() { @@ -223,7 +232,8 @@ public Optional>> getDocuments() { /** * @return 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

*/ @JsonProperty("citation_quality") public Optional getCitationQuality() { @@ -233,7 +243,8 @@ public Optional getCitationQuality() { /** * @return Defaults 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

*/ @JsonProperty("temperature") public Optional getTemperature() { @@ -242,6 +253,7 @@ public Optional getTemperature() { /** * @return 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 */ @JsonProperty("max_tokens") public Optional getMaxTokens() { @@ -250,7 +262,8 @@ public Optional getMaxTokens() { /** * @return The 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

*/ @JsonProperty("max_input_tokens") public Optional getMaxInputTokens() { @@ -260,6 +273,7 @@ public Optional getMaxInputTokens() { /** * @return Ensures 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. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments */ @JsonProperty("k") public Optional getK() { @@ -269,6 +283,7 @@ public Optional getK() { /** * @return Ensures 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. + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments */ @JsonProperty("p") public Optional getP() { @@ -276,7 +291,11 @@ public Optional getP() { } /** - * @return 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. + * @return 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 */ @JsonProperty("seed") public Optional getSeed() { @@ -285,6 +304,7 @@ public Optional getSeed() { /** * @return 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 */ @JsonProperty("stop_sequences") public Optional> getStopSequences() { @@ -293,7 +313,8 @@ public Optional> getStopSequences() { /** * @return 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

*/ @JsonProperty("frequency_penalty") public Optional getFrequencyPenalty() { @@ -302,7 +323,8 @@ public Optional getFrequencyPenalty() { /** * @return Defaults 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

*/ @JsonProperty("presence_penalty") public Optional getPresencePenalty() { @@ -310,7 +332,9 @@ public Optional getPresencePenalty() { } /** - * @return When enabled, the user's prompt will be sent to the model without any pre-processing. + * @return 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 */ @JsonProperty("raw_prompting") public Optional getRawPrompting() { @@ -327,7 +351,8 @@ public Optional getReturnPrompt() { /** * @return 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

*/ @JsonProperty("tools") public Optional> getTools() { @@ -353,7 +378,8 @@ public Optional> getTools() { * ... * ] * - *

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

*/ @JsonProperty("tool_results") public Optional> getToolResults() { @@ -614,7 +640,8 @@ public Builder from(ChatStreamRequest other) { } /** - *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -661,7 +689,8 @@ public _FinalStage toolResults(Optional> /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -695,7 +724,9 @@ public _FinalStage returnPrompt(Optional returnPrompt) { } /** - *

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(Optional rawPrompting) { /** *

Defaults 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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -731,7 +763,8 @@ public _FinalStage presencePenalty(Optional presencePenalty) { /** *

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(Optional frequencyPenalty) { } /** - *

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.

+ *

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(Optional> stopSequences) { } /** - *

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.

+ *

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(Optional seed) { /** *

Ensures 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.

+ * Defaults to 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(Optional p) { /** *

Ensures 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.

+ * Defaults to 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(Optional k) { /** *

The 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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -836,7 +877,8 @@ public _FinalStage maxInputTokens(Optional maxInputTokens) { } /** - *

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(Optional maxTokens) { /** *

Defaults 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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -873,7 +916,8 @@ public _FinalStage temperature(Optional temperature) { /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -897,7 +941,8 @@ public _FinalStage citationQuality(Optional ci *

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(Optional>> documents) { /** *

Defaults 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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -933,7 +979,8 @@ public _FinalStage searchQueriesOnly(Optional searchQueriesOnly) { /** *

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(Optional> connectors) { *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -972,7 +1020,8 @@ public _FinalStage promptTruncation(Optional /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -991,7 +1040,8 @@ public _FinalStage conversationId(Optional conversationId) { /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -1009,7 +1059,8 @@ public _FinalStage chatHistory(Optional> chatHistory) { /** *

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

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -1027,7 +1078,8 @@ public _FinalStage preamble(Optional preamble) { /** *

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 are embed-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.

* @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/types/DatasetsCreateResponseDatasetParts.java b/src/main/java/com/cohere/api/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.java similarity index 88% rename from src/main/java/com/cohere/api/resources/datasets/types/DatasetsCreateResponseDatasetParts.java rename to src/main/java/com/cohere/api/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.java index 492f65c..9123298 100644 --- a/src/main/java/com/cohere/api/resources/datasets/types/DatasetsCreateResponseDatasetParts.java +++ b/src/main/java/com/cohere/api/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.java @@ -19,8 +19,8 @@ import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = DatasetsCreateResponseDatasetParts.Builder.class) -public final class DatasetsCreateResponseDatasetParts { +@JsonDeserialize(builder = DatasetsCreateResponseDatasetPartsItem.Builder.class) +public final class DatasetsCreateResponseDatasetPartsItem { private final Optional name; private final Optional numRows; @@ -31,7 +31,7 @@ public final class DatasetsCreateResponseDatasetParts { private final Map additionalProperties; - private DatasetsCreateResponseDatasetParts( + private DatasetsCreateResponseDatasetPartsItem( Optional name, Optional numRows, Optional> samples, @@ -76,8 +76,8 @@ public Optional getPartKind() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof DatasetsCreateResponseDatasetParts - && equalTo((DatasetsCreateResponseDatasetParts) other); + return other instanceof DatasetsCreateResponseDatasetPartsItem + && equalTo((DatasetsCreateResponseDatasetPartsItem) other); } @JsonAnyGetter @@ -85,7 +85,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(DatasetsCreateResponseDatasetParts other) { + private boolean equalTo(DatasetsCreateResponseDatasetPartsItem other) { return name.equals(other.name) && numRows.equals(other.numRows) && samples.equals(other.samples) @@ -121,7 +121,7 @@ public static final class Builder { private Builder() {} - public Builder from(DatasetsCreateResponseDatasetParts other) { + public Builder from(DatasetsCreateResponseDatasetPartsItem other) { name(other.getName()); numRows(other.getNumRows()); samples(other.getSamples()); @@ -173,8 +173,8 @@ public Builder partKind(String partKind) { return this; } - public DatasetsCreateResponseDatasetParts build() { - return new DatasetsCreateResponseDatasetParts(name, numRows, samples, partKind, additionalProperties); + public DatasetsCreateResponseDatasetPartsItem build() { + return new DatasetsCreateResponseDatasetPartsItem(name, numRows, samples, partKind, additionalProperties); } } } diff --git a/src/main/java/com/cohere/api/types/CheckApiKeyResponse.java b/src/main/java/com/cohere/api/types/CheckApiKeyResponse.java new file mode 100644 index 0000000..6c3ff7f --- /dev/null +++ b/src/main/java/com/cohere/api/types/CheckApiKeyResponse.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.cohere.api.types; + +import com.cohere.api.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = CheckApiKeyResponse.Builder.class) +public final class CheckApiKeyResponse { + private final boolean valid; + + private final Optional organizationId; + + private final Optional ownerId; + + private final Map additionalProperties; + + private CheckApiKeyResponse( + boolean valid, + Optional organizationId, + Optional ownerId, + Map additionalProperties) { + this.valid = valid; + this.organizationId = organizationId; + this.ownerId = ownerId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("valid") + public boolean getValid() { + return valid; + } + + @JsonProperty("organization_id") + public Optional getOrganizationId() { + return organizationId; + } + + @JsonProperty("owner_id") + public Optional getOwnerId() { + return ownerId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckApiKeyResponse && equalTo((CheckApiKeyResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckApiKeyResponse other) { + return valid == other.valid && organizationId.equals(other.organizationId) && ownerId.equals(other.ownerId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.valid, this.organizationId, this.ownerId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ValidStage builder() { + return new Builder(); + } + + public interface ValidStage { + _FinalStage valid(boolean valid); + + Builder from(CheckApiKeyResponse other); + } + + public interface _FinalStage { + CheckApiKeyResponse build(); + + _FinalStage organizationId(Optional organizationId); + + _FinalStage organizationId(String organizationId); + + _FinalStage ownerId(Optional ownerId); + + _FinalStage ownerId(String ownerId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ValidStage, _FinalStage { + private boolean valid; + + private Optional ownerId = Optional.empty(); + + private Optional organizationId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckApiKeyResponse other) { + valid(other.getValid()); + organizationId(other.getOrganizationId()); + ownerId(other.getOwnerId()); + return this; + } + + @java.lang.Override + @JsonSetter("valid") + public _FinalStage valid(boolean valid) { + this.valid = valid; + return this; + } + + @java.lang.Override + public _FinalStage ownerId(String ownerId) { + this.ownerId = Optional.of(ownerId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "owner_id", nulls = Nulls.SKIP) + public _FinalStage ownerId(Optional ownerId) { + this.ownerId = ownerId; + return this; + } + + @java.lang.Override + public _FinalStage organizationId(String organizationId) { + this.organizationId = Optional.of(organizationId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "organization_id", nulls = Nulls.SKIP) + public _FinalStage organizationId(Optional organizationId) { + this.organizationId = organizationId; + return this; + } + + @java.lang.Override + public CheckApiKeyResponse build() { + return new CheckApiKeyResponse(valid, organizationId, ownerId, additionalProperties); + } + } +} diff --git a/src/main/java/com/cohere/api/types/DatasetPart.java b/src/main/java/com/cohere/api/types/DatasetPart.java index fd06846..3c68823 100644 --- a/src/main/java/com/cohere/api/types/DatasetPart.java +++ b/src/main/java/com/cohere/api/types/DatasetPart.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -34,6 +35,8 @@ public final class DatasetPart { private final Optional originalUrl; + private final Optional> samples; + private final Map additionalProperties; private DatasetPart( @@ -44,6 +47,7 @@ private DatasetPart( Optional sizeBytes, Optional numRows, Optional originalUrl, + Optional> samples, Map additionalProperties) { this.id = id; this.name = name; @@ -52,6 +56,7 @@ private DatasetPart( this.sizeBytes = sizeBytes; this.numRows = numRows; this.originalUrl = originalUrl; + this.samples = samples; this.additionalProperties = additionalProperties; } @@ -111,6 +116,14 @@ public Optional getOriginalUrl() { return originalUrl; } + /** + * @return The first few rows of the parsed file + */ + @JsonProperty("samples") + public Optional> getSamples() { + return samples; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -129,12 +142,14 @@ private boolean equalTo(DatasetPart other) { && index.equals(other.index) && sizeBytes.equals(other.sizeBytes) && numRows.equals(other.numRows) - && originalUrl.equals(other.originalUrl); + && originalUrl.equals(other.originalUrl) + && samples.equals(other.samples); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.name, this.url, this.index, this.sizeBytes, this.numRows, this.originalUrl); + return Objects.hash( + this.id, this.name, this.url, this.index, this.sizeBytes, this.numRows, this.originalUrl, this.samples); } @java.lang.Override @@ -178,6 +193,10 @@ public interface _FinalStage { _FinalStage originalUrl(Optional originalUrl); _FinalStage originalUrl(String originalUrl); + + _FinalStage samples(Optional> samples); + + _FinalStage samples(List samples); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -186,6 +205,8 @@ public static final class Builder implements IdStage, NameStage, _FinalStage { private String name; + private Optional> samples = Optional.empty(); + private Optional originalUrl = Optional.empty(); private Optional numRows = Optional.empty(); @@ -210,6 +231,7 @@ public Builder from(DatasetPart other) { sizeBytes(other.getSizeBytes()); numRows(other.getNumRows()); originalUrl(other.getOriginalUrl()); + samples(other.getSamples()); return this; } @@ -235,6 +257,23 @@ public _FinalStage name(String name) { return this; } + /** + *

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(List samples) { + this.samples = Optional.of(samples); + return this; + } + + @java.lang.Override + @JsonSetter(value = "samples", nulls = Nulls.SKIP) + public _FinalStage samples(Optional> samples) { + this.samples = samples; + return this; + } + /** *

The 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 url) { @java.lang.Override public DatasetPart build() { - return new DatasetPart(id, name, url, index, sizeBytes, numRows, originalUrl, additionalProperties); + return new DatasetPart( + id, name, url, index, sizeBytes, numRows, originalUrl, samples, additionalProperties); } } } diff --git a/src/main/java/com/cohere/api/types/DatasetType.java b/src/main/java/com/cohere/api/types/DatasetType.java index 7cf2beb..a2dc4e7 100644 --- a/src/main/java/com/cohere/api/types/DatasetType.java +++ b/src/main/java/com/cohere/api/types/DatasetType.java @@ -16,8 +16,6 @@ public enum DatasetType { RERANKER_FINETUNE_INPUT("reranker-finetune-input"), - PROMPT_COMPLETION_FINETUNE_INPUT("prompt-completion-finetune-input"), - SINGLE_LABEL_CLASSIFICATION_FINETUNE_INPUT("single-label-classification-finetune-input"), CHAT_FINETUNE_INPUT("chat-finetune-input"), diff --git a/src/main/java/com/cohere/api/types/Metrics.java b/src/main/java/com/cohere/api/types/Metrics.java index 8f3eafd..08b0c16 100644 --- a/src/main/java/com/cohere/api/types/Metrics.java +++ b/src/main/java/com/cohere/api/types/Metrics.java @@ -22,10 +22,16 @@ public final class Metrics { private final Optional finetuneDatasetMetrics; + private final Optional embedData; + private final Map additionalProperties; - private Metrics(Optional finetuneDatasetMetrics, Map additionalProperties) { + private Metrics( + Optional finetuneDatasetMetrics, + Optional embedData, + Map additionalProperties) { this.finetuneDatasetMetrics = finetuneDatasetMetrics; + this.embedData = embedData; this.additionalProperties = additionalProperties; } @@ -34,6 +40,11 @@ public Optional getFinetuneDatasetMetrics() { return finetuneDatasetMetrics; } + @JsonProperty("embed_data") + public Optional getEmbedData() { + return embedData; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -46,12 +57,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(Metrics other) { - return finetuneDatasetMetrics.equals(other.finetuneDatasetMetrics); + return finetuneDatasetMetrics.equals(other.finetuneDatasetMetrics) && embedData.equals(other.embedData); } @java.lang.Override public int hashCode() { - return Objects.hash(this.finetuneDatasetMetrics); + return Objects.hash(this.finetuneDatasetMetrics, this.embedData); } @java.lang.Override @@ -67,6 +78,8 @@ public static Builder builder() { public static final class Builder { private Optional finetuneDatasetMetrics = Optional.empty(); + private Optional embedData = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -74,6 +87,7 @@ private Builder() {} public Builder from(Metrics other) { finetuneDatasetMetrics(other.getFinetuneDatasetMetrics()); + embedData(other.getEmbedData()); return this; } @@ -88,8 +102,19 @@ public Builder finetuneDatasetMetrics(FinetuneDatasetMetrics finetuneDatasetMetr return this; } + @JsonSetter(value = "embed_data", nulls = Nulls.SKIP) + public Builder embedData(Optional embedData) { + this.embedData = embedData; + return this; + } + + public Builder embedData(MetricsEmbedData embedData) { + this.embedData = Optional.of(embedData); + return this; + } + public Metrics build() { - return new Metrics(finetuneDatasetMetrics, additionalProperties); + return new Metrics(finetuneDatasetMetrics, embedData, additionalProperties); } } } diff --git a/src/main/java/com/cohere/api/types/MetricsEmbedData.java b/src/main/java/com/cohere/api/types/MetricsEmbedData.java new file mode 100644 index 0000000..938b091 --- /dev/null +++ b/src/main/java/com/cohere/api/types/MetricsEmbedData.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.cohere.api.types; + +import com.cohere.api.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = MetricsEmbedData.Builder.class) +public final class MetricsEmbedData { + private final Optional> fields; + + private final Map additionalProperties; + + private MetricsEmbedData( + Optional> fields, Map additionalProperties) { + this.fields = fields; + this.additionalProperties = additionalProperties; + } + + /** + * @return the fields in the dataset + */ + @JsonProperty("fields") + public Optional> getFields() { + return fields; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MetricsEmbedData && equalTo((MetricsEmbedData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MetricsEmbedData other) { + return fields.equals(other.fields); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fields); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> fields = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MetricsEmbedData other) { + fields(other.getFields()); + return this; + } + + @JsonSetter(value = "fields", nulls = Nulls.SKIP) + public Builder fields(Optional> fields) { + this.fields = fields; + return this; + } + + public Builder fields(List fields) { + this.fields = Optional.of(fields); + return this; + } + + public MetricsEmbedData build() { + return new MetricsEmbedData(fields, additionalProperties); + } + } +} diff --git a/src/main/java/com/cohere/api/types/MetricsEmbedDataFieldsItem.java b/src/main/java/com/cohere/api/types/MetricsEmbedDataFieldsItem.java new file mode 100644 index 0000000..15286df --- /dev/null +++ b/src/main/java/com/cohere/api/types/MetricsEmbedDataFieldsItem.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.cohere.api.types; + +import com.cohere.api.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = MetricsEmbedDataFieldsItem.Builder.class) +public final class MetricsEmbedDataFieldsItem { + private final Optional name; + + private final Optional count; + + private final Map additionalProperties; + + private MetricsEmbedDataFieldsItem( + Optional name, Optional count, Map additionalProperties) { + this.name = name; + this.count = count; + this.additionalProperties = additionalProperties; + } + + /** + * @return the name of the field + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return the number of times the field appears in the dataset + */ + @JsonProperty("count") + public Optional getCount() { + return count; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MetricsEmbedDataFieldsItem && equalTo((MetricsEmbedDataFieldsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MetricsEmbedDataFieldsItem other) { + return name.equals(other.name) && count.equals(other.count); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.count); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional count = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MetricsEmbedDataFieldsItem other) { + name(other.getName()); + count(other.getCount()); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.of(name); + return this; + } + + @JsonSetter(value = "count", nulls = Nulls.SKIP) + public Builder count(Optional count) { + this.count = count; + return this; + } + + public Builder count(Double count) { + this.count = Optional.of(count); + return this; + } + + public MetricsEmbedDataFieldsItem build() { + return new MetricsEmbedDataFieldsItem(name, count, additionalProperties); + } + } +} diff --git a/src/main/java/com/cohere/api/types/TooManyRequestsErrorBody.java b/src/main/java/com/cohere/api/types/TooManyRequestsErrorBody.java new file mode 100644 index 0000000..6f9a12a --- /dev/null +++ b/src/main/java/com/cohere/api/types/TooManyRequestsErrorBody.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.cohere.api.types; + +import com.cohere.api.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = TooManyRequestsErrorBody.Builder.class) +public final class TooManyRequestsErrorBody { + private final Optional data; + + private final Map additionalProperties; + + private TooManyRequestsErrorBody(Optional data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public Optional getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TooManyRequestsErrorBody && equalTo((TooManyRequestsErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TooManyRequestsErrorBody other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional data = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TooManyRequestsErrorBody other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional data) { + this.data = data; + return this; + } + + public Builder data(String data) { + this.data = Optional.of(data); + return this; + } + + public TooManyRequestsErrorBody build() { + return new TooManyRequestsErrorBody(data, additionalProperties); + } + } +}