Skip to content

Commit

Permalink
Merge pull request #4 from cohere-ai/fern-bot/12-21-2023-0129PM
Browse files Browse the repository at this point in the history
🌿 Fern Regeneration -- December 21, 2023
  • Loading branch information
billytrend-cohere authored Dec 22, 2023
2 parents 03753cb + 235a97b commit 7fc98e8
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 35 deletions.
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.2'
version = '1.0.3'
from components.java
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/com/cohere/api/Cohere.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Cohere(ClientOptions clientOptions) {
public Iterable<StreamedChatResponse> chatStream(ChatStreamRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/chat")
.addPathSegments("chat")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -101,7 +101,7 @@ public Iterable<StreamedChatResponse> chatStream(ChatStreamRequest request) {
public NonStreamedChatResponse chat(ChatRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/chat")
.addPathSegments("chat")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -144,7 +144,7 @@ public NonStreamedChatResponse chat(ChatRequest request) {
public Generation generate(GenerateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/generate")
.addPathSegments("generate")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -188,7 +188,7 @@ public Generation generate(GenerateRequest request) {
public EmbedResponse embed(EmbedRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/embed")
.addPathSegments("embed")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -232,7 +232,7 @@ public EmbedResponse embed(EmbedRequest request) {
public RerankResponse rerank(RerankRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/rerank")
.addPathSegments("rerank")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -275,7 +275,7 @@ public RerankResponse rerank(RerankRequest request) {
public ClassifyResponse classify(ClassifyRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/classify")
.addPathSegments("classify")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -318,7 +318,7 @@ public ClassifyResponse classify(ClassifyRequest request) {
public DetectLanguageResponse detectLanguage(DetectLanguageRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/detect-language")
.addPathSegments("detect-language")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -360,7 +360,7 @@ public DetectLanguageResponse detectLanguage(DetectLanguageRequest request) {
public SummarizeResponse summarize(SummarizeRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/summarize")
.addPathSegments("summarize")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -402,7 +402,7 @@ public SummarizeResponse summarize(SummarizeRequest request) {
public TokenizeResponse tokenize(TokenizeRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/tokenize")
.addPathSegments("tokenize")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -444,7 +444,7 @@ public TokenizeResponse tokenize(TokenizeRequest request) {
public DetokenizeResponse detokenize(DetokenizeRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/detokenize")
.addPathSegments("detokenize")
.build();
RequestBody body;
try {
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.2",
"1.0.3",
"X-Fern-Language",
"JAVA"));
this.headerSuppliers = headerSuppliers;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cohere/api/core/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package com.cohere.api.core;

public final class Environment {
public static final Environment PRODUCTION = new Environment("https://api.cohere.ai");
public static final Environment PRODUCTION = new Environment("https://api.cohere.ai/v1");

private final String url;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ public ConnectorsClient(ClientOptions clientOptions) {
}

/**
* Returns a list of connectors ordered by descending creation date (newer first).
* Returns a list of connectors ordered by descending creation date (newer first). See <a href="https://docs.cohere.com/docs/managing-your-connector">'Managing your Connector'</a> for more information.
*/
public ListResponse list() {
return list(ConnectorsListRequest.builder().build());
}

/**
* Returns a list of connectors ordered by descending creation date (newer first).
* Returns a list of connectors ordered by descending creation date (newer first). See <a href="https://docs.cohere.com/docs/managing-your-connector">'Managing your Connector'</a> for more information.
*/
public ListResponse list(ConnectorsListRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connectors");
.addPathSegments("connectors");
if (request.getLimit().isPresent()) {
httpUrl.addQueryParameter("limit", request.getLimit().get().toString());
}
Expand Down Expand Up @@ -73,20 +73,19 @@ public ListResponse list(ConnectorsListRequest request, RequestOptions requestOp
}

/**
* Returns a list of connectors ordered by descending creation date (newer first).
* Returns a list of connectors ordered by descending creation date (newer first). See <a href="https://docs.cohere.com/docs/managing-your-connector">'Managing your Connector'</a> for more information.
*/
public ListResponse list(ConnectorsListRequest request) {
return list(request, null);
}

/**
* Creates a new connector. The connector is tested during registration
* and will cancel registration when the test is unsuccessful.
* Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See <a href="https://docs.cohere.com/docs/creating-and-deploying-a-connector">'Creating and Deploying a Connector'</a> for more information.
*/
public CreateResponse create(CreateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connectors")
.addPathSegments("connectors")
.build();
RequestBody body;
try {
Expand Down Expand Up @@ -116,20 +115,19 @@ public CreateResponse create(CreateRequest request, RequestOptions requestOption
}

/**
* Creates a new connector. The connector is tested during registration
* and will cancel registration when the test is unsuccessful.
* Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See <a href="https://docs.cohere.com/docs/creating-and-deploying-a-connector">'Creating and Deploying a Connector'</a> for more information.
*/
public CreateResponse create(CreateRequest request) {
return create(request, null);
}

/**
* Retrieve a connector by ID.
* Retrieve a connector by ID. See <a href="https://docs.cohere.com/docs/connectors">'Connectors'</a> for more information.
*/
public GetResponse get(String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connectors")
.addPathSegments("connectors")
.addPathSegment(id)
.build();
Request okhttpRequest = new Request.Builder()
Expand All @@ -153,19 +151,19 @@ public GetResponse get(String id, RequestOptions requestOptions) {
}

/**
* Retrieve a connector by ID.
* Retrieve a connector by ID. See <a href="https://docs.cohere.com/docs/connectors">'Connectors'</a> for more information.
*/
public GetResponse get(String id) {
return get(id, null);
}

/**
* Delete a connector by ID.
* Delete a connector by ID. See <a href="https://docs.cohere.com/docs/connectors">'Connectors'</a> for more information.
*/
public Map<String, Object> delete(String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connectors")
.addPathSegments("connectors")
.addPathSegment(id)
.build();
Request okhttpRequest = new Request.Builder()
Expand All @@ -190,26 +188,26 @@ public Map<String, Object> delete(String id, RequestOptions requestOptions) {
}

/**
* Delete a connector by ID.
* Delete a connector by ID. See <a href="https://docs.cohere.com/docs/connectors">'Connectors'</a> for more information.
*/
public Map<String, Object> delete(String id) {
return delete(id, null);
}

/**
* Update a connector by ID. Omitted fields will not be updated.
* Update a connector by ID. Omitted fields will not be updated. See <a href="https://docs.cohere.com/docs/managing-your-connector">'Managing your Connector'</a> for more information.
*/
public UpdateResponse update(String id) {
return update(id, UpdateRequest.builder().build());
}

/**
* Update a connector by ID. Omitted fields will not be updated.
* Update a connector by ID. Omitted fields will not be updated. See <a href="https://docs.cohere.com/docs/managing-your-connector">'Managing your Connector'</a> for more information.
*/
public UpdateResponse update(String id, UpdateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connectors")
.addPathSegments("connectors")
.addPathSegment(id)
.build();
RequestBody body;
Expand Down Expand Up @@ -240,19 +238,19 @@ public UpdateResponse update(String id, UpdateRequest request, RequestOptions re
}

/**
* Update a connector by ID. Omitted fields will not be updated.
* Update a connector by ID. Omitted fields will not be updated. See <a href="https://docs.cohere.com/docs/managing-your-connector">'Managing your Connector'</a> for more information.
*/
public UpdateResponse update(String id, UpdateRequest request) {
return update(id, request, null);
}

/**
* Authorize the connector with the given ID for the connector oauth app.
* Authorize the connector with the given ID for the connector oauth app. See <a href="https://docs.cohere.com/docs/connector-authentication">'Connector Authentication'</a> for more information.
*/
public OAuthAuthorizeResponse oAuthAuthorize(String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connectors")
.addPathSegments("connectors")
.addPathSegment(id)
.addPathSegments("oauth/authorize")
.build();
Expand All @@ -277,7 +275,7 @@ public OAuthAuthorizeResponse oAuthAuthorize(String id, RequestOptions requestOp
}

/**
* Authorize the connector with the given ID for the connector oauth app.
* Authorize the connector with the given ID for the connector oauth app. See <a href="https://docs.cohere.com/docs/connector-authentication">'Connector Authentication'</a> for more information.
*/
public OAuthAuthorizeResponse oAuthAuthorize(String id) {
return oAuthAuthorize(id, null);
Expand Down

0 comments on commit 7fc98e8

Please sign in to comment.