Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Nov 28, 2024
1 parent 636243c commit 0db4cdc
Show file tree
Hide file tree
Showing 10 changed files with 234 additions and 210 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.cohere'
artifactId = 'cohere-java'
version = '1.4.1'
version = '1.5.0'
from components.java
pom {
name = 'cohere'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cohere/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private ClientOptions(
{
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.cohere.fern:api-sdk");
put("X-Fern-SDK-Version", "1.4.1");
put("X-Fern-SDK-Version", "1.5.0");
}
});
this.headerSuppliers = headerSuppliers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public Optional<OffsetDateTime> getCompletedAt() {
}

/**
* @return read-only. Timestamp for the latest request to this fine-tuned model.
* @return read-only. Deprecated: Timestamp for the latest request to this fine-tuned model.
*/
@JsonProperty("last_used")
public Optional<OffsetDateTime> getLastUsed() {
Expand Down Expand Up @@ -307,7 +307,7 @@ public _FinalStage settings(Settings settings) {
}

/**
* <p>read-only. Timestamp for the latest request to this fine-tuned model.</p>
* <p>read-only. Deprecated: Timestamp for the latest request to this fine-tuned model.</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 @@ -131,7 +131,7 @@ public Optional<OffsetDateTime> getCompletedAt() {
}

/**
* @return Timestamp for the latest request to this fine-tuned model.
* @return Deprecated: Timestamp for the latest request to this fine-tuned model.
*/
@JsonProperty("last_used")
public Optional<OffsetDateTime> getLastUsed() {
Expand Down Expand Up @@ -289,7 +289,7 @@ public _FinalStage settings(Settings settings) {
}

/**
* <p>Timestamp for the latest request to this fine-tuned model.</p>
* <p>Deprecated: Timestamp for the latest request to this fine-tuned model.</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 @@ -34,6 +34,8 @@ public final class V2ChatRequest {

private final Optional<List<ToolV2>> tools;

private final Optional<Boolean> strictTools;

private final Optional<List<V2ChatRequestDocumentsItem>> documents;

private final Optional<CitationOptions> citationOptions;
Expand Down Expand Up @@ -68,6 +70,7 @@ private V2ChatRequest(
String model,
List<ChatMessageV2> messages,
Optional<List<ToolV2>> tools,
Optional<Boolean> strictTools,
Optional<List<V2ChatRequestDocumentsItem>> documents,
Optional<CitationOptions> citationOptions,
Optional<ResponseFormatV2> responseFormat,
Expand All @@ -86,6 +89,7 @@ private V2ChatRequest(
this.model = model;
this.messages = messages;
this.tools = tools;
this.strictTools = strictTools;
this.documents = documents;
this.citationOptions = citationOptions;
this.responseFormat = responseFormat;
Expand All @@ -103,6 +107,17 @@ private V2ChatRequest(
this.additionalProperties = additionalProperties;
}

/**
* @return Defaults to <code>false</code>.
* <p>When <code>true</code>, the response will be a SSE stream of events. The final event will contain the complete response, and will have an <code>event_type</code> of <code>&quot;stream-end&quot;</code>.</p>
* <p>Streaming is beneficial for user interfaces that render the contents of the response piece by piece, as it gets generated.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
@JsonProperty("stream")
public Boolean getStream() {
return false;
}

/**
* @return The name of a compatible <a href="https://docs.cohere.com/v2/docs/models">Cohere model</a> (such as command-r or command-r-plus) or the ID of a <a href="https://docs.cohere.com/v2/docs/chat-fine-tuning">fine-tuned</a> model.
*/
Expand All @@ -125,6 +140,15 @@ public Optional<List<ToolV2>> getTools() {
return tools;
}

/**
* @return When set to <code>true</code>, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the <a href="https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools">Strict Tools guide</a>.
* <p><strong>Note</strong>: The first few requests with a new set of tools will take longer to process.</p>
*/
@JsonProperty("strict_tools")
public Optional<Boolean> getStrictTools() {
return strictTools;
}

/**
* @return A list of relevant documents that the model can cite to generate a more accurate reply. Each document is either a string or document object with content and metadata.
*/
Expand Down Expand Up @@ -237,18 +261,13 @@ public Optional<Boolean> getReturnPrompt() {
}

/**
* @return Whether to return the log probabilities of the generated tokens. Defaults to false.
* @return Defaults to <code>false</code>. When set to <code>true</code>, the log probabilities of the generated tokens will be included in the response.
*/
@JsonProperty("logprobs")
public Optional<Boolean> getLogprobs() {
return logprobs;
}

@JsonProperty("stream")
public Boolean getStream() {
return false;
}

@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
Expand All @@ -264,6 +283,7 @@ private boolean equalTo(V2ChatRequest other) {
return model.equals(other.model)
&& messages.equals(other.messages)
&& tools.equals(other.tools)
&& strictTools.equals(other.strictTools)
&& documents.equals(other.documents)
&& citationOptions.equals(other.citationOptions)
&& responseFormat.equals(other.responseFormat)
Expand All @@ -286,6 +306,7 @@ public int hashCode() {
this.model,
this.messages,
this.tools,
this.strictTools,
this.documents,
this.citationOptions,
this.responseFormat,
Expand Down Expand Up @@ -330,6 +351,10 @@ public interface _FinalStage {

_FinalStage tools(List<ToolV2> tools);

_FinalStage strictTools(Optional<Boolean> strictTools);

_FinalStage strictTools(Boolean strictTools);

_FinalStage documents(Optional<List<V2ChatRequestDocumentsItem>> documents);

_FinalStage documents(List<V2ChatRequestDocumentsItem> documents);
Expand Down Expand Up @@ -419,6 +444,8 @@ public static final class Builder implements ModelStage, _FinalStage {

private Optional<List<V2ChatRequestDocumentsItem>> documents = Optional.empty();

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

private Optional<List<ToolV2>> tools = Optional.empty();

private List<ChatMessageV2> messages = new ArrayList<>();
Expand All @@ -433,6 +460,7 @@ public Builder from(V2ChatRequest other) {
model(other.getModel());
messages(other.getMessages());
tools(other.getTools());
strictTools(other.getStrictTools());
documents(other.getDocuments());
citationOptions(other.getCitationOptions());
responseFormat(other.getResponseFormat());
Expand Down Expand Up @@ -462,7 +490,7 @@ public _FinalStage model(String model) {
}

/**
* <p>Whether to return the log probabilities of the generated tokens. Defaults to false.</p>
* <p>Defaults to <code>false</code>. When set to <code>true</code>, the log probabilities of the generated tokens will be included in the response.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
Expand Down Expand Up @@ -704,6 +732,24 @@ public _FinalStage documents(Optional<List<V2ChatRequestDocumentsItem>> document
return this;
}

/**
* <p>When set to <code>true</code>, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the <a href="https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools">Strict Tools guide</a>.</p>
* <p><strong>Note</strong>: The first few requests with a new set of tools will take longer to process.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage strictTools(Boolean strictTools) {
this.strictTools = Optional.of(strictTools);
return this;
}

@java.lang.Override
@JsonSetter(value = "strict_tools", nulls = Nulls.SKIP)
public _FinalStage strictTools(Optional<Boolean> strictTools) {
this.strictTools = strictTools;
return this;
}

/**
* <p>A list of available tools (functions) that the model may suggest invoking before producing a text response.</p>
* <p>When <code>tools</code> is passed (without <code>tool_results</code>), the <code>text</code> content in the response will be empty and the <code>tool_calls</code> 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 <code>tool_calls</code> array will be empty.</p>
Expand Down Expand Up @@ -748,6 +794,7 @@ public V2ChatRequest build() {
model,
messages,
tools,
strictTools,
documents,
citationOptions,
responseFormat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public final class V2ChatStreamRequest {

private final Optional<List<ToolV2>> tools;

private final Optional<Boolean> strictTools;

private final Optional<List<V2ChatStreamRequestDocumentsItem>> documents;

private final Optional<CitationOptions> citationOptions;
Expand Down Expand Up @@ -68,6 +70,7 @@ private V2ChatStreamRequest(
String model,
List<ChatMessageV2> messages,
Optional<List<ToolV2>> tools,
Optional<Boolean> strictTools,
Optional<List<V2ChatStreamRequestDocumentsItem>> documents,
Optional<CitationOptions> citationOptions,
Optional<ResponseFormatV2> responseFormat,
Expand All @@ -86,6 +89,7 @@ private V2ChatStreamRequest(
this.model = model;
this.messages = messages;
this.tools = tools;
this.strictTools = strictTools;
this.documents = documents;
this.citationOptions = citationOptions;
this.responseFormat = responseFormat;
Expand All @@ -103,6 +107,17 @@ private V2ChatStreamRequest(
this.additionalProperties = additionalProperties;
}

/**
* @return Defaults to <code>false</code>.
* <p>When <code>true</code>, the response will be a SSE stream of events. The final event will contain the complete response, and will have an <code>event_type</code> of <code>&quot;stream-end&quot;</code>.</p>
* <p>Streaming is beneficial for user interfaces that render the contents of the response piece by piece, as it gets generated.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
*/
@JsonProperty("stream")
public Boolean getStream() {
return true;
}

/**
* @return The name of a compatible <a href="https://docs.cohere.com/v2/docs/models">Cohere model</a> (such as command-r or command-r-plus) or the ID of a <a href="https://docs.cohere.com/v2/docs/chat-fine-tuning">fine-tuned</a> model.
*/
Expand All @@ -125,6 +140,15 @@ public Optional<List<ToolV2>> getTools() {
return tools;
}

/**
* @return When set to <code>true</code>, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the <a href="https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools">Strict Tools guide</a>.
* <p><strong>Note</strong>: The first few requests with a new set of tools will take longer to process.</p>
*/
@JsonProperty("strict_tools")
public Optional<Boolean> getStrictTools() {
return strictTools;
}

/**
* @return A list of relevant documents that the model can cite to generate a more accurate reply. Each document is either a string or document object with content and metadata.
*/
Expand Down Expand Up @@ -237,18 +261,13 @@ public Optional<Boolean> getReturnPrompt() {
}

/**
* @return Whether to return the log probabilities of the generated tokens. Defaults to false.
* @return Defaults to <code>false</code>. When set to <code>true</code>, the log probabilities of the generated tokens will be included in the response.
*/
@JsonProperty("logprobs")
public Optional<Boolean> getLogprobs() {
return logprobs;
}

@JsonProperty("stream")
public Boolean getStream() {
return true;
}

@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
Expand All @@ -264,6 +283,7 @@ private boolean equalTo(V2ChatStreamRequest other) {
return model.equals(other.model)
&& messages.equals(other.messages)
&& tools.equals(other.tools)
&& strictTools.equals(other.strictTools)
&& documents.equals(other.documents)
&& citationOptions.equals(other.citationOptions)
&& responseFormat.equals(other.responseFormat)
Expand All @@ -286,6 +306,7 @@ public int hashCode() {
this.model,
this.messages,
this.tools,
this.strictTools,
this.documents,
this.citationOptions,
this.responseFormat,
Expand Down Expand Up @@ -330,6 +351,10 @@ public interface _FinalStage {

_FinalStage tools(List<ToolV2> tools);

_FinalStage strictTools(Optional<Boolean> strictTools);

_FinalStage strictTools(Boolean strictTools);

_FinalStage documents(Optional<List<V2ChatStreamRequestDocumentsItem>> documents);

_FinalStage documents(List<V2ChatStreamRequestDocumentsItem> documents);
Expand Down Expand Up @@ -419,6 +444,8 @@ public static final class Builder implements ModelStage, _FinalStage {

private Optional<List<V2ChatStreamRequestDocumentsItem>> documents = Optional.empty();

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

private Optional<List<ToolV2>> tools = Optional.empty();

private List<ChatMessageV2> messages = new ArrayList<>();
Expand All @@ -433,6 +460,7 @@ public Builder from(V2ChatStreamRequest other) {
model(other.getModel());
messages(other.getMessages());
tools(other.getTools());
strictTools(other.getStrictTools());
documents(other.getDocuments());
citationOptions(other.getCitationOptions());
responseFormat(other.getResponseFormat());
Expand Down Expand Up @@ -462,7 +490,7 @@ public _FinalStage model(String model) {
}

/**
* <p>Whether to return the log probabilities of the generated tokens. Defaults to false.</p>
* <p>Defaults to <code>false</code>. When set to <code>true</code>, the log probabilities of the generated tokens will be included in the response.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
Expand Down Expand Up @@ -704,6 +732,24 @@ public _FinalStage documents(Optional<List<V2ChatStreamRequestDocumentsItem>> do
return this;
}

/**
* <p>When set to <code>true</code>, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the <a href="https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools">Strict Tools guide</a>.</p>
* <p><strong>Note</strong>: The first few requests with a new set of tools will take longer to process.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage strictTools(Boolean strictTools) {
this.strictTools = Optional.of(strictTools);
return this;
}

@java.lang.Override
@JsonSetter(value = "strict_tools", nulls = Nulls.SKIP)
public _FinalStage strictTools(Optional<Boolean> strictTools) {
this.strictTools = strictTools;
return this;
}

/**
* <p>A list of available tools (functions) that the model may suggest invoking before producing a text response.</p>
* <p>When <code>tools</code> is passed (without <code>tool_results</code>), the <code>text</code> content in the response will be empty and the <code>tool_calls</code> 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 <code>tool_calls</code> array will be empty.</p>
Expand Down Expand Up @@ -748,6 +794,7 @@ public V2ChatStreamRequest build() {
model,
messages,
tools,
strictTools,
documents,
citationOptions,
responseFormat,
Expand Down
Loading

0 comments on commit 0db4cdc

Please sign in to comment.