Skip to content

Commit 981ae63

Browse files
committed
SDK regeneration
1 parent 5cad98d commit 981ae63

File tree

76 files changed

+1462
-1496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1462
-1496
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cohere-ai",
3-
"version": "7.17.1",
3+
"version": "8.0.0",
44
"private": false,
55
"repository": "https://github.com/cohere-ai/cohere-typescript",
66
"main": "./index.js",

reference.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ await client.checkApiKey();
5959

6060
## V2
6161

62-
<details><summary><code>client.v2.<a href="/src/api/resources/v2/client/Client.ts">chatStream</a>({ ...params }) -> core.Stream<Cohere.StreamedChatResponseV2></code></summary>
62+
<details><summary><code>client.v2.<a href="/src/api/resources/v2/client/Client.ts">chatStream</a>({ ...params }) -> core.Stream<Cohere.V2ChatStreamResponse></code></summary>
6363
<dl>
6464
<dd>
6565

@@ -90,12 +90,11 @@ Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2)
9090

9191
```typescript
9292
const response = await client.v2.chatStream({
93-
model: "model",
93+
model: "command-r",
9494
messages: [
9595
{
96-
role: "tool",
97-
toolCallId: "messages",
98-
content: "messages",
96+
role: "user",
97+
content: "Hello!",
9998
},
10099
],
101100
});
@@ -136,7 +135,7 @@ for await (const item of response) {
136135
</dl>
137136
</details>
138137

139-
<details><summary><code>client.v2.<a href="/src/api/resources/v2/client/Client.ts">chat</a>({ ...params }) -> Cohere.ChatResponse</code></summary>
138+
<details><summary><code>client.v2.<a href="/src/api/resources/v2/client/Client.ts">chat</a>({ ...params }) -> Cohere.V2ChatResponse</code></summary>
140139
<dl>
141140
<dd>
142141

@@ -167,12 +166,11 @@ Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2)
167166

168167
```typescript
169168
await client.v2.chat({
170-
model: "model",
169+
model: "command-a-03-2025",
171170
messages: [
172171
{
173-
role: "tool",
174-
toolCallId: "messages",
175-
content: "messages",
172+
role: "user",
173+
content: "Tell me about LLMs",
176174
},
177175
],
178176
});
@@ -243,8 +241,9 @@ If you want to learn more how to use the embedding model, have a look at the [Se
243241

244242
```typescript
245243
await client.v2.embed({
246-
model: "model",
247-
inputType: "search_document",
244+
texts: ["hello", "goodbye"],
245+
model: "embed-v4.0",
246+
inputType: "classification",
248247
embeddingTypes: ["float"],
249248
});
250249
```
@@ -310,9 +309,16 @@ This endpoint takes in a query and a list of texts and produces an ordered array
310309

311310
```typescript
312311
await client.v2.rerank({
313-
model: "model",
314-
query: "query",
315-
documents: ["documents"],
312+
documents: [
313+
"Carson City is the capital city of the American state of Nevada.",
314+
"The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.",
315+
"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.",
316+
"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.",
317+
"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.",
318+
],
319+
query: "What is the capital of the United States?",
320+
topN: 3,
321+
model: "rerank-v3.5",
316322
});
317323
```
318324

src/Client.ts

Lines changed: 137 additions & 34 deletions
Large diffs are not rendered by default.

src/api/client/requests/ChatRequest.ts

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,61 @@ import * as Cohere from "../../index";
77
/**
88
* @example
99
* {
10-
* message: "Can you give me a global market overview of solar panels?",
1110
* chatHistory: [{
12-
* role: "TOOL"
11+
* role: "USER",
12+
* message: "Who discovered gravity?"
1313
* }, {
14-
* role: "TOOL"
14+
* role: "CHATBOT",
15+
* message: "The man who is widely credited with discovering gravity is Sir Isaac Newton"
1516
* }],
16-
* promptTruncation: "OFF",
17-
* temperature: 0.3
17+
* message: "What year was he born?",
18+
* connectors: [{
19+
* id: "web-search"
20+
* }]
21+
* }
22+
*
23+
* @example
24+
* {
25+
* message: "Who is more popular: Nsync or Backstreet Boys?",
26+
* documents: [{
27+
* "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters",
28+
* "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: Backstreet Boys Popularity Analysis\n\nHern\u00E1n Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band\n\nAt one point, Backstreet Boys defined success: massive albums sales across the globe, great singles sales, plenty of chart topping releases, hugely hyped tours and tremendous media coverage.\n\nIt is true that they benefited from extraordinarily good market conditions in all markets. After all, the all-time record year for the music business, as far as revenues in billion dollars are concerned, was actually 1999. That is, back when this five men group was at its peak."
29+
* }, {
30+
* "title": "CSPC: NSYNC Popularity Analysis - ChartMasters",
31+
* "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: NSYNC Popularity Analysis\n\nMJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync\n\nAt the turn of the millennium three teen acts were huge in the US, the Backstreet Boys, Britney Spears and NSYNC. The latter is the only one we haven\u2019t study so far. It took 15 years and Adele to break their record of 2,4 million units sold of No Strings Attached in its first week alone.\n\nIt wasn\u2019t a fluke, as the second fastest selling album of the Soundscan era prior 2015, was also theirs since Celebrity debuted with 1,88 million units sold."
32+
* }, {
33+
* "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters",
34+
* "snippet": "1997, 1998, 2000 and 2001 also rank amongst some of the very best years.\nYet the way many music consumers \u2013 especially teenagers and young women\u2019s \u2013 embraced their output deserves its own chapter. If Jonas Brothers and more recently One Direction reached a great level of popularity during the past decade, the type of success achieved by Backstreet Boys is in a completely different level as they really dominated the business for a few years all over the world, including in some countries that were traditionally hard to penetrate for Western artists.\n\nWe will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers."
35+
* }, {
36+
* "title": "CSPC: NSYNC Popularity Analysis - ChartMasters",
37+
* "snippet": "Was the teen group led by Justin Timberlake really that big? Was it only in the US where they found success? Or were they a global phenomenon?\nAs usual, I\u2019ll be using the Commensurate Sales to Popularity Concept in order to relevantly gauge their results. This concept will not only bring you sales information for all NSYNC\u2018s albums, physical and download singles, as well as audio and video streaming, but it will also determine their true popularity. If you are not yet familiar with the CSPC method, the next page explains it with a short video. I fully recommend watching the video before getting into the sales figures."
38+
* }]
39+
* }
40+
*
41+
* @example
42+
* {
43+
* message: "Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?",
44+
* tools: [{
45+
* name: "query_daily_sales_report",
46+
* description: "Connects to a database to retrieve overall sales volumes and sales information for a given day.",
47+
* parameterDefinitions: {
48+
* "day": {
49+
* description: "Retrieves sales data for this day, formatted as YYYY-MM-DD.",
50+
* type: "str",
51+
* required: true
52+
* }
53+
* }
54+
* }, {
55+
* name: "query_product_catalog",
56+
* description: "Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.",
57+
* parameterDefinitions: {
58+
* "category": {
59+
* description: "Retrieves product information data for all products in this category.",
60+
* type: "str",
61+
* required: true
62+
* }
63+
* }
64+
* }]
1865
* }
1966
*/
2067
export interface ChatRequest {
@@ -212,16 +259,6 @@ export interface ChatRequest {
212259
*
213260
*/
214261
presencePenalty?: number;
215-
/**
216-
* When enabled, the user's prompt will be sent to the model without
217-
* any pre-processing.
218-
*
219-
* Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
220-
*
221-
*/
222-
rawPrompting?: boolean;
223-
/** The prompt is returned in the `prompt` response field when this is enabled. */
224-
returnPrompt?: boolean;
225262
/**
226263
* A list of available tools (functions) that the model may suggest invoking before producing a text response.
227264
*

src/api/client/requests/ChatStreamRequest.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@ import * as Cohere from "../../index";
77
/**
88
* @example
99
* {
10-
* message: "Can you give me a global market overview of solar panels?",
11-
* chatHistory: [{
12-
* role: "TOOL"
13-
* }, {
14-
* role: "TOOL"
15-
* }],
16-
* promptTruncation: "OFF",
17-
* temperature: 0.3
10+
* message: "hello world!"
1811
* }
1912
*/
2013
export interface ChatStreamRequest {
@@ -212,16 +205,6 @@ export interface ChatStreamRequest {
212205
*
213206
*/
214207
presencePenalty?: number;
215-
/**
216-
* When enabled, the user's prompt will be sent to the model without
217-
* any pre-processing.
218-
*
219-
* Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
220-
*
221-
*/
222-
rawPrompting?: boolean;
223-
/** The prompt is returned in the `prompt` response field when this is enabled. */
224-
returnPrompt?: boolean;
225208
/**
226209
* A list of available tools (functions) that the model may suggest invoking before producing a text response.
227210
*

src/api/client/requests/ClassifyRequest.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,39 @@ import * as Cohere from "../../index";
77
/**
88
* @example
99
* {
10-
* inputs: ["inputs"]
10+
* examples: [{
11+
* text: "Dermatologists don't like her!",
12+
* label: "Spam"
13+
* }, {
14+
* text: "'Hello, open to this?'",
15+
* label: "Spam"
16+
* }, {
17+
* text: "I need help please wire me $1000 right now",
18+
* label: "Spam"
19+
* }, {
20+
* text: "Nice to know you ;)",
21+
* label: "Spam"
22+
* }, {
23+
* text: "Please help me?",
24+
* label: "Spam"
25+
* }, {
26+
* text: "Your parcel will be delivered today",
27+
* label: "Not spam"
28+
* }, {
29+
* text: "Review changes to our Terms and Conditions",
30+
* label: "Not spam"
31+
* }, {
32+
* text: "Weekly sync notes",
33+
* label: "Not spam"
34+
* }, {
35+
* text: "'Re: Follow up from today's meeting'",
36+
* label: "Not spam"
37+
* }, {
38+
* text: "Pre-read for tomorrow",
39+
* label: "Not spam"
40+
* }],
41+
* inputs: ["Confirm your email address", "hey i need u to send some $"],
42+
* model: "YOUR-FINE-TUNED-MODEL-ID"
1143
* }
1244
*/
1345
export interface ClassifyRequest {

src/api/client/requests/DetokenizeRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/**
66
* @example
77
* {
8-
* tokens: [1],
9-
* model: "model"
8+
* tokens: [10002, 2261, 2012, 8, 2792, 43],
9+
* model: "command"
1010
* }
1111
*/
1212
export interface DetokenizeRequest {

0 commit comments

Comments
 (0)