Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ java {

group = 'com.cohere'

version = '1.8.2'
version = '1.8.0'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand Down Expand Up @@ -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'
Expand Down
60 changes: 16 additions & 44 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
```
Expand Down Expand Up @@ -223,9 +224,8 @@ Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private D

**citationQuality:** `Optional<ChatStreamRequestCitationQuality>`

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

Expand Down Expand Up @@ -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<Message>(
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<ChatConnector>(
Arrays.asList(
ChatConnector
.builder()
.id("web-search")
.build()
)
)
)
.model("command-a-03-2025")
.build()
);
```
Expand Down Expand Up @@ -707,9 +680,8 @@ Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private D

**citationQuality:** `Optional<ChatRequestCitationQuality>`

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

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -2189,15 +2161,15 @@ 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<ChatMessageV2>(
Arrays.asList(
ChatMessageV2.user(
UserMessageV2
.builder()
.content(
UserMessageV2Content.of("Hello!")
UserMessageV2Content.of("Tell me about LLMs")
)
.build()
)
Expand Down Expand Up @@ -2235,7 +2207,7 @@ Streaming is beneficial for user interfaces that render the contents of the resp
<dl>
<dd>

**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).

</dd>
</dl>
Expand Down Expand Up @@ -2521,7 +2493,7 @@ Streaming is beneficial for user interfaces that render the contents of the resp
<dl>
<dd>

**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).

</dd>
</dl>
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -3421,7 +3393,7 @@ client.datasets().create(
<dl>
<dd>

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

</dd>
</dl>
Expand Down Expand Up @@ -4168,7 +4140,7 @@ client.models().get("command-a-03-2025");
<dl>
<dd>

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.
</dd>
</dl>
</dd>
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/cohere/api/requests/ChatRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ public Optional<List<Map<String, String>>> getDocuments() {
}

/**
* @return Defaults to <code>&quot;accurate&quot;</code>.
* <p>Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want <code>&quot;accurate&quot;</code> results, <code>&quot;fast&quot;</code> results or no results.</p>
* @return Defaults to <code>&quot;enabled&quot;</code>.
* Citations are enabled by default for models that support it, but can be turned off by setting <code>&quot;type&quot;: &quot;disabled&quot;</code>.
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
@JsonProperty("citation_quality")
Expand Down Expand Up @@ -630,8 +630,8 @@ public interface _FinalStage {
_FinalStage documents(List<Map<String, String>> documents);

/**
* <p>Defaults to <code>&quot;accurate&quot;</code>.</p>
* <p>Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want <code>&quot;accurate&quot;</code> results, <code>&quot;fast&quot;</code> results or no results.</p>
* <p>Defaults to <code>&quot;enabled&quot;</code>.
* Citations are enabled by default for models that support it, but can be turned off by setting <code>&quot;type&quot;: &quot;disabled&quot;</code>.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
_FinalStage citationQuality(Optional<ChatRequestCitationQuality> citationQuality);
Expand Down Expand Up @@ -1280,8 +1280,8 @@ public _FinalStage temperature(Optional<Float> temperature) {
}

/**
* <p>Defaults to <code>&quot;accurate&quot;</code>.</p>
* <p>Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want <code>&quot;accurate&quot;</code> results, <code>&quot;fast&quot;</code> results or no results.</p>
* <p>Defaults to <code>&quot;enabled&quot;</code>.
* Citations are enabled by default for models that support it, but can be turned off by setting <code>&quot;type&quot;: &quot;disabled&quot;</code>.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
Expand All @@ -1292,8 +1292,8 @@ public _FinalStage citationQuality(ChatRequestCitationQuality citationQuality) {
}

/**
* <p>Defaults to <code>&quot;accurate&quot;</code>.</p>
* <p>Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want <code>&quot;accurate&quot;</code> results, <code>&quot;fast&quot;</code> results or no results.</p>
* <p>Defaults to <code>&quot;enabled&quot;</code>.
* Citations are enabled by default for models that support it, but can be turned off by setting <code>&quot;type&quot;: &quot;disabled&quot;</code>.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
@java.lang.Override
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/cohere/api/requests/ChatStreamRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ public Optional<List<Map<String, String>>> getDocuments() {
}

/**
* @return Defaults to <code>&quot;accurate&quot;</code>.
* <p>Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want <code>&quot;accurate&quot;</code> results, <code>&quot;fast&quot;</code> results or no results.</p>
* @return Defaults to <code>&quot;enabled&quot;</code>.
* Citations are enabled by default for models that support it, but can be turned off by setting <code>&quot;type&quot;: &quot;disabled&quot;</code>.
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
@JsonProperty("citation_quality")
Expand Down Expand Up @@ -630,8 +630,8 @@ public interface _FinalStage {
_FinalStage documents(List<Map<String, String>> documents);

/**
* <p>Defaults to <code>&quot;accurate&quot;</code>.</p>
* <p>Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want <code>&quot;accurate&quot;</code> results, <code>&quot;fast&quot;</code> results or no results.</p>
* <p>Defaults to <code>&quot;enabled&quot;</code>.
* Citations are enabled by default for models that support it, but can be turned off by setting <code>&quot;type&quot;: &quot;disabled&quot;</code>.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
_FinalStage citationQuality(Optional<ChatStreamRequestCitationQuality> citationQuality);
Expand Down Expand Up @@ -1280,8 +1280,8 @@ public _FinalStage temperature(Optional<Float> temperature) {
}

/**
* <p>Defaults to <code>&quot;accurate&quot;</code>.</p>
* <p>Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want <code>&quot;accurate&quot;</code> results, <code>&quot;fast&quot;</code> results or no results.</p>
* <p>Defaults to <code>&quot;enabled&quot;</code>.
* Citations are enabled by default for models that support it, but can be turned off by setting <code>&quot;type&quot;: &quot;disabled&quot;</code>.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
Expand All @@ -1292,8 +1292,8 @@ public _FinalStage citationQuality(ChatStreamRequestCitationQuality citationQual
}

/**
* <p>Defaults to <code>&quot;accurate&quot;</code>.</p>
* <p>Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want <code>&quot;accurate&quot;</code> results, <code>&quot;fast&quot;</code> results or no results.</p>
* <p>Defaults to <code>&quot;enabled&quot;</code>.
* Citations are enabled by default for models that support it, but can be turned off by setting <code>&quot;type&quot;: &quot;disabled&quot;</code>.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
@java.lang.Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/cohere/api/requests/EmbedRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Optional<List<String>> getTexts() {

/**
* @return An array of image data URIs for the model to embed. Maximum number of images per call is <code>1</code>.
* <p>The image must be a valid <a href="https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data">data URI</a>. The image must be in either <code>image/jpeg</code> or <code>image/png</code> format and has a maximum size of 5MB.</p>
* <p>The image must be a valid <a href="https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data">data URI</a>. The image must be in either <code>image/jpeg</code>, <code>image/png</code>, <code>image/webp</code>, or <code>image/gif</code> format and has a maximum size of 5MB.</p>
* <p>Images are only supported with Embed v3.0 and newer models.</p>
*/
@JsonProperty("images")
Expand Down Expand Up @@ -190,7 +190,7 @@ public Builder texts(List<String> texts) {

/**
* <p>An array of image data URIs for the model to embed. Maximum number of images per call is <code>1</code>.</p>
* <p>The image must be a valid <a href="https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data">data URI</a>. The image must be in either <code>image/jpeg</code> or <code>image/png</code> format and has a maximum size of 5MB.</p>
* <p>The image must be a valid <a href="https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data">data URI</a>. The image must be in either <code>image/jpeg</code>, <code>image/png</code>, <code>image/webp</code>, or <code>image/gif</code> format and has a maximum size of 5MB.</p>
* <p>Images are only supported with Embed v3.0 and newer models.</p>
*/
@JsonSetter(value = "images", nulls = Nulls.SKIP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public String getName() {
}

/**
* @return The dataset type, which is used to validate the data. Valid types are <code>embed-input</code>, <code>reranker-finetune-input</code>, <code>single-label-classification-finetune-input</code>, <code>chat-finetune-input</code>, and <code>multi-label-classification-finetune-input</code>.
* @return The dataset type, which is used to validate the data. The only valid type is <code>embed-input</code> used in conjunction with the Embed Jobs API.
*/
@JsonProperty("type")
public DatasetType getType() {
Expand Down Expand Up @@ -182,7 +182,7 @@ public interface NameStage {

public interface TypeStage {
/**
* <p>The dataset type, which is used to validate the data. Valid types are <code>embed-input</code>, <code>reranker-finetune-input</code>, <code>single-label-classification-finetune-input</code>, <code>chat-finetune-input</code>, and <code>multi-label-classification-finetune-input</code>.</p>
* <p>The dataset type, which is used to validate the data. The only valid type is <code>embed-input</code> used in conjunction with the Embed Jobs API.</p>
*/
_FinalStage type(@NotNull DatasetType type);
}
Expand Down Expand Up @@ -286,8 +286,8 @@ public TypeStage name(@NotNull String name) {
}

/**
* <p>The dataset type, which is used to validate the data. Valid types are <code>embed-input</code>, <code>reranker-finetune-input</code>, <code>single-label-classification-finetune-input</code>, <code>chat-finetune-input</code>, and <code>multi-label-classification-finetune-input</code>.</p>
* <p>The dataset type, which is used to validate the data. Valid types are <code>embed-input</code>, <code>reranker-finetune-input</code>, <code>single-label-classification-finetune-input</code>, <code>chat-finetune-input</code>, and <code>multi-label-classification-finetune-input</code>.</p>
* <p>The dataset type, which is used to validate the data. The only valid type is <code>embed-input</code> used in conjunction with the Embed Jobs API.</p>
* <p>The dataset type, which is used to validate the data. The only valid type is <code>embed-input</code> used in conjunction with the Embed Jobs API.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ public CompletableFuture<GetModelResponse> 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<ListModelsResponse> 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<ListModelsResponse> 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<ListModelsResponse> list(ModelsListRequest request, RequestOptions requestOptions) {
return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<CohereHttpResponse<ListModelsResponse>> 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<CohereHttpResponse<ListModelsResponse>> 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<CohereHttpResponse<ListModelsResponse>> list(
ModelsListRequest request, RequestOptions requestOptions) {
Expand Down
Loading