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 -- December 19, 2023 #3

Merged
merged 1 commit into from
Dec 19, 2023
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 @@ -46,7 +46,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.cohere'
artifactId = 'cohere-java'
version = '1.0.1'
version = '1.0.2'
from components.java
}
}
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 @@ -29,7 +29,7 @@ private ClientOptions(
"X-Fern-SDK-Name",
"com.cohere.fern:api-sdk",
"X-Fern-SDK-Version",
"1.0.1",
"1.0.2",
"X-Fern-Language",
"JAVA"));
this.headerSuppliers = headerSuppliers;
Expand Down
38 changes: 36 additions & 2 deletions src/main/java/com/cohere/api/requests/EmbedRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public final class EmbedRequest {

private final Optional<String> inputType;

private final Optional<List<String>> embeddingTypes;

private final Optional<EmbedRequestTruncate> truncate;

private final Map<String, Object> additionalProperties;
Expand All @@ -37,11 +39,13 @@ private EmbedRequest(
List<String> texts,
Optional<String> model,
Optional<String> inputType,
Optional<List<String>> embeddingTypes,
Optional<EmbedRequestTruncate> truncate,
Map<String, Object> additionalProperties) {
this.texts = texts;
this.model = model;
this.inputType = inputType;
this.embeddingTypes = embeddingTypes;
this.truncate = truncate;
this.additionalProperties = additionalProperties;
}
Expand Down Expand Up @@ -101,6 +105,21 @@ public Optional<String> getInputType() {
return inputType;
}

/**
* @return Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types.
* <ul>
* <li><code>&quot;float&quot;</code>: Use this when you want to get back the default float embeddings. Valid for all models.</li>
* <li><code>&quot;int8&quot;</code>: Use this when you want to get back signed int8 embeddings. Valid for only v3 models.</li>
* <li><code>&quot;uint8&quot;</code>: Use this when you want to get back unsigned int8 embeddings. Valid for only v3 models.</li>
* <li><code>&quot;binary&quot;</code>: Use this when you want to get back signed binary embeddings. Valid for only v3 models.</li>
* <li><code>&quot;ubinary&quot;</code>: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models.</li>
* </ul>
*/
@JsonProperty("embedding_types")
public Optional<List<String>> getEmbeddingTypes() {
return embeddingTypes;
}

/**
* @return One of <code>NONE|START|END</code> to specify how the API will handle inputs longer than the maximum token length.
* <p>Passing <code>START</code> will discard the start of the input. <code>END</code> will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model.</p>
Expand All @@ -126,12 +145,13 @@ private boolean equalTo(EmbedRequest other) {
return texts.equals(other.texts)
&& model.equals(other.model)
&& inputType.equals(other.inputType)
&& embeddingTypes.equals(other.embeddingTypes)
&& truncate.equals(other.truncate);
}

@Override
public int hashCode() {
return Objects.hash(this.texts, this.model, this.inputType, this.truncate);
return Objects.hash(this.texts, this.model, this.inputType, this.embeddingTypes, this.truncate);
}

@Override
Expand All @@ -151,6 +171,8 @@ public static final class Builder {

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

private Optional<List<String>> embeddingTypes = Optional.empty();

private Optional<EmbedRequestTruncate> truncate = Optional.empty();

@JsonAnySetter
Expand All @@ -162,6 +184,7 @@ public Builder from(EmbedRequest other) {
texts(other.getTexts());
model(other.getModel());
inputType(other.getInputType());
embeddingTypes(other.getEmbeddingTypes());
truncate(other.getTruncate());
return this;
}
Expand Down Expand Up @@ -205,6 +228,17 @@ public Builder inputType(String inputType) {
return this;
}

@JsonSetter(value = "embedding_types", nulls = Nulls.SKIP)
public Builder embeddingTypes(Optional<List<String>> embeddingTypes) {
this.embeddingTypes = embeddingTypes;
return this;
}

public Builder embeddingTypes(List<String> embeddingTypes) {
this.embeddingTypes = Optional.of(embeddingTypes);
return this;
}

@JsonSetter(value = "truncate", nulls = Nulls.SKIP)
public Builder truncate(Optional<EmbedRequestTruncate> truncate) {
this.truncate = truncate;
Expand All @@ -217,7 +251,7 @@ public Builder truncate(EmbedRequestTruncate truncate) {
}

public EmbedRequest build() {
return new EmbedRequest(texts, model, inputType, truncate, additionalProperties);
return new EmbedRequest(texts, model, inputType, embeddingTypes, truncate, additionalProperties);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.cohere.api.core.ClientOptions;
import com.cohere.api.core.ObjectMappers;
import com.cohere.api.core.RequestOptions;
import com.cohere.api.resources.connectors.requests.ConnectorsListRequest;
import com.cohere.api.resources.connectors.requests.CreateRequest;
import com.cohere.api.resources.connectors.requests.ListRequest;
import com.cohere.api.resources.connectors.requests.UpdateRequest;
import com.cohere.api.types.CreateResponse;
import com.cohere.api.types.GetResponse;
Expand Down Expand Up @@ -36,13 +36,13 @@ public ConnectorsClient(ClientOptions clientOptions) {
* Returns a list of connectors ordered by descending creation date (newer first).
*/
public ListResponse list() {
return list(ListRequest.builder().build());
return list(ConnectorsListRequest.builder().build());
}

/**
* Returns a list of connectors ordered by descending creation date (newer first).
*/
public ListResponse list(ListRequest request, RequestOptions requestOptions) {
public ListResponse list(ConnectorsListRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connectors");
Expand Down Expand Up @@ -75,7 +75,7 @@ public ListResponse list(ListRequest request, RequestOptions requestOptions) {
/**
* Returns a list of connectors ordered by descending creation date (newer first).
*/
public ListResponse list(ListRequest request) {
public ListResponse list(ConnectorsListRequest request) {
return list(request, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
import java.util.Optional;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonDeserialize(builder = ListRequest.Builder.class)
public final class ListRequest {
@JsonDeserialize(builder = ConnectorsListRequest.Builder.class)
public final class ConnectorsListRequest {
private final Optional<Double> limit;

private final Optional<Double> offset;

private final Map<String, Object> additionalProperties;

private ListRequest(Optional<Double> limit, Optional<Double> offset, Map<String, Object> additionalProperties) {
private ConnectorsListRequest(
Optional<Double> limit, Optional<Double> offset, Map<String, Object> additionalProperties) {
this.limit = limit;
this.offset = offset;
this.additionalProperties = additionalProperties;
Expand All @@ -51,15 +52,15 @@ public Optional<Double> getOffset() {
@Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ListRequest && equalTo((ListRequest) other);
return other instanceof ConnectorsListRequest && equalTo((ConnectorsListRequest) other);
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

private boolean equalTo(ListRequest other) {
private boolean equalTo(ConnectorsListRequest other) {
return limit.equals(other.limit) && offset.equals(other.offset);
}

Expand Down Expand Up @@ -88,7 +89,7 @@ public static final class Builder {

private Builder() {}

public Builder from(ListRequest other) {
public Builder from(ConnectorsListRequest other) {
limit(other.getLimit());
offset(other.getOffset());
return this;
Expand Down Expand Up @@ -116,8 +117,8 @@ public Builder offset(Double offset) {
return this;
}

public ListRequest build() {
return new ListRequest(limit, offset, additionalProperties);
public ConnectorsListRequest build() {
return new ConnectorsListRequest(limit, offset, additionalProperties);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public Optional<List<String>> getExcludes() {
}

/**
* @return The OAuth 2.0 configuration for the connector. Cannot be specified if serviceAuth is specified.
* @return The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified.
*/
@JsonProperty("oauth")
public Optional<CreateConnectorOAuth> getOauth() {
Expand All @@ -113,15 +113,15 @@ public Optional<Boolean> getActive() {
/**
* @return Whether a chat request should continue or not if the request to this connector fails.
*/
@JsonProperty("continueOnFailure")
@JsonProperty("continue_on_failure")
public Optional<Boolean> getContinueOnFailure() {
return continueOnFailure;
}

/**
* @return The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.
*/
@JsonProperty("serviceAuth")
@JsonProperty("service_auth")
public Optional<CreateConnectorServiceAuth> getServiceAuth() {
return serviceAuth;
}
Expand Down Expand Up @@ -277,7 +277,7 @@ public _FinalStage serviceAuth(CreateConnectorServiceAuth serviceAuth) {
}

@Override
@JsonSetter(value = "serviceAuth", nulls = Nulls.SKIP)
@JsonSetter(value = "service_auth", nulls = Nulls.SKIP)
public _FinalStage serviceAuth(Optional<CreateConnectorServiceAuth> serviceAuth) {
this.serviceAuth = serviceAuth;
return this;
Expand All @@ -294,7 +294,7 @@ public _FinalStage continueOnFailure(Boolean continueOnFailure) {
}

@Override
@JsonSetter(value = "continueOnFailure", nulls = Nulls.SKIP)
@JsonSetter(value = "continue_on_failure", nulls = Nulls.SKIP)
public _FinalStage continueOnFailure(Optional<Boolean> continueOnFailure) {
this.continueOnFailure = continueOnFailure;
return this;
Expand All @@ -318,7 +318,7 @@ public _FinalStage active(Optional<Boolean> active) {
}

/**
* <p>The OAuth 2.0 configuration for the connector. Cannot be specified if serviceAuth is specified.</p>
* <p>The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Optional<List<String>> getExcludes() {
}

/**
* @return The OAuth 2.0 configuration for the connector. Cannot be specified if serviceAuth is specified.
* @return The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified.
*/
@JsonProperty("oauth")
public Optional<CreateConnectorOAuth> getOauth() {
Expand All @@ -95,15 +95,15 @@ public Optional<Boolean> getActive() {
return active;
}

@JsonProperty("continueOnFailure")
@JsonProperty("continue_on_failure")
public Optional<Boolean> getContinueOnFailure() {
return continueOnFailure;
}

/**
* @return The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.
*/
@JsonProperty("serviceAuth")
@JsonProperty("service_auth")
public Optional<CreateConnectorServiceAuth> getServiceAuth() {
return serviceAuth;
}
Expand Down Expand Up @@ -231,7 +231,7 @@ public Builder active(Boolean active) {
return this;
}

@JsonSetter(value = "continueOnFailure", nulls = Nulls.SKIP)
@JsonSetter(value = "continue_on_failure", nulls = Nulls.SKIP)
public Builder continueOnFailure(Optional<Boolean> continueOnFailure) {
this.continueOnFailure = continueOnFailure;
return this;
Expand All @@ -242,7 +242,7 @@ public Builder continueOnFailure(Boolean continueOnFailure) {
return this;
}

@JsonSetter(value = "serviceAuth", nulls = Nulls.SKIP)
@JsonSetter(value = "service_auth", nulls = Nulls.SKIP)
public Builder serviceAuth(Optional<CreateConnectorServiceAuth> serviceAuth) {
this.serviceAuth = serviceAuth;
return this;
Expand Down
Loading
Loading