Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌿 Fern Regeneration -- September 25, 2024 #34

Merged
merged 1 commit into from
Sep 25, 2024
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
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.3.2'
version = '1.4.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.3.2");
put("X-Fern-SDK-Version", "1.4.0");
}
});
this.headerSuppliers = headerSuppliers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public Optional<ResponseFormatV2> getResponseFormat() {

/**
* @return Used to select the <a href="/docs/safety-modes">safety instruction</a> inserted into the prompt. Defaults to <code>CONTEXTUAL</code>.
* When <code>NONE</code> is specified, the safety instruction will be omitted.
* When <code>OFF</code> is specified, the safety instruction will be omitted.
* <p>Safety modes are not yet configurable in combination with <code>tools</code>, <code>tool_results</code> and <code>documents</code> parameters.</p>
* <p><strong>Note</strong>: This parameter is only compatible with models <a href="/docs/command-r#august-2024-release">Command R 08-2024</a>, <a href="/docs/command-r-plus#august-2024-release">Command R+ 08-2024</a> and newer.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
Expand Down Expand Up @@ -604,7 +604,7 @@ public _FinalStage maxTokens(Optional<Integer> maxTokens) {

/**
* <p>Used to select the <a href="/docs/safety-modes">safety instruction</a> inserted into the prompt. Defaults to <code>CONTEXTUAL</code>.
* When <code>NONE</code> is specified, the safety instruction will be omitted.</p>
* When <code>OFF</code> is specified, the safety instruction will be omitted.</p>
* <p>Safety modes are not yet configurable in combination with <code>tools</code>, <code>tool_results</code> and <code>documents</code> parameters.</p>
* <p><strong>Note</strong>: This parameter is only compatible with models <a href="/docs/command-r#august-2024-release">Command R 08-2024</a>, <a href="/docs/command-r-plus#august-2024-release">Command R+ 08-2024</a> and newer.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public Optional<ResponseFormatV2> getResponseFormat() {

/**
* @return Used to select the <a href="/docs/safety-modes">safety instruction</a> inserted into the prompt. Defaults to <code>CONTEXTUAL</code>.
* When <code>NONE</code> is specified, the safety instruction will be omitted.
* When <code>OFF</code> is specified, the safety instruction will be omitted.
* <p>Safety modes are not yet configurable in combination with <code>tools</code>, <code>tool_results</code> and <code>documents</code> parameters.</p>
* <p><strong>Note</strong>: This parameter is only compatible with models <a href="/docs/command-r#august-2024-release">Command R 08-2024</a>, <a href="/docs/command-r-plus#august-2024-release">Command R+ 08-2024</a> and newer.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
Expand Down Expand Up @@ -604,7 +604,7 @@ public _FinalStage maxTokens(Optional<Integer> maxTokens) {

/**
* <p>Used to select the <a href="/docs/safety-modes">safety instruction</a> inserted into the prompt. Defaults to <code>CONTEXTUAL</code>.
* When <code>NONE</code> is specified, the safety instruction will be omitted.</p>
* When <code>OFF</code> is specified, the safety instruction will be omitted.</p>
* <p>Safety modes are not yet configurable in combination with <code>tools</code>, <code>tool_results</code> and <code>documents</code> parameters.</p>
* <p><strong>Note</strong>: This parameter is only compatible with models <a href="/docs/command-r#august-2024-release">Command R 08-2024</a>, <a href="/docs/command-r-plus#august-2024-release">Command R+ 08-2024</a> and newer.</p>
* <p>Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum V2ChatRequestSafetyMode {

STRICT("STRICT"),

NONE("NONE");
OFF("OFF");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum V2ChatStreamRequestSafetyMode {

STRICT("STRICT"),

NONE("NONE");
OFF("OFF");

private final String value;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cohere/api/types/Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Map<String, String> getData() {
}

/**
* @return Unique identifier for this document which will be referenced in citations. If not provided an ID will be automatically generated
* @return Unique identifier for this document which will be referenced in citations. If not provided an ID will be automatically generated.
*/
@JsonProperty("id")
public Optional<String> getId() {
Expand Down
50 changes: 29 additions & 21 deletions src/main/java/com/cohere/api/types/ToolMessageV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,26 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonDeserialize(builder = ToolMessageV2.Builder.class)
public final class ToolMessageV2 {
private final String toolCallId;

private final ToolMessageV2ToolContent toolContent;
private final Optional<ToolMessageV2Content> content;

private final Map<String, Object> additionalProperties;

private ToolMessageV2(
String toolCallId, ToolMessageV2ToolContent toolContent, Map<String, Object> additionalProperties) {
String toolCallId, Optional<ToolMessageV2Content> content, Map<String, Object> additionalProperties) {
this.toolCallId = toolCallId;
this.toolContent = toolContent;
this.content = content;
this.additionalProperties = additionalProperties;
}

Expand All @@ -42,9 +44,9 @@ public String getToolCallId() {
/**
* @return A single or list of outputs from a tool. The content should formatted as a JSON object string, or a list of tool content blocks
*/
@JsonProperty("tool_content")
public ToolMessageV2ToolContent getToolContent() {
return toolContent;
@JsonProperty("content")
public Optional<ToolMessageV2Content> getContent() {
return content;
}

@java.lang.Override
Expand All @@ -59,12 +61,12 @@ public Map<String, Object> getAdditionalProperties() {
}

private boolean equalTo(ToolMessageV2 other) {
return toolCallId.equals(other.toolCallId) && toolContent.equals(other.toolContent);
return toolCallId.equals(other.toolCallId) && content.equals(other.content);
}

@java.lang.Override
public int hashCode() {
return Objects.hash(this.toolCallId, this.toolContent);
return Objects.hash(this.toolCallId, this.content);
}

@java.lang.Override
Expand All @@ -77,24 +79,24 @@ public static ToolCallIdStage builder() {
}

public interface ToolCallIdStage {
ToolContentStage toolCallId(String toolCallId);
_FinalStage toolCallId(String toolCallId);

Builder from(ToolMessageV2 other);
}

public interface ToolContentStage {
_FinalStage toolContent(ToolMessageV2ToolContent toolContent);
}

public interface _FinalStage {
ToolMessageV2 build();

_FinalStage content(Optional<ToolMessageV2Content> content);

_FinalStage content(ToolMessageV2Content content);
}

@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements ToolCallIdStage, ToolContentStage, _FinalStage {
public static final class Builder implements ToolCallIdStage, _FinalStage {
private String toolCallId;

private ToolMessageV2ToolContent toolContent;
private Optional<ToolMessageV2Content> content = Optional.empty();

@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
Expand All @@ -104,7 +106,7 @@ private Builder() {}
@java.lang.Override
public Builder from(ToolMessageV2 other) {
toolCallId(other.getToolCallId());
toolContent(other.getToolContent());
content(other.getContent());
return this;
}

Expand All @@ -114,7 +116,7 @@ public Builder from(ToolMessageV2 other) {
*/
@java.lang.Override
@JsonSetter("tool_call_id")
public ToolContentStage toolCallId(String toolCallId) {
public _FinalStage toolCallId(String toolCallId) {
this.toolCallId = toolCallId;
return this;
}
Expand All @@ -124,15 +126,21 @@ public ToolContentStage toolCallId(String toolCallId) {
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("tool_content")
public _FinalStage toolContent(ToolMessageV2ToolContent toolContent) {
this.toolContent = toolContent;
public _FinalStage content(ToolMessageV2Content content) {
this.content = Optional.of(content);
return this;
}

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

@java.lang.Override
public ToolMessageV2 build() {
return new ToolMessageV2(toolCallId, toolContent, additionalProperties);
return new ToolMessageV2(toolCallId, content, additionalProperties);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
import java.util.List;
import java.util.Objects;

@JsonDeserialize(using = ToolMessageV2ToolContent.Deserializer.class)
public final class ToolMessageV2ToolContent {
@JsonDeserialize(using = ToolMessageV2Content.Deserializer.class)
public final class ToolMessageV2Content {
private final Object value;

private final int type;

private ToolMessageV2ToolContent(Object value, int type) {
private ToolMessageV2Content(Object value, int type) {
this.value = value;
this.type = type;
}
Expand All @@ -43,10 +43,10 @@ public <T> T visit(Visitor<T> visitor) {
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ToolMessageV2ToolContent && equalTo((ToolMessageV2ToolContent) other);
return other instanceof ToolMessageV2Content && equalTo((ToolMessageV2Content) other);
}

private boolean equalTo(ToolMessageV2ToolContent other) {
private boolean equalTo(ToolMessageV2Content other) {
return value.equals(other.value);
}

Expand All @@ -60,12 +60,12 @@ public String toString() {
return this.value.toString();
}

public static ToolMessageV2ToolContent of(String value) {
return new ToolMessageV2ToolContent(value, 0);
public static ToolMessageV2Content of(String value) {
return new ToolMessageV2Content(value, 0);
}

public static ToolMessageV2ToolContent of(List<ToolContent> value) {
return new ToolMessageV2ToolContent(value, 1);
public static ToolMessageV2Content of(List<ToolContent> value) {
return new ToolMessageV2Content(value, 1);
}

public interface Visitor<T> {
Expand All @@ -74,13 +74,13 @@ public interface Visitor<T> {
T visit(List<ToolContent> value);
}

static final class Deserializer extends StdDeserializer<ToolMessageV2ToolContent> {
static final class Deserializer extends StdDeserializer<ToolMessageV2Content> {
Deserializer() {
super(ToolMessageV2ToolContent.class);
super(ToolMessageV2Content.class);
}

@java.lang.Override
public ToolMessageV2ToolContent deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
public ToolMessageV2Content deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
Object value = p.readValueAs(Object.class);
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class));
Expand Down
Loading