Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@types/convict": "^6.1.6"
},
"extraDependencies": {
"readable-stream": "^4.5.2",
"readable-stream": "^4.7.0",
"@aws-sdk/client-sagemaker": "^3.583.0",
"@aws-sdk/credential-providers": "^3.583.0",
"@aws-crypto/sha256-js": "^5.2.0",
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cohere-ai",
"version": "7.20.0",
"version": "7.20.1",
"private": false,
"repository": "github:cohere-ai/cohere-typescript",
"main": "./index.js",
Expand All @@ -19,29 +19,29 @@
"test:wire": "vitest --project wire"
},
"dependencies": {
"@aws-crypto/sha256-js": "^5.2.0",
"readable-stream": "^4.7.0",
"@aws-sdk/client-sagemaker": "^3.583.0",
"@aws-sdk/credential-providers": "^3.583.0",
"@aws-crypto/sha256-js": "^5.2.0",
"@smithy/protocol-http": "^5.1.2",
"@smithy/signature-v4": "^5.1.2",
"convict": "^6.2.4",
"form-data": "^4.0.4",
"form-data-encoder": "^4.1.0",
"formdata-node": "^6.0.3",
"readable-stream": "^4.7.0"
"formdata-node": "^6.0.3"
},
"devDependencies": {
"@biomejs/biome": "2.3.1",
"@types/convict": "^6.1.6",
"webpack": "^5.91.0",
"ts-loader": "^9.5.1",
"vitest": "^3.2.4",
"msw": "2.11.2",
"@types/node": "^18.19.70",
"@types/readable-stream": "^4.0.14",
"typescript": "~5.7.2",
"@biomejs/biome": "2.3.1",
"jest": "^29.7.0",
"msw": "2.11.2",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"typescript": "~5.7.2",
"vitest": "^3.2.4",
"webpack": "^5.91.0"
"@types/readable-stream": "^4.0.14",
"@types/convict": "^6.1.6"
},
"browser": {
"fs": false,
Expand Down
1,131 changes: 579 additions & 552 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ await client.v2.rerank({
documents: ["Carson City is the capital city of the American state of Nevada.", "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", "Capital punishment has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."],
query: "What is the capital of the United States?",
topN: 3,
model: "rerank-v3.5"
model: "rerank-v4.0-pro"
});

```
Expand Down
6 changes: 3 additions & 3 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class CohereClient {
"X-Client-Name": _options?.clientName,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.20.0",
"User-Agent": "cohere-ai/7.20.0",
"X-Fern-SDK-Version": "7.20.1",
"User-Agent": "cohere-ai/7.20.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -833,7 +833,7 @@ export class CohereClient {
* }],
* query: "What is the capital of the United States?",
* topN: 3,
* model: "rerank-v3.5"
* model: "rerank-v4.0-pro"
* })
*/
public rerank(
Expand Down
2 changes: 1 addition & 1 deletion src/api/client/requests/RerankRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type * as Cohere from "../../index";
* }],
* query: "What is the capital of the United States?",
* topN: 3,
* model: "rerank-v3.5"
* model: "rerank-v4.0-pro"
* }
*/
export interface RerankRequest {
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/v2/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export class V2 {
* documents: ["Carson City is the capital city of the American state of Nevada.", "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", "Capital punishment has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."],
* query: "What is the capital of the United States?",
* topN: 3,
* model: "rerank-v3.5"
* model: "rerank-v4.0-pro"
* })
*/
public rerank(
Expand Down
5 changes: 1 addition & 4 deletions src/api/resources/v2/client/requests/V2ChatRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ export interface V2ChatRequest {
*/
toolChoice?: Cohere.V2ChatRequestToolChoice;
thinking?: Cohere.Thinking;
/**
* The priority of the request (lower means earlier handling; default 0 highest priority).
* Higher priority requests are handled first, and dropped last when the system is under load.
*/
/** Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped. */
priority?: number;
}
5 changes: 1 addition & 4 deletions src/api/resources/v2/client/requests/V2ChatStreamRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ export interface V2ChatStreamRequest {
*/
toolChoice?: Cohere.V2ChatStreamRequestToolChoice;
thinking?: Cohere.Thinking;
/**
* The priority of the request (lower means earlier handling; default 0 highest priority).
* Higher priority requests are handled first, and dropped last when the system is under load.
*/
/** Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped. */
priority?: number;
}
5 changes: 1 addition & 4 deletions src/api/resources/v2/client/requests/V2EmbedRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ export interface V2EmbedRequest {
* If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned.
*/
truncate?: Cohere.V2EmbedRequestTruncate;
/**
* The priority of the request (lower means earlier handling; default 0 highest priority).
* Higher priority requests are handled first, and dropped last when the system is under load.
*/
/** Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped. */
priority?: number;
}
7 changes: 2 additions & 5 deletions src/api/resources/v2/client/requests/V2RerankRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* documents: ["Carson City is the capital city of the American state of Nevada.", "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", "Capital punishment has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."],
* query: "What is the capital of the United States?",
* topN: 3,
* model: "rerank-v3.5"
* model: "rerank-v4.0-pro"
* }
*/
export interface V2RerankRequest {
Expand All @@ -27,9 +27,6 @@ export interface V2RerankRequest {
topN?: number;
/** Defaults to `4096`. Long documents will be automatically truncated to the specified number of tokens. */
maxTokensPerDoc?: number;
/**
* The priority of the request (lower means earlier handling; default 0 highest priority).
* Higher priority requests are handled first, and dropped last when the system is under load.
*/
/** Controls how early the request is handled. Lower numbers indicate higher priority (default: 0, the highest). When the system is under load, higher-priority requests are processed first and are the least likely to be dropped. */
priority?: number;
}
2 changes: 2 additions & 0 deletions src/api/types/ApiMetaBilledUnits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export interface ApiMetaBilledUnits {
images?: number;
/** The number of billed input tokens. */
inputTokens?: number;
/** The number of billed image tokens. */
imageTokens?: number;
/** The number of billed output tokens. */
outputTokens?: number;
/** The number of billed search units. */
Expand Down
4 changes: 2 additions & 2 deletions src/core/schemas/builders/primitives/never.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Schema, SchemaType } from "../../Schema";
import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator";
import { type Schema, SchemaType } from "../../Schema.js";
import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js";

export const never: () => Schema<never, never> = createIdentitySchemaCreator<never>(
SchemaType.NEVER,
Expand Down
2 changes: 2 additions & 0 deletions src/serialization/types/ApiMetaBilledUnits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const ApiMetaBilledUnits: core.serialization.ObjectSchema<
> = core.serialization.object({
images: core.serialization.number().optional(),
inputTokens: core.serialization.property("input_tokens", core.serialization.number().optional()),
imageTokens: core.serialization.property("image_tokens", core.serialization.number().optional()),
outputTokens: core.serialization.property("output_tokens", core.serialization.number().optional()),
searchUnits: core.serialization.property("search_units", core.serialization.number().optional()),
classifications: core.serialization.number().optional(),
Expand All @@ -19,6 +20,7 @@ export declare namespace ApiMetaBilledUnits {
export interface Raw {
images?: number | null;
input_tokens?: number | null;
image_tokens?: number | null;
output_tokens?: number | null;
search_units?: number | null;
classifications?: number | null;
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SDK_VERSION = "7.20.0";
export const SDK_VERSION = "7.20.1";
1 change: 1 addition & 0 deletions tests/wire/datasets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@

const rawResponseBody = {
dataset: {
parse_info: { separator: "separator", delimiter: "delimiter" },
id: "id",
name: "name",
created_at: "2024-01-15T09:30:00Z",
Expand All @@ -386,7 +387,7 @@
server.mockEndpoint().get("/v1/datasets/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build();

const response = await client.datasets.get("id");
expect(response).toEqual({

Check failure on line 390 in tests/wire/datasets.test.ts

View workflow job for this annotation

GitHub Actions / test

datasets.test.ts > Datasets > get (1)

AssertionError: expected { dataset: { …(13) } } to deeply equal { dataset: { id: 'id', …(11) } } - Expected + Received @@ -8,10 +8,14 @@ }, ], "datasetType": "embed-input", "id": "id", "name": "name", + "parse_info": { + "delimiter": "delimiter", + "separator": "separator", + }, "preserveFields": [ "preserve_fields", ], "requiredFields": [ "required_fields", ❯ datasets.test.ts:390:26
dataset: {
id: "id",
name: "name",
Expand Down
4 changes: 4 additions & 0 deletions tests/wire/embedJobs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ describe("EmbedJobs", () => {
billed_units: {
images: 1.1,
input_tokens: 1.1,
image_tokens: 1.1,
output_tokens: 1.1,
search_units: 1.1,
classifications: 1.1,
Expand Down Expand Up @@ -231,6 +232,7 @@ describe("EmbedJobs", () => {
billedUnits: {
images: 1.1,
inputTokens: 1.1,
imageTokens: 1.1,
outputTokens: 1.1,
searchUnits: 1.1,
classifications: 1.1,
Expand Down Expand Up @@ -539,6 +541,7 @@ describe("EmbedJobs", () => {
billed_units: {
images: 1.1,
input_tokens: 1.1,
image_tokens: 1.1,
output_tokens: 1.1,
search_units: 1.1,
classifications: 1.1,
Expand Down Expand Up @@ -569,6 +572,7 @@ describe("EmbedJobs", () => {
billedUnits: {
images: 1.1,
inputTokens: 1.1,
imageTokens: 1.1,
outputTokens: 1.1,
searchUnits: 1.1,
classifications: 1.1,
Expand Down
4 changes: 2 additions & 2 deletions tests/wire/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2295,7 +2295,7 @@ describe("CohereClient", () => {
],
query: "What is the capital of the United States?",
top_n: 3,
model: "rerank-v3.5",
model: "rerank-v4.0-pro",
};
const rawResponseBody = {
id: "8bc745a3-7871-4597-822e-18c95d5df48c",
Expand Down Expand Up @@ -2335,7 +2335,7 @@ describe("CohereClient", () => {
],
query: "What is the capital of the United States?",
topN: 3,
model: "rerank-v3.5",
model: "rerank-v4.0-pro",
});
expect(response).toEqual({
id: "8bc745a3-7871-4597-822e-18c95d5df48c",
Expand Down
8 changes: 4 additions & 4 deletions tests/wire/v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ describe("V2", () => {
meta: {
api_version: { version: "2", is_experimental: true },
warnings: [
"You are using an experimental version, for more information please refer to https://docs.cohere.com/versioning-reference",
"You are using an experimental version, for more information please refer to https://docs.cohere.com/reference/about",
],
billed_units: { input_tokens: 2 },
},
Expand Down Expand Up @@ -1913,7 +1913,7 @@ describe("V2", () => {
isExperimental: true,
},
warnings: [
"You are using an experimental version, for more information please refer to https://docs.cohere.com/versioning-reference",
"You are using an experimental version, for more information please refer to https://docs.cohere.com/reference/about",
],
billedUnits: {
inputTokens: 2,
Expand Down Expand Up @@ -2563,7 +2563,7 @@ describe("V2", () => {
],
query: "What is the capital of the United States?",
top_n: 3,
model: "rerank-v3.5",
model: "rerank-v4.0-pro",
};
const rawResponseBody = {
id: "07734bd2-2473-4f07-94e1-0d9f0e6843cf",
Expand Down Expand Up @@ -2593,7 +2593,7 @@ describe("V2", () => {
],
query: "What is the capital of the United States?",
topN: 3,
model: "rerank-v3.5",
model: "rerank-v4.0-pro",
});
expect(response).toEqual({
id: "07734bd2-2473-4f07-94e1-0d9f0e6843cf",
Expand Down
Loading