diff --git a/LICENSE b/LICENSE index b38bfd7..deac3e7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Cohere. +Copyright (c) 2026 Cohere. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build.gradle b/build.gradle index eb378aa..a5930be 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ java { group = 'com.cohere' -version = '1.9.3' +version = '1.9.4' jar { dependsOn(":generatePomFileForMavenPublication") @@ -78,7 +78,7 @@ publishing { maven(MavenPublication) { groupId = 'com.cohere' artifactId = 'cohere-java' - version = '1.9.3' + version = '1.9.4' from components.java pom { name = 'cohere' diff --git a/reference.md b/reference.md index 578cd07..0d8333a 100644 --- a/reference.md +++ b/reference.md @@ -1,5 +1,5 @@ # Reference -
client.chatStream(request) -> Optional<StreamedChatResponse> +
client.chatStream(request) -> Optional&lt;StreamedChatResponse&gt;
@@ -912,7 +912,7 @@ Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private D
-
client.generateStream(request) -> Optional<GenerateStreamedResponse> +
client.generateStream(request) -> Optional&lt;GenerateStreamedResponse&gt;
@@ -1584,7 +1584,7 @@ client.rerank( ) .query("What is the capital of the United States?") .topN(3) - .model("rerank-v3.5") + .model("rerank-v4.0-pro") .build() ); ``` @@ -2123,7 +2123,7 @@ client.checkApiKey();
## V2 -
client.v2.chatStream(request) -> Optional<V2ChatStreamResponse> +
client.v2.chatStream(request) -> Optional&lt;V2ChatStreamResponse&gt;
@@ -2403,10 +2403,7 @@ If tool_choice isn't specified, then the model is free to choose whether to use
-**priority:** `Optional` - -The priority of the request (lower means earlier handling; default 0 highest priority). -Higher priority requests are handled first, and dropped last when the system is under load. +**priority:** `Optional` — Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.
@@ -2698,10 +2695,7 @@ If tool_choice isn't specified, then the model is free to choose whether to use
-**priority:** `Optional` - -The priority of the request (lower means earlier handling; default 0 highest priority). -Higher priority requests are handled first, and dropped last when the system is under load. +**priority:** `Optional` — Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.
@@ -2871,10 +2865,7 @@ If `NONE` is selected, when the input exceeds the maximum input token length an
-**priority:** `Optional` - -The priority of the request (lower means earlier handling; default 0 highest priority). -Higher priority requests are handled first, and dropped last when the system is under load. +**priority:** `Optional` — Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.
@@ -2920,7 +2911,7 @@ client.v2().rerank( Arrays.asList("Carson City is the capital city of the American state of Nevada.", "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", "Capital punishment has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.") ) .query("What is the capital of the United States?") - .model("rerank-v3.5") + .model("rerank-v4.0-pro") .topN(3) .build() ); @@ -2985,10 +2976,7 @@ For optimal performance we recommend against sending more than 1,000 documents i
-**priority:** `Optional` - -The priority of the request (lower means earlier handling; default 0 highest priority). -Higher priority requests are handled first, and dropped last when the system is under load. +**priority:** `Optional` — Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.
@@ -3204,7 +3192,7 @@ client.batches().retrieve("id");
-
client.batches.cancel(id) -> Map<String, Object> +
client.batches.cancel(id) -> Map&lt;String, Object&gt;
@@ -3846,7 +3834,7 @@ client.datasets().get("id");
-
client.datasets.delete(id) -> Map<String, Object> +
client.datasets.delete(id) -> Map&lt;String, Object&gt;
@@ -4139,7 +4127,7 @@ client.connectors().get("id");
-
client.connectors.delete(id) -> Map<String, Object> +
client.connectors.delete(id) -> Map&lt;String, Object&gt;
@@ -4733,7 +4721,7 @@ client.finetuning().getFinetunedModel("id");
-
client.finetuning.deleteFinetunedModel(id) -> Map<String, Object> +
client.finetuning.deleteFinetunedModel(id) -> Map&lt;String, Object&gt;
diff --git a/src/main/java/com/cohere/api/core/ClientOptions.java b/src/main/java/com/cohere/api/core/ClientOptions.java index 1333deb..7dcfc7e 100644 --- a/src/main/java/com/cohere/api/core/ClientOptions.java +++ b/src/main/java/com/cohere/api/core/ClientOptions.java @@ -35,10 +35,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.cohere:cohere-java/1.9.3"); + put("User-Agent", "com.cohere:cohere-java/1.7.1"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.cohere.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.9.3"); + put("X-Fern-SDK-Version", "1.7.1"); } }); this.headerSuppliers = headerSuppliers; 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 a458783..c8f1b72 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 @@ -289,8 +289,7 @@ public Optional getThinking() { } /** - * @return The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load. + * @return Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped. */ @JsonProperty("priority") public Optional getPriority() { @@ -514,8 +513,7 @@ public interface _FinalStage { _FinalStage thinking(Thinking thinking); /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

*/ _FinalStage priority(Optional priority); @@ -607,8 +605,7 @@ public _FinalStage model(@NotNull String model) { } /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -618,8 +615,7 @@ public _FinalStage priority(Integer priority) { } /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

*/ @java.lang.Override @JsonSetter(value = "priority", nulls = Nulls.SKIP) 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 9274dfc..b5f2a2d 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 @@ -289,8 +289,7 @@ public Optional getThinking() { } /** - * @return The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load. + * @return Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped. */ @JsonProperty("priority") public Optional getPriority() { @@ -514,8 +513,7 @@ public interface _FinalStage { _FinalStage thinking(Thinking thinking); /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

*/ _FinalStage priority(Optional priority); @@ -607,8 +605,7 @@ public _FinalStage model(@NotNull String model) { } /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -618,8 +615,7 @@ public _FinalStage priority(Integer priority) { } /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

*/ @java.lang.Override @JsonSetter(value = "priority", nulls = Nulls.SKIP) 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 d7cf1a7..b18d6e9 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 @@ -156,8 +156,7 @@ public Optional getTruncate() { } /** - * @return The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load. + * @return Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped. */ @JsonProperty("priority") public Optional getPriority() { @@ -291,8 +290,7 @@ public interface _FinalStage { _FinalStage truncate(V2EmbedRequestTruncate truncate); /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

*/ _FinalStage priority(Optional priority); @@ -361,8 +359,7 @@ public _FinalStage inputType(@NotNull EmbedInputType inputType) { } /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -372,8 +369,7 @@ public _FinalStage priority(Integer priority) { } /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

*/ @java.lang.Override @JsonSetter(value = "priority", nulls = Nulls.SKIP) diff --git a/src/main/java/com/cohere/api/resources/v2/requests/V2RerankRequest.java b/src/main/java/com/cohere/api/resources/v2/requests/V2RerankRequest.java index 0b7a969..3c06e0a 100644 --- a/src/main/java/com/cohere/api/resources/v2/requests/V2RerankRequest.java +++ b/src/main/java/com/cohere/api/resources/v2/requests/V2RerankRequest.java @@ -98,8 +98,7 @@ public Optional getMaxTokensPerDoc() { } /** - * @return The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load. + * @return Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped. */ @JsonProperty("priority") public Optional getPriority() { @@ -186,8 +185,7 @@ public interface _FinalStage { _FinalStage maxTokensPerDoc(Integer maxTokensPerDoc); /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

*/ _FinalStage priority(Optional priority); @@ -249,8 +247,7 @@ public _FinalStage query(@NotNull String query) { } /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -260,8 +257,7 @@ public _FinalStage priority(Integer priority) { } /** - *

The priority of the request (lower means earlier handling; default 0 highest priority). - * Higher priority requests are handled first, and dropped last when the system is under load.

+ *

Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped.

*/ @java.lang.Override @JsonSetter(value = "priority", nulls = Nulls.SKIP) diff --git a/src/main/java/com/cohere/api/types/ApiMetaBilledUnits.java b/src/main/java/com/cohere/api/types/ApiMetaBilledUnits.java index 72f11eb..225f20d 100644 --- a/src/main/java/com/cohere/api/types/ApiMetaBilledUnits.java +++ b/src/main/java/com/cohere/api/types/ApiMetaBilledUnits.java @@ -24,6 +24,8 @@ public final class ApiMetaBilledUnits { private final Optional inputTokens; + private final Optional imageTokens; + private final Optional outputTokens; private final Optional searchUnits; @@ -35,12 +37,14 @@ public final class ApiMetaBilledUnits { private ApiMetaBilledUnits( Optional images, Optional inputTokens, + Optional imageTokens, Optional outputTokens, Optional searchUnits, Optional classifications, Map additionalProperties) { this.images = images; this.inputTokens = inputTokens; + this.imageTokens = imageTokens; this.outputTokens = outputTokens; this.searchUnits = searchUnits; this.classifications = classifications; @@ -63,6 +67,14 @@ public Optional getInputTokens() { return inputTokens; } + /** + * @return The number of billed image tokens. + */ + @JsonProperty("image_tokens") + public Optional getImageTokens() { + return imageTokens; + } + /** * @return The number of billed output tokens. */ @@ -101,6 +113,7 @@ public Map getAdditionalProperties() { private boolean equalTo(ApiMetaBilledUnits other) { return images.equals(other.images) && inputTokens.equals(other.inputTokens) + && imageTokens.equals(other.imageTokens) && outputTokens.equals(other.outputTokens) && searchUnits.equals(other.searchUnits) && classifications.equals(other.classifications); @@ -108,7 +121,13 @@ private boolean equalTo(ApiMetaBilledUnits other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.images, this.inputTokens, this.outputTokens, this.searchUnits, this.classifications); + return Objects.hash( + this.images, + this.inputTokens, + this.imageTokens, + this.outputTokens, + this.searchUnits, + this.classifications); } @java.lang.Override @@ -126,6 +145,8 @@ public static final class Builder { private Optional inputTokens = Optional.empty(); + private Optional imageTokens = Optional.empty(); + private Optional outputTokens = Optional.empty(); private Optional searchUnits = Optional.empty(); @@ -140,6 +161,7 @@ private Builder() {} public Builder from(ApiMetaBilledUnits other) { images(other.getImages()); inputTokens(other.getInputTokens()); + imageTokens(other.getImageTokens()); outputTokens(other.getOutputTokens()); searchUnits(other.getSearchUnits()); classifications(other.getClassifications()); @@ -174,6 +196,20 @@ public Builder inputTokens(Double inputTokens) { return this; } + /** + *

The number of billed image tokens.

+ */ + @JsonSetter(value = "image_tokens", nulls = Nulls.SKIP) + public Builder imageTokens(Optional imageTokens) { + this.imageTokens = imageTokens; + return this; + } + + public Builder imageTokens(Double imageTokens) { + this.imageTokens = Optional.ofNullable(imageTokens); + return this; + } + /** *

The number of billed output tokens.

*/ @@ -218,7 +254,7 @@ public Builder classifications(Double classifications) { public ApiMetaBilledUnits build() { return new ApiMetaBilledUnits( - images, inputTokens, outputTokens, searchUnits, classifications, additionalProperties); + images, inputTokens, imageTokens, outputTokens, searchUnits, classifications, additionalProperties); } } }