From a2a4e56c99cea9a8b6b27485ecbf3d32c77c91f6 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 15 Oct 2025 14:07:43 +0000 Subject: [PATCH] SDK regeneration --- build.gradle | 4 +- reference.md | 60 +++++------------- .../com/cohere/api/requests/ChatRequest.java | 16 ++--- .../api/requests/ChatStreamRequest.java | 16 ++--- .../com/cohere/api/requests/EmbedRequest.java | 4 +- .../requests/DatasetsCreateRequest.java | 8 +-- .../resources/models/AsyncModelsClient.java | 6 +- .../models/AsyncRawModelsClient.java | 6 +- .../api/resources/models/ModelsClient.java | 6 +- .../api/resources/models/RawModelsClient.java | 6 +- .../resources/v2/requests/V2ChatRequest.java | 8 +-- .../v2/requests/V2ChatStreamRequest.java | 8 +-- .../resources/v2/requests/V2EmbedRequest.java | 8 +-- .../java/com/cohere/api/types/ApiMeta.java | 34 +++++++++- .../api/types/ChatRequestCitationQuality.java | 10 ++- .../ChatStreamRequestCitationQuality.java | 10 ++- .../com/cohere/api/types/CitationOptions.java | 10 ++- .../cohere/api/types/CitationOptionsMode.java | 4 ++ .../com/cohere/api/types/DatasetType.java | 10 ++- .../cohere/api/types/GetModelResponse.java | 32 ---------- src/main/java/com/cohere/api/types/Usage.java | 63 +++++++------------ 21 files changed, 149 insertions(+), 180 deletions(-) diff --git a/build.gradle b/build.gradle index 6da2fa7..102bc1e 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ java { group = 'com.cohere' -version = '1.8.2' +version = '1.8.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -77,7 +77,7 @@ publishing { maven(MavenPublication) { groupId = 'com.cohere' artifactId = 'cohere-java' - version = '1.8.2' + version = '1.8.0' from components.java pom { name = 'cohere' diff --git a/reference.md b/reference.md index 0a2e614..588bb3e 100644 --- a/reference.md +++ b/reference.md @@ -31,8 +31,9 @@ To learn how to use the Chat API and RAG follow our [Text Generation guides](htt client.chatStream( ChatStreamRequest .builder() - .message("hello world!") + .message("hello!") .stream(true) + .model("command-a-03-2025") .build() ); ``` @@ -223,9 +224,8 @@ Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private D **citationQuality:** `Optional` -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, `"fast"` results or no results. +Defaults to `"enabled"`. +Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`. Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments @@ -487,36 +487,9 @@ To learn how to use the Chat API and RAG follow our [Text Generation guides](htt client.chatStream( ChatStreamRequest .builder() - .message("What year was he born?") + .message("Tell me about LLMs") .stream(false) - .chatHistory( - new ArrayList( - Arrays.asList( - Message.user( - ChatMessage - .builder() - .message("Who discovered gravity?") - .build() - ), - Message.chatbot( - ChatMessage - .builder() - .message("The man who is widely credited with discovering gravity is Sir Isaac Newton") - .build() - ) - ) - ) - ) - .connectors( - new ArrayList( - Arrays.asList( - ChatConnector - .builder() - .id("web-search") - .build() - ) - ) - ) + .model("command-a-03-2025") .build() ); ``` @@ -707,9 +680,8 @@ Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private D **citationQuality:** `Optional` -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, `"fast"` results or no results. +Defaults to `"enabled"`. +Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`. Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments @@ -1511,7 +1483,7 @@ client.embed( An array of image data URIs for the model to embed. Maximum number of images per call is `1`. -The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg` or `image/png` format and has a maximum size of 5MB. +The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and has a maximum size of 5MB. Images are only supported with Embed v3.0 and newer models. @@ -2189,7 +2161,7 @@ Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) client.v2().chatStream( V2ChatStreamRequest .builder() - .model("command-r") + .model("command-a-03-2025") .messages( new ArrayList( Arrays.asList( @@ -2197,7 +2169,7 @@ client.v2().chatStream( UserMessageV2 .builder() .content( - UserMessageV2Content.of("Hello!") + UserMessageV2Content.of("Tell me about LLMs") ) .build() ) @@ -2235,7 +2207,7 @@ Streaming is beneficial for user interfaces that render the contents of the resp
-**model:** `String` — The name of a compatible [Cohere model](https://docs.cohere.com/v2/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/v2/docs/chat-fine-tuning) model. +**model:** `String` — The name of a compatible [Cohere model](https://docs.cohere.com/v2/docs/models).
@@ -2521,7 +2493,7 @@ Streaming is beneficial for user interfaces that render the contents of the resp
-**model:** `String` — The name of a compatible [Cohere model](https://docs.cohere.com/v2/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/v2/docs/chat-fine-tuning) model. +**model:** `String` — The name of a compatible [Cohere model](https://docs.cohere.com/v2/docs/models).
@@ -2803,7 +2775,7 @@ client.v2().embed( An array of image data URIs for the model to embed. Maximum number of images per call is `1`. -The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg` or `image/png` format and has a maximum size of 5MB. +The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and has a maximum size of 5MB. Image embeddings are supported with Embed v3.0 and newer models. @@ -3421,7 +3393,7 @@ client.datasets().create(
-**type:** `DatasetType` — 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`. +**type:** `DatasetType` — The dataset type, which is used to validate the data. The only valid type is `embed-input` used in conjunction with the Embed Jobs API.
@@ -4168,7 +4140,7 @@ client.models().get("command-a-03-2025");
-Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. +Returns a list of models available for use.
diff --git a/src/main/java/com/cohere/api/requests/ChatRequest.java b/src/main/java/com/cohere/api/requests/ChatRequest.java index 487f9c7..0dcbc0d 100644 --- a/src/main/java/com/cohere/api/requests/ChatRequest.java +++ b/src/main/java/com/cohere/api/requests/ChatRequest.java @@ -267,8 +267,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, "fast" results or no results.

+ * @return Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled". *

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments

*/ @JsonProperty("citation_quality") @@ -630,8 +630,8 @@ public interface _FinalStage { _FinalStage documents(List> documents); /** - *

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, "fast" results or no results.

+ *

Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled".

*

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments

*/ _FinalStage citationQuality(Optional citationQuality); @@ -1280,8 +1280,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, "fast" results or no results.

+ *

Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled".

*

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -1292,8 +1292,8 @@ public _FinalStage citationQuality(ChatRequestCitationQuality citationQuality) { } /** - *

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, "fast" results or no results.

+ *

Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled".

*

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments

*/ @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 299342b..292e17a 100644 --- a/src/main/java/com/cohere/api/requests/ChatStreamRequest.java +++ b/src/main/java/com/cohere/api/requests/ChatStreamRequest.java @@ -267,8 +267,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, "fast" results or no results.

+ * @return Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled". *

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments

*/ @JsonProperty("citation_quality") @@ -630,8 +630,8 @@ public interface _FinalStage { _FinalStage documents(List> documents); /** - *

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, "fast" results or no results.

+ *

Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled".

*

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments

*/ _FinalStage citationQuality(Optional citationQuality); @@ -1280,8 +1280,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, "fast" results or no results.

+ *

Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled".

*

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -1292,8 +1292,8 @@ public _FinalStage citationQuality(ChatStreamRequestCitationQuality citationQual } /** - *

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, "fast" results or no results.

+ *

Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled".

*

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments

*/ @java.lang.Override diff --git a/src/main/java/com/cohere/api/requests/EmbedRequest.java b/src/main/java/com/cohere/api/requests/EmbedRequest.java index 25329ed..e8af641 100644 --- a/src/main/java/com/cohere/api/requests/EmbedRequest.java +++ b/src/main/java/com/cohere/api/requests/EmbedRequest.java @@ -65,7 +65,7 @@ public Optional> getTexts() { /** * @return An array of image data URIs for the model to embed. Maximum number of images per call is 1. - *

The image must be a valid data URI. The image must be in either image/jpeg or image/png format and has a maximum size of 5MB.

+ *

The image must be a valid data URI. The image must be in either image/jpeg, image/png, image/webp, or image/gif format and has a maximum size of 5MB.

*

Images are only supported with Embed v3.0 and newer models.

*/ @JsonProperty("images") @@ -190,7 +190,7 @@ public Builder texts(List texts) { /** *

An array of image data URIs for the model to embed. Maximum number of images per call is 1.

- *

The image must be a valid data URI. The image must be in either image/jpeg or image/png format and has a maximum size of 5MB.

+ *

The image must be a valid data URI. The image must be in either image/jpeg, image/png, image/webp, or image/gif format and has a maximum size of 5MB.

*

Images are only supported with Embed v3.0 and newer models.

*/ @JsonSetter(value = "images", nulls = Nulls.SKIP) 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 fda96a8..882a935 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 @@ -88,7 +88,7 @@ public String getName() { } /** - * @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. + * @return The dataset type, which is used to validate the data. The only valid type is embed-input used in conjunction with the Embed Jobs API. */ @JsonProperty("type") public DatasetType getType() { @@ -182,7 +182,7 @@ public interface NameStage { public interface TypeStage { /** - *

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 dataset type, which is used to validate the data. The only valid type is embed-input used in conjunction with the Embed Jobs API.

*/ _FinalStage type(@NotNull DatasetType type); } @@ -286,8 +286,8 @@ public TypeStage name(@NotNull String name) { } /** - *

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 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 dataset type, which is used to validate the data. The only valid type is embed-input used in conjunction with the Embed Jobs API.

+ *

The dataset type, which is used to validate the data. The only valid type is embed-input used in conjunction with the Embed Jobs API.

* @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/models/AsyncModelsClient.java b/src/main/java/com/cohere/api/resources/models/AsyncModelsClient.java index a5ec2e9..135c199 100644 --- a/src/main/java/com/cohere/api/resources/models/AsyncModelsClient.java +++ b/src/main/java/com/cohere/api/resources/models/AsyncModelsClient.java @@ -42,21 +42,21 @@ public CompletableFuture get(String model, RequestOptions requ } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public CompletableFuture list() { return this.rawClient.list().thenApply(response -> response.body()); } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public CompletableFuture list(ModelsListRequest request) { return this.rawClient.list(request).thenApply(response -> response.body()); } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public CompletableFuture list(ModelsListRequest request, RequestOptions requestOptions) { return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); diff --git a/src/main/java/com/cohere/api/resources/models/AsyncRawModelsClient.java b/src/main/java/com/cohere/api/resources/models/AsyncRawModelsClient.java index 0a3801a..1746203 100644 --- a/src/main/java/com/cohere/api/resources/models/AsyncRawModelsClient.java +++ b/src/main/java/com/cohere/api/resources/models/AsyncRawModelsClient.java @@ -169,21 +169,21 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public CompletableFuture> list() { return list(ModelsListRequest.builder().build()); } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public CompletableFuture> list(ModelsListRequest request) { return list(request, null); } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public CompletableFuture> list( ModelsListRequest request, RequestOptions requestOptions) { diff --git a/src/main/java/com/cohere/api/resources/models/ModelsClient.java b/src/main/java/com/cohere/api/resources/models/ModelsClient.java index b73cf49..237e9ff 100644 --- a/src/main/java/com/cohere/api/resources/models/ModelsClient.java +++ b/src/main/java/com/cohere/api/resources/models/ModelsClient.java @@ -41,21 +41,21 @@ public GetModelResponse get(String model, RequestOptions requestOptions) { } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public ListModelsResponse list() { return this.rawClient.list().body(); } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public ListModelsResponse list(ModelsListRequest request) { return this.rawClient.list(request).body(); } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public ListModelsResponse list(ModelsListRequest request, RequestOptions requestOptions) { return this.rawClient.list(request, requestOptions).body(); diff --git a/src/main/java/com/cohere/api/resources/models/RawModelsClient.java b/src/main/java/com/cohere/api/resources/models/RawModelsClient.java index a094ca9..861f471 100644 --- a/src/main/java/com/cohere/api/resources/models/RawModelsClient.java +++ b/src/main/java/com/cohere/api/resources/models/RawModelsClient.java @@ -127,21 +127,21 @@ public CohereHttpResponse get(String model, RequestOptions req } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public CohereHttpResponse list() { return list(ModelsListRequest.builder().build()); } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public CohereHttpResponse list(ModelsListRequest request) { return list(request, null); } /** - * Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models. + * Returns a list of models available for use. */ public CohereHttpResponse list(ModelsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) diff --git a/src/main/java/com/cohere/api/resources/v2/requests/V2ChatRequest.java b/src/main/java/com/cohere/api/resources/v2/requests/V2ChatRequest.java index 1d6b6b8..b00c1bf 100644 --- a/src/main/java/com/cohere/api/resources/v2/requests/V2ChatRequest.java +++ b/src/main/java/com/cohere/api/resources/v2/requests/V2ChatRequest.java @@ -125,7 +125,7 @@ public Boolean getStream() { } /** - * @return The name of a compatible Cohere model or the ID of a fine-tuned model. + * @return The name of a compatible Cohere model. */ @JsonProperty("model") public String getModel() { @@ -352,7 +352,7 @@ public static ModelStage builder() { public interface ModelStage { /** - *

The name of a compatible Cohere model or the ID of a fine-tuned model.

+ *

The name of a compatible Cohere model.

*/ _FinalStage model(@NotNull String model); @@ -569,8 +569,8 @@ public Builder from(V2ChatRequest other) { } /** - *

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.

+ *

The name of a compatible Cohere model.

+ *

The name of a compatible Cohere model.

* @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/v2/requests/V2ChatStreamRequest.java b/src/main/java/com/cohere/api/resources/v2/requests/V2ChatStreamRequest.java index 8bae398..993e8c9 100644 --- a/src/main/java/com/cohere/api/resources/v2/requests/V2ChatStreamRequest.java +++ b/src/main/java/com/cohere/api/resources/v2/requests/V2ChatStreamRequest.java @@ -125,7 +125,7 @@ public Boolean getStream() { } /** - * @return The name of a compatible Cohere model or the ID of a fine-tuned model. + * @return The name of a compatible Cohere model. */ @JsonProperty("model") public String getModel() { @@ -352,7 +352,7 @@ public static ModelStage builder() { public interface ModelStage { /** - *

The name of a compatible Cohere model or the ID of a fine-tuned model.

+ *

The name of a compatible Cohere model.

*/ _FinalStage model(@NotNull String model); @@ -569,8 +569,8 @@ public Builder from(V2ChatStreamRequest other) { } /** - *

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.

+ *

The name of a compatible Cohere model.

+ *

The name of a compatible Cohere model.

* @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/v2/requests/V2EmbedRequest.java b/src/main/java/com/cohere/api/resources/v2/requests/V2EmbedRequest.java index aeb1df6..4b94e90 100644 --- a/src/main/java/com/cohere/api/resources/v2/requests/V2EmbedRequest.java +++ b/src/main/java/com/cohere/api/resources/v2/requests/V2EmbedRequest.java @@ -79,7 +79,7 @@ public Optional> getTexts() { /** * @return An array of image data URIs for the model to embed. Maximum number of images per call is 1. - *

The image must be a valid data URI. The image must be in either image/jpeg or image/png format and has a maximum size of 5MB.

+ *

The image must be a valid data URI. The image must be in either image/jpeg, image/png, image/webp, or image/gif format and has a maximum size of 5MB.

*

Image embeddings are supported with Embed v3.0 and newer models.

*/ @JsonProperty("images") @@ -222,7 +222,7 @@ public interface _FinalStage { /** *

An array of image data URIs for the model to embed. Maximum number of images per call is 1.

- *

The image must be a valid data URI. The image must be in either image/jpeg or image/png format and has a maximum size of 5MB.

+ *

The image must be a valid data URI. The image must be in either image/jpeg, image/png, image/webp, or image/gif format and has a maximum size of 5MB.

*

Image embeddings are supported with Embed v3.0 and newer models.

*/ _FinalStage images(Optional> images); @@ -458,7 +458,7 @@ public _FinalStage inputs(Optional> inputs) { /** *

An array of image data URIs for the model to embed. Maximum number of images per call is 1.

- *

The image must be a valid data URI. The image must be in either image/jpeg or image/png format and has a maximum size of 5MB.

+ *

The image must be a valid data URI. The image must be in either image/jpeg, image/png, image/webp, or image/gif format and has a maximum size of 5MB.

*

Image embeddings are supported with Embed v3.0 and newer models.

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -470,7 +470,7 @@ public _FinalStage images(List images) { /** *

An array of image data URIs for the model to embed. Maximum number of images per call is 1.

- *

The image must be a valid data URI. The image must be in either image/jpeg or image/png format and has a maximum size of 5MB.

+ *

The image must be a valid data URI. The image must be in either image/jpeg, image/png, image/webp, or image/gif format and has a maximum size of 5MB.

*

Image embeddings are supported with Embed v3.0 and newer models.

*/ @java.lang.Override diff --git a/src/main/java/com/cohere/api/types/ApiMeta.java b/src/main/java/com/cohere/api/types/ApiMeta.java index a10d9da..2efc6a9 100644 --- a/src/main/java/com/cohere/api/types/ApiMeta.java +++ b/src/main/java/com/cohere/api/types/ApiMeta.java @@ -27,6 +27,8 @@ public final class ApiMeta { private final Optional tokens; + private final Optional cachedTokens; + private final Optional> warnings; private final Map additionalProperties; @@ -35,11 +37,13 @@ private ApiMeta( Optional apiVersion, Optional billedUnits, Optional tokens, + Optional cachedTokens, Optional> warnings, Map additionalProperties) { this.apiVersion = apiVersion; this.billedUnits = billedUnits; this.tokens = tokens; + this.cachedTokens = cachedTokens; this.warnings = warnings; this.additionalProperties = additionalProperties; } @@ -59,6 +63,14 @@ public Optional getTokens() { return tokens; } + /** + * @return The number of prompt tokens that hit the inference cache. + */ + @JsonProperty("cached_tokens") + public Optional getCachedTokens() { + return cachedTokens; + } + @JsonProperty("warnings") public Optional> getWarnings() { return warnings; @@ -79,12 +91,13 @@ private boolean equalTo(ApiMeta other) { return apiVersion.equals(other.apiVersion) && billedUnits.equals(other.billedUnits) && tokens.equals(other.tokens) + && cachedTokens.equals(other.cachedTokens) && warnings.equals(other.warnings); } @java.lang.Override public int hashCode() { - return Objects.hash(this.apiVersion, this.billedUnits, this.tokens, this.warnings); + return Objects.hash(this.apiVersion, this.billedUnits, this.tokens, this.cachedTokens, this.warnings); } @java.lang.Override @@ -104,6 +117,8 @@ public static final class Builder { private Optional tokens = Optional.empty(); + private Optional cachedTokens = Optional.empty(); + private Optional> warnings = Optional.empty(); @JsonAnySetter @@ -115,6 +130,7 @@ public Builder from(ApiMeta other) { apiVersion(other.getApiVersion()); billedUnits(other.getBilledUnits()); tokens(other.getTokens()); + cachedTokens(other.getCachedTokens()); warnings(other.getWarnings()); return this; } @@ -152,6 +168,20 @@ public Builder tokens(ApiMetaTokens tokens) { return this; } + /** + *

The number of prompt tokens that hit the inference cache.

+ */ + @JsonSetter(value = "cached_tokens", nulls = Nulls.SKIP) + public Builder cachedTokens(Optional cachedTokens) { + this.cachedTokens = cachedTokens; + return this; + } + + public Builder cachedTokens(Double cachedTokens) { + this.cachedTokens = Optional.ofNullable(cachedTokens); + return this; + } + @JsonSetter(value = "warnings", nulls = Nulls.SKIP) public Builder warnings(Optional> warnings) { this.warnings = warnings; @@ -164,7 +194,7 @@ public Builder warnings(List warnings) { } public ApiMeta build() { - return new ApiMeta(apiVersion, billedUnits, tokens, warnings, additionalProperties); + return new ApiMeta(apiVersion, billedUnits, tokens, cachedTokens, warnings, additionalProperties); } } } diff --git a/src/main/java/com/cohere/api/types/ChatRequestCitationQuality.java b/src/main/java/com/cohere/api/types/ChatRequestCitationQuality.java index 214309f..77abb7f 100644 --- a/src/main/java/com/cohere/api/types/ChatRequestCitationQuality.java +++ b/src/main/java/com/cohere/api/types/ChatRequestCitationQuality.java @@ -6,11 +6,15 @@ import com.fasterxml.jackson.annotation.JsonValue; public enum ChatRequestCitationQuality { - FAST("fast"), + ENABLED("ENABLED"), - ACCURATE("accurate"), + DISABLED("DISABLED"), - OFF("off"); + FAST("FAST"), + + ACCURATE("ACCURATE"), + + OFF("OFF"); private final String value; diff --git a/src/main/java/com/cohere/api/types/ChatStreamRequestCitationQuality.java b/src/main/java/com/cohere/api/types/ChatStreamRequestCitationQuality.java index 3fca8b3..7a3c415 100644 --- a/src/main/java/com/cohere/api/types/ChatStreamRequestCitationQuality.java +++ b/src/main/java/com/cohere/api/types/ChatStreamRequestCitationQuality.java @@ -6,11 +6,15 @@ import com.fasterxml.jackson.annotation.JsonValue; public enum ChatStreamRequestCitationQuality { - FAST("fast"), + ENABLED("ENABLED"), - ACCURATE("accurate"), + DISABLED("DISABLED"), - OFF("off"); + FAST("FAST"), + + ACCURATE("ACCURATE"), + + OFF("OFF"); private final String value; diff --git a/src/main/java/com/cohere/api/types/CitationOptions.java b/src/main/java/com/cohere/api/types/CitationOptions.java index f6f2ade..dd7153c 100644 --- a/src/main/java/com/cohere/api/types/CitationOptions.java +++ b/src/main/java/com/cohere/api/types/CitationOptions.java @@ -30,9 +30,8 @@ private CitationOptions(Optional mode, Map } /** - * @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, "fast" results or no results. - *

Note: command-r7b-12-2024 and command-a-03-2025 only support "fast" and "off" modes. The default is "fast".

+ * @return Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled". */ @JsonProperty("mode") public Optional getMode() { @@ -83,9 +82,8 @@ public Builder from(CitationOptions other) { } /** - *

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, "fast" results or no results.

- *

Note: command-r7b-12-2024 and command-a-03-2025 only support "fast" and "off" modes. The default is "fast".

+ *

Defaults to "enabled". + * Citations are enabled by default for models that support it, but can be turned off by setting "type": "disabled".

*/ @JsonSetter(value = "mode", nulls = Nulls.SKIP) public Builder mode(Optional mode) { diff --git a/src/main/java/com/cohere/api/types/CitationOptionsMode.java b/src/main/java/com/cohere/api/types/CitationOptionsMode.java index a07df70..12e8edd 100644 --- a/src/main/java/com/cohere/api/types/CitationOptionsMode.java +++ b/src/main/java/com/cohere/api/types/CitationOptionsMode.java @@ -6,6 +6,10 @@ import com.fasterxml.jackson.annotation.JsonValue; public enum CitationOptionsMode { + ENABLED("ENABLED"), + + DISABLED("DISABLED"), + FAST("FAST"), ACCURATE("ACCURATE"), diff --git a/src/main/java/com/cohere/api/types/DatasetType.java b/src/main/java/com/cohere/api/types/DatasetType.java index a2dc4e7..59c2173 100644 --- a/src/main/java/com/cohere/api/types/DatasetType.java +++ b/src/main/java/com/cohere/api/types/DatasetType.java @@ -20,7 +20,15 @@ public enum DatasetType { CHAT_FINETUNE_INPUT("chat-finetune-input"), - MULTI_LABEL_CLASSIFICATION_FINETUNE_INPUT("multi-label-classification-finetune-input"); + MULTI_LABEL_CLASSIFICATION_FINETUNE_INPUT("multi-label-classification-finetune-input"), + + BATCH_CHAT_INPUT("batch-chat-input"), + + BATCH_OPENAI_CHAT_INPUT("batch-openai-chat-input"), + + BATCH_EMBED_V_2_INPUT("batch-embed-v2-input"), + + BATCH_CHAT_V_2_INPUT("batch-chat-v2-input"); private final String value; diff --git a/src/main/java/com/cohere/api/types/GetModelResponse.java b/src/main/java/com/cohere/api/types/GetModelResponse.java index bd067c6..da79af7 100644 --- a/src/main/java/com/cohere/api/types/GetModelResponse.java +++ b/src/main/java/com/cohere/api/types/GetModelResponse.java @@ -33,8 +33,6 @@ public final class GetModelResponse { private final Optional tokenizerUrl; - private final Optional supportsVision; - private final Optional> defaultEndpoints; private final Optional> features; @@ -48,7 +46,6 @@ private GetModelResponse( Optional finetuned, Optional contextLength, Optional tokenizerUrl, - Optional supportsVision, Optional> defaultEndpoints, Optional> features, Map additionalProperties) { @@ -58,7 +55,6 @@ private GetModelResponse( this.finetuned = finetuned; this.contextLength = contextLength; this.tokenizerUrl = tokenizerUrl; - this.supportsVision = supportsVision; this.defaultEndpoints = defaultEndpoints; this.features = features; this.additionalProperties = additionalProperties; @@ -112,14 +108,6 @@ public Optional getTokenizerUrl() { return tokenizerUrl; } - /** - * @return Whether the model supports image inputs or not. - */ - @JsonProperty("supports_vision") - public Optional getSupportsVision() { - return supportsVision; - } - /** * @return The API endpoints that the model is default to. */ @@ -154,7 +142,6 @@ private boolean equalTo(GetModelResponse other) { && finetuned.equals(other.finetuned) && contextLength.equals(other.contextLength) && tokenizerUrl.equals(other.tokenizerUrl) - && supportsVision.equals(other.supportsVision) && defaultEndpoints.equals(other.defaultEndpoints) && features.equals(other.features); } @@ -168,7 +155,6 @@ public int hashCode() { this.finetuned, this.contextLength, this.tokenizerUrl, - this.supportsVision, this.defaultEndpoints, this.features); } @@ -196,8 +182,6 @@ public static final class Builder { private Optional tokenizerUrl = Optional.empty(); - private Optional supportsVision = Optional.empty(); - private Optional> defaultEndpoints = Optional.empty(); private Optional> features = Optional.empty(); @@ -214,7 +198,6 @@ public Builder from(GetModelResponse other) { finetuned(other.getFinetuned()); contextLength(other.getContextLength()); tokenizerUrl(other.getTokenizerUrl()); - supportsVision(other.getSupportsVision()); defaultEndpoints(other.getDefaultEndpoints()); features(other.getFeatures()); return this; @@ -304,20 +287,6 @@ public Builder tokenizerUrl(String tokenizerUrl) { return this; } - /** - *

Whether the model supports image inputs or not.

- */ - @JsonSetter(value = "supports_vision", nulls = Nulls.SKIP) - public Builder supportsVision(Optional supportsVision) { - this.supportsVision = supportsVision; - return this; - } - - public Builder supportsVision(Boolean supportsVision) { - this.supportsVision = Optional.ofNullable(supportsVision); - return this; - } - /** *

The API endpoints that the model is default to.

*/ @@ -354,7 +323,6 @@ public GetModelResponse build() { finetuned, contextLength, tokenizerUrl, - supportsVision, defaultEndpoints, features, additionalProperties); diff --git a/src/main/java/com/cohere/api/types/Usage.java b/src/main/java/com/cohere/api/types/Usage.java index 331d08b..bf55f5e 100644 --- a/src/main/java/com/cohere/api/types/Usage.java +++ b/src/main/java/com/cohere/api/types/Usage.java @@ -20,29 +20,21 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = Usage.Builder.class) public final class Usage { - private final Optional billedUnits; - - private final Optional tokens; + private final Optional cachedTokens; private final Map additionalProperties; - private Usage( - Optional billedUnits, - Optional tokens, - Map additionalProperties) { - this.billedUnits = billedUnits; - this.tokens = tokens; + private Usage(Optional cachedTokens, Map additionalProperties) { + this.cachedTokens = cachedTokens; this.additionalProperties = additionalProperties; } - @JsonProperty("billed_units") - public Optional getBilledUnits() { - return billedUnits; - } - - @JsonProperty("tokens") - public Optional getTokens() { - return tokens; + /** + * @return The number of prompt tokens that hit the inference cache. + */ + @JsonProperty("cached_tokens") + public Optional getCachedTokens() { + return cachedTokens; } @java.lang.Override @@ -57,12 +49,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(Usage other) { - return billedUnits.equals(other.billedUnits) && tokens.equals(other.tokens); + return cachedTokens.equals(other.cachedTokens); } @java.lang.Override public int hashCode() { - return Objects.hash(this.billedUnits, this.tokens); + return Objects.hash(this.cachedTokens); } @java.lang.Override @@ -76,9 +68,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional billedUnits = Optional.empty(); - - private Optional tokens = Optional.empty(); + private Optional cachedTokens = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -86,35 +76,26 @@ public static final class Builder { private Builder() {} public Builder from(Usage other) { - billedUnits(other.getBilledUnits()); - tokens(other.getTokens()); - return this; - } - - @JsonSetter(value = "billed_units", nulls = Nulls.SKIP) - public Builder billedUnits(Optional billedUnits) { - this.billedUnits = billedUnits; - return this; - } - - public Builder billedUnits(UsageBilledUnits billedUnits) { - this.billedUnits = Optional.ofNullable(billedUnits); + cachedTokens(other.getCachedTokens()); return this; } - @JsonSetter(value = "tokens", nulls = Nulls.SKIP) - public Builder tokens(Optional tokens) { - this.tokens = tokens; + /** + *

The number of prompt tokens that hit the inference cache.

+ */ + @JsonSetter(value = "cached_tokens", nulls = Nulls.SKIP) + public Builder cachedTokens(Optional cachedTokens) { + this.cachedTokens = cachedTokens; return this; } - public Builder tokens(UsageTokens tokens) { - this.tokens = Optional.ofNullable(tokens); + public Builder cachedTokens(Double cachedTokens) { + this.cachedTokens = Optional.ofNullable(cachedTokens); return this; } public Usage build() { - return new Usage(billedUnits, tokens, additionalProperties); + return new Usage(cachedTokens, additionalProperties); } } }