Skip to content
Merged
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.0'
version = '1.8.1'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand Down Expand Up @@ -77,7 +77,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.cohere'
artifactId = 'cohere-java'
version = '1.8.0'
version = '1.8.1'
from components.java
pom {
name = 'cohere'
Expand Down
52 changes: 52 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ client.chatStream(
<dl>
<dd>

**rawPrompting:** `Optional<Boolean>`

When enabled, the user's prompt will be sent to the model without
any pre-processing.

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

</dd>
</dl>

<dl>
<dd>

**message:** `String`

Text input for the model to respond to.
Expand Down Expand Up @@ -528,6 +541,19 @@ client.chatStream(
<dl>
<dd>

**rawPrompting:** `Optional<Boolean>`

When enabled, the user's prompt will be sent to the model without
any pre-processing.

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

</dd>
</dl>

<dl>
<dd>

**message:** `String`

Text input for the model to respond to.
Expand Down Expand Up @@ -2265,6 +2291,19 @@ When set to `true`, tool calls in the Assistant message will be forced to follow
<dl>
<dd>

**rawPrompting:** `Optional<Boolean>`

When enabled, the user's prompt will be sent to the model without
any pre-processing.

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

</dd>
</dl>

<dl>
<dd>

**responseFormat:** `Optional<ResponseFormatV2>`

</dd>
Expand Down Expand Up @@ -2543,6 +2582,19 @@ When set to `true`, tool calls in the Assistant message will be forced to follow
<dl>
<dd>

**rawPrompting:** `Optional<Boolean>`

When enabled, the user's prompt will be sent to the model without
any pre-processing.

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

</dd>
</dl>

<dl>
<dd>

**responseFormat:** `Optional<ResponseFormatV2>`

</dd>
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/cohere/api/AsyncRawCohere.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public CompletableFuture<CohereHttpResponse<Iterable<StreamedChatResponse>>> cha
.addPathSegments("v1/chat")
.build();
Map<String, Object> properties = new HashMap<>();
if (request.getRawPrompting().isPresent()) {
properties.put("raw_prompting", request.getRawPrompting());
}
properties.put("message", request.getMessage());
if (request.getModel().isPresent()) {
properties.put("model", request.getModel());
Expand Down Expand Up @@ -296,6 +299,9 @@ public CompletableFuture<CohereHttpResponse<NonStreamedChatResponse>> chat(
.addPathSegments("v1/chat")
.build();
Map<String, Object> properties = new HashMap<>();
if (request.getRawPrompting().isPresent()) {
properties.put("raw_prompting", request.getRawPrompting());
}
properties.put("message", request.getMessage());
if (request.getModel().isPresent()) {
properties.put("model", request.getModel());
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/cohere/api/RawCohere.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public CohereHttpResponse<Iterable<StreamedChatResponse>> chatStream(
.addPathSegments("v1/chat")
.build();
Map<String, Object> properties = new HashMap<>();
if (request.getRawPrompting().isPresent()) {
properties.put("raw_prompting", request.getRawPrompting());
}
properties.put("message", request.getMessage());
if (request.getModel().isPresent()) {
properties.put("model", request.getModel());
Expand Down Expand Up @@ -253,6 +256,9 @@ public CohereHttpResponse<NonStreamedChatResponse> chat(ChatRequest request, Req
.addPathSegments("v1/chat")
.build();
Map<String, Object> properties = new HashMap<>();
if (request.getRawPrompting().isPresent()) {
properties.put("raw_prompting", request.getRawPrompting());
}
properties.put("message", request.getMessage());
if (request.getModel().isPresent()) {
properties.put("model", request.getModel());
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/cohere/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap<String, String>() {
{
put("User-Agent", "com.cohere:cohere-java/1.8.0");
put("User-Agent", "com.cohere:cohere-java/1.8.1");
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.cohere.fern:api-sdk");
put("X-Fern-SDK-Version", "1.8.0");
put("X-Fern-SDK-Version", "1.8.1");
}
});
this.headerSuppliers = headerSuppliers;
Expand Down
53 changes: 53 additions & 0 deletions src/main/java/com/cohere/api/requests/ChatRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
public final class ChatRequest {
private final Optional<String> accepts;

private final Optional<Boolean> rawPrompting;

private final String message;

private final Optional<String> model;
Expand Down Expand Up @@ -84,6 +86,7 @@ public final class ChatRequest {

private ChatRequest(
Optional<String> accepts,
Optional<Boolean> rawPrompting,
String message,
Optional<String> model,
Optional<String> preamble,
Expand All @@ -110,6 +113,7 @@ private ChatRequest(
Optional<ChatRequestSafetyMode> safetyMode,
Map<String, Object> additionalProperties) {
this.accepts = accepts;
this.rawPrompting = rawPrompting;
this.message = message;
this.model = model;
this.preamble = preamble;
Expand Down Expand Up @@ -145,6 +149,16 @@ public Optional<String> getAccepts() {
return accepts;
}

/**
* @return When enabled, the user's prompt will be sent to the model without
* any pre-processing.
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
@JsonProperty("raw_prompting")
public Optional<Boolean> getRawPrompting() {
return rawPrompting;
}

/**
* @return Text input for the model to respond to.
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
Expand Down Expand Up @@ -439,6 +453,7 @@ public Map<String, Object> getAdditionalProperties() {

private boolean equalTo(ChatRequest other) {
return accepts.equals(other.accepts)
&& rawPrompting.equals(other.rawPrompting)
&& message.equals(other.message)
&& model.equals(other.model)
&& preamble.equals(other.preamble)
Expand Down Expand Up @@ -469,6 +484,7 @@ private boolean equalTo(ChatRequest other) {
public int hashCode() {
return Objects.hash(
this.accepts,
this.rawPrompting,
this.message,
this.model,
this.preamble,
Expand Down Expand Up @@ -524,6 +540,15 @@ public interface _FinalStage {

_FinalStage accepts(String accepts);

/**
* <p>When enabled, the user's prompt will be sent to the model without
* any pre-processing.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
_FinalStage rawPrompting(Optional<Boolean> rawPrompting);

_FinalStage rawPrompting(Boolean rawPrompting);

/**
* <p>The name of a compatible <a href="https://docs.cohere.com/docs/models">Cohere model</a> or the ID of a <a href="https://docs.cohere.com/docs/chat-fine-tuning">fine-tuned</a> model.</p>
* <p>Compatible Deployments: Cohere Platform, Private Deployments</p>
Expand Down Expand Up @@ -813,6 +838,8 @@ public static final class Builder implements MessageStage, _FinalStage {

private Optional<String> model = Optional.empty();

private Optional<Boolean> rawPrompting = Optional.empty();

private Optional<String> accepts = Optional.empty();

@JsonAnySetter
Expand All @@ -823,6 +850,7 @@ private Builder() {}
@java.lang.Override
public Builder from(ChatRequest other) {
accepts(other.getAccepts());
rawPrompting(other.getRawPrompting());
message(other.getMessage());
model(other.getModel());
preamble(other.getPreamble());
Expand Down Expand Up @@ -1477,6 +1505,30 @@ public _FinalStage model(Optional<String> model) {
return this;
}

/**
* <p>When enabled, the user's prompt will be sent to the model without
* any pre-processing.</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.
*/
@java.lang.Override
public _FinalStage rawPrompting(Boolean rawPrompting) {
this.rawPrompting = Optional.ofNullable(rawPrompting);
return this;
}

/**
* <p>When enabled, the user's prompt will be sent to the model without
* any pre-processing.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
@java.lang.Override
@JsonSetter(value = "raw_prompting", nulls = Nulls.SKIP)
public _FinalStage rawPrompting(Optional<Boolean> rawPrompting) {
this.rawPrompting = rawPrompting;
return this;
}

/**
* <p>Pass text/event-stream to receive the streamed response as server-sent events. The default is <code>\n</code> delimited events.</p>
* @return Reference to {@code this} so that method calls can be chained together.
Expand All @@ -1501,6 +1553,7 @@ public _FinalStage accepts(Optional<String> accepts) {
public ChatRequest build() {
return new ChatRequest(
accepts,
rawPrompting,
message,
model,
preamble,
Expand Down
Loading