Skip to content

Commit

Permalink
Release 7.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 5, 2023
1 parent 459378b commit 227db85
Show file tree
Hide file tree
Showing 52 changed files with 1,108 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cohere-ai",
"version": "7.4.3",
"version": "7.5.0",
"private": false,
"repository": "https://github.com/cohere-ai/cohere-typescript",
"main": "./index.js",
Expand Down
27 changes: 17 additions & 10 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as Cohere from "./api";
import * as serializers from "./serialization";
import urlJoin from "url-join";
import * as errors from "./errors";
import { Connectors } from "./api/resources/connectors/client/Client";

export declare namespace CohereClient {
interface Options {
Expand Down Expand Up @@ -44,7 +45,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
body: {
...(await serializers.ChatStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" })),
Expand Down Expand Up @@ -87,7 +88,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
contentType: "application/json",
body: {
Expand Down Expand Up @@ -148,7 +149,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
contentType: "application/json",
body: await serializers.GenerateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -217,7 +218,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
contentType: "application/json",
body: await serializers.EmbedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -280,7 +281,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
contentType: "application/json",
body: await serializers.RerankRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -339,7 +340,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
contentType: "application/json",
body: await serializers.ClassifyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -402,7 +403,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
contentType: "application/json",
body: await serializers.DetectLanguageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -458,7 +459,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
contentType: "application/json",
body: await serializers.SummarizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -516,7 +517,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
contentType: "application/json",
body: await serializers.TokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -579,7 +580,7 @@ export class CohereClient {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.4.3",
"X-Fern-SDK-Version": "7.5.0",
},
contentType: "application/json",
body: await serializers.DetokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -618,6 +619,12 @@ export class CohereClient {
}
}

protected _connectors: Connectors | undefined;

public get connectors(): Connectors {
return (this._connectors ??= new Connectors(this._options));
}

protected async _getAuthorizationHeader() {
return `Bearer ${await core.Supplier.get(this._options.token)}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/client/requests/GenerateRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export interface GenerateRequest {
k?: number;
/**
* Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`.
* Defaults to `0`. min value of `0.01`, max value of `0.99`.
* Defaults to `0.75`. min value of `0.01`, max value of `0.99`.
*
*/
p?: number;
Expand Down
3 changes: 3 additions & 0 deletions src/api/client/requests/RerankRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export interface RerankRequest {
/**
* A list of document objects or strings to rerank.
* If a document is provided the text fields is required and all other fields will be preserved in the response.
*
* The total max chunks (length of documents * max_chunks_per_doc) must be less than 10000.
*
* We recommend a maximum of 1,000 documents for optimal endpoint performance.
*/
documents: Cohere.RerankRequestDocumentsItem[];
/** The number of most relevant documents or indices to return, defaults to the length of the documents */
Expand Down
16 changes: 16 additions & 0 deletions src/api/errors/ForbiddenError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as errors from "../../errors";

export class ForbiddenError extends errors.CohereError {
constructor(body?: unknown) {
super({
message: "ForbiddenError",
statusCode: 403,
body: body,
});
Object.setPrototypeOf(this, ForbiddenError.prototype);
}
}
16 changes: 16 additions & 0 deletions src/api/errors/NotFoundError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as errors from "../../errors";

export class NotFoundError extends errors.CohereError {
constructor(body?: unknown) {
super({
message: "NotFoundError",
statusCode: 404,
body: body,
});
Object.setPrototypeOf(this, NotFoundError.prototype);
}
}
2 changes: 2 additions & 0 deletions src/api/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from "./BadRequestError";
export * from "./ForbiddenError";
export * from "./NotFoundError";
export * from "./InternalServerError";
1 change: 1 addition & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./types";
export * from "./errors";
export * from "./resources";
export * from "./client";
Loading

0 comments on commit 227db85

Please sign in to comment.