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 May 14, 2024
1 parent 3f6a079 commit e242ded
Show file tree
Hide file tree
Showing 13 changed files with 508 additions and 264 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.0.6'
version = '1.0.7'
from components.java
pom {
name = 'cohere'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cohere/api/CohereBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Cohere build() {
throw new RuntimeException("Please provide token or set the CO_API_KEY environment variable.");
}
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.token);
if (clientName != null) {
if (clientName.isPresent()) {
this.clientOptionsBuilder.addHeader("X-Client-Name", this.clientName);
}
clientOptionsBuilder.environment(this.environment);
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(
"X-Fern-SDK-Name",
"com.cohere.fern:api-sdk",
"X-Fern-SDK-Version",
"1.0.6",
"1.0.7",
"X-Fern-Language",
"JAVA"));
this.headerSuppliers = headerSuppliers;
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/com/cohere/api/requests/ChatRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import com.cohere.api.core.ObjectMappers;
import com.cohere.api.types.ChatConnector;
import com.cohere.api.types.ChatMessage;
import com.cohere.api.types.ChatRequestCitationQuality;
import com.cohere.api.types.ChatRequestPromptTruncation;
import com.cohere.api.types.ChatRequestToolResultsItem;
import com.cohere.api.types.Message;
import com.cohere.api.types.Tool;
import com.cohere.api.types.ToolResult;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand All @@ -33,7 +33,7 @@ public final class ChatRequest {

private final Optional<String> preamble;

private final Optional<List<ChatMessage>> chatHistory;
private final Optional<List<Message>> chatHistory;

private final Optional<String> conversationId;

Expand Down Expand Up @@ -71,15 +71,15 @@ public final class ChatRequest {

private final Optional<List<Tool>> tools;

private final Optional<List<ChatRequestToolResultsItem>> toolResults;
private final Optional<List<ToolResult>> toolResults;

private final Map<String, Object> additionalProperties;

private ChatRequest(
String message,
Optional<String> model,
Optional<String> preamble,
Optional<List<ChatMessage>> chatHistory,
Optional<List<Message>> chatHistory,
Optional<String> conversationId,
Optional<ChatRequestPromptTruncation> promptTruncation,
Optional<List<ChatConnector>> connectors,
Expand All @@ -98,7 +98,7 @@ private ChatRequest(
Optional<Boolean> rawPrompting,
Optional<Boolean> returnPrompt,
Optional<List<Tool>> tools,
Optional<List<ChatRequestToolResultsItem>> toolResults,
Optional<List<ToolResult>> toolResults,
Map<String, Object> additionalProperties) {
this.message = message;
this.model = model;
Expand Down Expand Up @@ -173,7 +173,7 @@ public Optional<String> getPreamble() {
* Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments</p>
*/
@JsonProperty("chat_history")
public Optional<List<ChatMessage>> getChatHistory() {
public Optional<List<Message>> getChatHistory() {
return chatHistory;
}

Expand Down Expand Up @@ -388,7 +388,7 @@ public Optional<List<Tool>> getTools() {
* Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments</p>
*/
@JsonProperty("tool_results")
public Optional<List<ChatRequestToolResultsItem>> getToolResults() {
public Optional<List<ToolResult>> getToolResults() {
return toolResults;
}

Expand Down Expand Up @@ -483,9 +483,9 @@ public interface _FinalStage {

_FinalStage preamble(String preamble);

_FinalStage chatHistory(Optional<List<ChatMessage>> chatHistory);
_FinalStage chatHistory(Optional<List<Message>> chatHistory);

_FinalStage chatHistory(List<ChatMessage> chatHistory);
_FinalStage chatHistory(List<Message> chatHistory);

_FinalStage conversationId(Optional<String> conversationId);

Expand Down Expand Up @@ -559,16 +559,16 @@ public interface _FinalStage {

_FinalStage tools(List<Tool> tools);

_FinalStage toolResults(Optional<List<ChatRequestToolResultsItem>> toolResults);
_FinalStage toolResults(Optional<List<ToolResult>> toolResults);

_FinalStage toolResults(List<ChatRequestToolResultsItem> toolResults);
_FinalStage toolResults(List<ToolResult> toolResults);
}

@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements MessageStage, _FinalStage {
private String message;

private Optional<List<ChatRequestToolResultsItem>> toolResults = Optional.empty();
private Optional<List<ToolResult>> toolResults = Optional.empty();

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

Expand Down Expand Up @@ -606,7 +606,7 @@ public static final class Builder implements MessageStage, _FinalStage {

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

private Optional<List<ChatMessage>> chatHistory = Optional.empty();
private Optional<List<Message>> chatHistory = Optional.empty();

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

Expand Down Expand Up @@ -681,14 +681,14 @@ public _FinalStage message(String message) {
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage toolResults(List<ChatRequestToolResultsItem> toolResults) {
public _FinalStage toolResults(List<ToolResult> toolResults) {
this.toolResults = Optional.of(toolResults);
return this;
}

@java.lang.Override
@JsonSetter(value = "tool_results", nulls = Nulls.SKIP)
public _FinalStage toolResults(Optional<List<ChatRequestToolResultsItem>> toolResults) {
public _FinalStage toolResults(Optional<List<ToolResult>> toolResults) {
this.toolResults = toolResults;
return this;
}
Expand Down Expand Up @@ -1051,14 +1051,14 @@ public _FinalStage conversationId(Optional<String> conversationId) {
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage chatHistory(List<ChatMessage> chatHistory) {
public _FinalStage chatHistory(List<Message> chatHistory) {
this.chatHistory = Optional.of(chatHistory);
return this;
}

@java.lang.Override
@JsonSetter(value = "chat_history", nulls = Nulls.SKIP)
public _FinalStage chatHistory(Optional<List<ChatMessage>> chatHistory) {
public _FinalStage chatHistory(Optional<List<Message>> chatHistory) {
this.chatHistory = chatHistory;
return this;
}
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/com/cohere/api/requests/ChatStreamRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import com.cohere.api.core.ObjectMappers;
import com.cohere.api.types.ChatConnector;
import com.cohere.api.types.ChatMessage;
import com.cohere.api.types.ChatStreamRequestCitationQuality;
import com.cohere.api.types.ChatStreamRequestPromptTruncation;
import com.cohere.api.types.ChatStreamRequestToolResultsItem;
import com.cohere.api.types.Message;
import com.cohere.api.types.Tool;
import com.cohere.api.types.ToolResult;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand All @@ -33,7 +33,7 @@ public final class ChatStreamRequest {

private final Optional<String> preamble;

private final Optional<List<ChatMessage>> chatHistory;
private final Optional<List<Message>> chatHistory;

private final Optional<String> conversationId;

Expand Down Expand Up @@ -71,15 +71,15 @@ public final class ChatStreamRequest {

private final Optional<List<Tool>> tools;

private final Optional<List<ChatStreamRequestToolResultsItem>> toolResults;
private final Optional<List<ToolResult>> toolResults;

private final Map<String, Object> additionalProperties;

private ChatStreamRequest(
String message,
Optional<String> model,
Optional<String> preamble,
Optional<List<ChatMessage>> chatHistory,
Optional<List<Message>> chatHistory,
Optional<String> conversationId,
Optional<ChatStreamRequestPromptTruncation> promptTruncation,
Optional<List<ChatConnector>> connectors,
Expand All @@ -98,7 +98,7 @@ private ChatStreamRequest(
Optional<Boolean> rawPrompting,
Optional<Boolean> returnPrompt,
Optional<List<Tool>> tools,
Optional<List<ChatStreamRequestToolResultsItem>> toolResults,
Optional<List<ToolResult>> toolResults,
Map<String, Object> additionalProperties) {
this.message = message;
this.model = model;
Expand Down Expand Up @@ -173,7 +173,7 @@ public Optional<String> getPreamble() {
* Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments</p>
*/
@JsonProperty("chat_history")
public Optional<List<ChatMessage>> getChatHistory() {
public Optional<List<Message>> getChatHistory() {
return chatHistory;
}

Expand Down Expand Up @@ -388,7 +388,7 @@ public Optional<List<Tool>> getTools() {
* Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments</p>
*/
@JsonProperty("tool_results")
public Optional<List<ChatStreamRequestToolResultsItem>> getToolResults() {
public Optional<List<ToolResult>> getToolResults() {
return toolResults;
}

Expand Down Expand Up @@ -483,9 +483,9 @@ public interface _FinalStage {

_FinalStage preamble(String preamble);

_FinalStage chatHistory(Optional<List<ChatMessage>> chatHistory);
_FinalStage chatHistory(Optional<List<Message>> chatHistory);

_FinalStage chatHistory(List<ChatMessage> chatHistory);
_FinalStage chatHistory(List<Message> chatHistory);

_FinalStage conversationId(Optional<String> conversationId);

Expand Down Expand Up @@ -559,16 +559,16 @@ public interface _FinalStage {

_FinalStage tools(List<Tool> tools);

_FinalStage toolResults(Optional<List<ChatStreamRequestToolResultsItem>> toolResults);
_FinalStage toolResults(Optional<List<ToolResult>> toolResults);

_FinalStage toolResults(List<ChatStreamRequestToolResultsItem> toolResults);
_FinalStage toolResults(List<ToolResult> toolResults);
}

@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements MessageStage, _FinalStage {
private String message;

private Optional<List<ChatStreamRequestToolResultsItem>> toolResults = Optional.empty();
private Optional<List<ToolResult>> toolResults = Optional.empty();

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

Expand Down Expand Up @@ -606,7 +606,7 @@ public static final class Builder implements MessageStage, _FinalStage {

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

private Optional<List<ChatMessage>> chatHistory = Optional.empty();
private Optional<List<Message>> chatHistory = Optional.empty();

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

Expand Down Expand Up @@ -681,14 +681,14 @@ public _FinalStage message(String message) {
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage toolResults(List<ChatStreamRequestToolResultsItem> toolResults) {
public _FinalStage toolResults(List<ToolResult> toolResults) {
this.toolResults = Optional.of(toolResults);
return this;
}

@java.lang.Override
@JsonSetter(value = "tool_results", nulls = Nulls.SKIP)
public _FinalStage toolResults(Optional<List<ChatStreamRequestToolResultsItem>> toolResults) {
public _FinalStage toolResults(Optional<List<ToolResult>> toolResults) {
this.toolResults = toolResults;
return this;
}
Expand Down Expand Up @@ -1051,14 +1051,14 @@ public _FinalStage conversationId(Optional<String> conversationId) {
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage chatHistory(List<ChatMessage> chatHistory) {
public _FinalStage chatHistory(List<Message> chatHistory) {
this.chatHistory = Optional.of(chatHistory);
return this;
}

@java.lang.Override
@JsonSetter(value = "chat_history", nulls = Nulls.SKIP)
public _FinalStage chatHistory(Optional<List<ChatMessage>> chatHistory) {
public _FinalStage chatHistory(Optional<List<Message>> chatHistory) {
this.chatHistory = chatHistory;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public ListTrainingStepMetricsResponse listTrainingStepMetrics(
.newBuilder()
.addPathSegments("finetuning/finetuned-models")
.addPathSegment(finetunedModelId)
.addPathSegments("metrics");
.addPathSegments("training-step-metrics");
if (request.getPageSize().isPresent()) {
httpUrl.addQueryParameter("page_size", request.getPageSize().get().toString());
}
Expand Down
Loading

0 comments on commit e242ded

Please sign in to comment.