Skip to content

Commit 499bde5

Browse files
🌿 Fern Regeneration -- September 19, 2024 (#203)
* SDK regeneration * Fix types --------- Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: Billy Trend <billy@cohere.com>
1 parent 80d9420 commit 499bde5

File tree

186 files changed

+2493
-1334
lines changed

Some content is hidden

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

186 files changed

+2493
-1334
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.13.1",
3+
"version": "7.13.2",
44
"private": false,
55
"repository": "https://github.com/cohere-ai/cohere-typescript",
66
"main": "./index.js",

reference.md

Lines changed: 145 additions & 11 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.StreamedChatResponse2></code></summary>
62+
<details><summary><code>client.v2.<a href="/src/api/resources/v2/client/Client.ts">chatStream</a>({ ...params }) -> core.Stream<Cohere.StreamedChatResponseV2></code></summary>
6363
<dl>
6464
<dd>
6565

@@ -93,13 +93,6 @@ await client.v2.chatStream({
9393
{
9494
role: "user",
9595
content: "string",
96-
documents: [
97-
{
98-
string: {
99-
key: "value",
100-
},
101-
},
102-
],
10396
},
10497
],
10598
tools: [
@@ -116,7 +109,10 @@ await client.v2.chatStream({
116109
},
117110
},
118111
],
119-
citationMode: Cohere.V2ChatStreamRequestCitationMode.Fast,
112+
documents: ["string"],
113+
citationOptions: {
114+
mode: Cohere.CitationOptionsMode.Fast,
115+
},
120116
responseFormat: {
121117
type: "text",
122118
},
@@ -165,7 +161,7 @@ await client.v2.chatStream({
165161
</dl>
166162
</details>
167163

168-
<details><summary><code>client.v2.<a href="/src/api/resources/v2/client/Client.ts">chat</a>({ ...params }) -> Cohere.NonStreamedChatResponse2</code></summary>
164+
<details><summary><code>client.v2.<a href="/src/api/resources/v2/client/Client.ts">chat</a>({ ...params }) -> Cohere.ChatResponse</code></summary>
169165
<dl>
170166
<dd>
171167

@@ -199,7 +195,7 @@ await client.v2.chat({
199195
{
200196
role: "tool",
201197
toolCallId: "messages",
202-
toolContent: ["messages"],
198+
toolContent: "messages",
203199
},
204200
],
205201
});
@@ -237,6 +233,144 @@ await client.v2.chat({
237233
</dl>
238234
</details>
239235

236+
<details><summary><code>client.v2.<a href="/src/api/resources/v2/client/Client.ts">embed</a>({ ...params }) -> Cohere.EmbedByTypeResponse</code></summary>
237+
<dl>
238+
<dd>
239+
240+
#### 📝 Description
241+
242+
<dl>
243+
<dd>
244+
245+
<dl>
246+
<dd>
247+
248+
This endpoint returns text embeddings. An embedding is a list of floating point numbers that captures semantic information about the text that it represents.
249+
250+
Embeddings can be used to create text classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page.
251+
252+
If you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](/docs/semantic-search).
253+
254+
</dd>
255+
</dl>
256+
</dd>
257+
</dl>
258+
259+
#### 🔌 Usage
260+
261+
<dl>
262+
<dd>
263+
264+
<dl>
265+
<dd>
266+
267+
```typescript
268+
await client.v2.embed({
269+
inputType: "image",
270+
images: ["string"],
271+
model: "string",
272+
});
273+
```
274+
275+
</dd>
276+
</dl>
277+
</dd>
278+
</dl>
279+
280+
#### ⚙️ Parameters
281+
282+
<dl>
283+
<dd>
284+
285+
<dl>
286+
<dd>
287+
288+
**request:** `Cohere.EmbedRequestV2`
289+
290+
</dd>
291+
</dl>
292+
293+
<dl>
294+
<dd>
295+
296+
**requestOptions:** `V2.RequestOptions`
297+
298+
</dd>
299+
</dl>
300+
</dd>
301+
</dl>
302+
303+
</dd>
304+
</dl>
305+
</details>
306+
307+
<details><summary><code>client.v2.<a href="/src/api/resources/v2/client/Client.ts">rerank</a>({ ...params }) -> Cohere.V2RerankResponse</code></summary>
308+
<dl>
309+
<dd>
310+
311+
#### 📝 Description
312+
313+
<dl>
314+
<dd>
315+
316+
<dl>
317+
<dd>
318+
319+
This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.
320+
321+
</dd>
322+
</dl>
323+
</dd>
324+
</dl>
325+
326+
#### 🔌 Usage
327+
328+
<dl>
329+
<dd>
330+
331+
<dl>
332+
<dd>
333+
334+
```typescript
335+
await client.v2.rerank({
336+
model: "model",
337+
query: "query",
338+
documents: ["documents"],
339+
});
340+
```
341+
342+
</dd>
343+
</dl>
344+
</dd>
345+
</dl>
346+
347+
#### ⚙️ Parameters
348+
349+
<dl>
350+
<dd>
351+
352+
<dl>
353+
<dd>
354+
355+
**request:** `Cohere.V2RerankRequest`
356+
357+
</dd>
358+
</dl>
359+
360+
<dl>
361+
<dd>
362+
363+
**requestOptions:** `V2.RequestOptions`
364+
365+
</dd>
366+
</dl>
367+
</dd>
368+
</dl>
369+
370+
</dd>
371+
</dl>
372+
</details>
373+
240374
## EmbedJobs
241375

242376
<details><summary><code>client.embedJobs.<a href="/src/api/resources/embedJobs/client/Client.ts">list</a>() -> Cohere.ListEmbedJobResponse</code></summary>

src/Client.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class CohereClient {
4242

4343
/**
4444
* Generates a text response to a user message.
45-
* To learn how to use the Chat API with Streaming and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api).
45+
* To learn how to use the Chat API and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api).
4646
*/
4747
public async chatStream(
4848
request: Cohere.ChatStreamRequest,
@@ -63,8 +63,8 @@ export class CohereClient {
6363
: undefined,
6464
"X-Fern-Language": "JavaScript",
6565
"X-Fern-SDK-Name": "cohere-ai",
66-
"X-Fern-SDK-Version": "7.13.1",
67-
"User-Agent": "cohere-ai/7.13.1",
66+
"X-Fern-SDK-Version": "7.13.2",
67+
"User-Agent": "cohere-ai/7.13.2",
6868
"X-Fern-Runtime": core.RUNTIME.type,
6969
"X-Fern-Runtime-Version": core.RUNTIME.version,
7070
Accepts: accepts != null ? accepts : undefined,
@@ -193,7 +193,7 @@ export class CohereClient {
193193

194194
/**
195195
* Generates a text response to a user message.
196-
* To learn how to use the Chat API with Streaming and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api).
196+
* To learn how to use the Chat API and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api).
197197
*
198198
* @param {Cohere.ChatRequest} request
199199
* @param {CohereClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -241,8 +241,8 @@ export class CohereClient {
241241
: undefined,
242242
"X-Fern-Language": "JavaScript",
243243
"X-Fern-SDK-Name": "cohere-ai",
244-
"X-Fern-SDK-Version": "7.13.1",
245-
"User-Agent": "cohere-ai/7.13.1",
244+
"X-Fern-SDK-Version": "7.13.2",
245+
"User-Agent": "cohere-ai/7.13.2",
246246
"X-Fern-Runtime": core.RUNTIME.type,
247247
"X-Fern-Runtime-Version": core.RUNTIME.version,
248248
Accepts: accepts != null ? accepts : undefined,
@@ -382,8 +382,8 @@ export class CohereClient {
382382
: undefined,
383383
"X-Fern-Language": "JavaScript",
384384
"X-Fern-SDK-Name": "cohere-ai",
385-
"X-Fern-SDK-Version": "7.13.1",
386-
"User-Agent": "cohere-ai/7.13.1",
385+
"X-Fern-SDK-Version": "7.13.2",
386+
"User-Agent": "cohere-ai/7.13.2",
387387
"X-Fern-Runtime": core.RUNTIME.type,
388388
"X-Fern-Runtime-Version": core.RUNTIME.version,
389389
},
@@ -553,8 +553,8 @@ export class CohereClient {
553553
: undefined,
554554
"X-Fern-Language": "JavaScript",
555555
"X-Fern-SDK-Name": "cohere-ai",
556-
"X-Fern-SDK-Version": "7.13.1",
557-
"User-Agent": "cohere-ai/7.13.1",
556+
"X-Fern-SDK-Version": "7.13.2",
557+
"User-Agent": "cohere-ai/7.13.2",
558558
"X-Fern-Runtime": core.RUNTIME.type,
559559
"X-Fern-Runtime-Version": core.RUNTIME.version,
560560
},
@@ -712,8 +712,8 @@ export class CohereClient {
712712
: undefined,
713713
"X-Fern-Language": "JavaScript",
714714
"X-Fern-SDK-Name": "cohere-ai",
715-
"X-Fern-SDK-Version": "7.13.1",
716-
"User-Agent": "cohere-ai/7.13.1",
715+
"X-Fern-SDK-Version": "7.13.2",
716+
"User-Agent": "cohere-ai/7.13.2",
717717
"X-Fern-Runtime": core.RUNTIME.type,
718718
"X-Fern-Runtime-Version": core.RUNTIME.version,
719719
},
@@ -867,8 +867,8 @@ export class CohereClient {
867867
: undefined,
868868
"X-Fern-Language": "JavaScript",
869869
"X-Fern-SDK-Name": "cohere-ai",
870-
"X-Fern-SDK-Version": "7.13.1",
871-
"User-Agent": "cohere-ai/7.13.1",
870+
"X-Fern-SDK-Version": "7.13.2",
871+
"User-Agent": "cohere-ai/7.13.2",
872872
"X-Fern-Runtime": core.RUNTIME.type,
873873
"X-Fern-Runtime-Version": core.RUNTIME.version,
874874
},
@@ -1022,8 +1022,8 @@ export class CohereClient {
10221022
: undefined,
10231023
"X-Fern-Language": "JavaScript",
10241024
"X-Fern-SDK-Name": "cohere-ai",
1025-
"X-Fern-SDK-Version": "7.13.1",
1026-
"User-Agent": "cohere-ai/7.13.1",
1025+
"X-Fern-SDK-Version": "7.13.2",
1026+
"User-Agent": "cohere-ai/7.13.2",
10271027
"X-Fern-Runtime": core.RUNTIME.type,
10281028
"X-Fern-Runtime-Version": core.RUNTIME.version,
10291029
},
@@ -1179,8 +1179,8 @@ export class CohereClient {
11791179
: undefined,
11801180
"X-Fern-Language": "JavaScript",
11811181
"X-Fern-SDK-Name": "cohere-ai",
1182-
"X-Fern-SDK-Version": "7.13.1",
1183-
"User-Agent": "cohere-ai/7.13.1",
1182+
"X-Fern-SDK-Version": "7.13.2",
1183+
"User-Agent": "cohere-ai/7.13.2",
11841184
"X-Fern-Runtime": core.RUNTIME.type,
11851185
"X-Fern-Runtime-Version": core.RUNTIME.version,
11861186
},
@@ -1334,8 +1334,8 @@ export class CohereClient {
13341334
: undefined,
13351335
"X-Fern-Language": "JavaScript",
13361336
"X-Fern-SDK-Name": "cohere-ai",
1337-
"X-Fern-SDK-Version": "7.13.1",
1338-
"User-Agent": "cohere-ai/7.13.1",
1337+
"X-Fern-SDK-Version": "7.13.2",
1338+
"User-Agent": "cohere-ai/7.13.2",
13391339
"X-Fern-Runtime": core.RUNTIME.type,
13401340
"X-Fern-Runtime-Version": core.RUNTIME.version,
13411341
},
@@ -1489,8 +1489,8 @@ export class CohereClient {
14891489
: undefined,
14901490
"X-Fern-Language": "JavaScript",
14911491
"X-Fern-SDK-Name": "cohere-ai",
1492-
"X-Fern-SDK-Version": "7.13.1",
1493-
"User-Agent": "cohere-ai/7.13.1",
1492+
"X-Fern-SDK-Version": "7.13.2",
1493+
"User-Agent": "cohere-ai/7.13.2",
14941494
"X-Fern-Runtime": core.RUNTIME.type,
14951495
"X-Fern-Runtime-Version": core.RUNTIME.version,
14961496
},
@@ -1637,8 +1637,8 @@ export class CohereClient {
16371637
: undefined,
16381638
"X-Fern-Language": "JavaScript",
16391639
"X-Fern-SDK-Name": "cohere-ai",
1640-
"X-Fern-SDK-Version": "7.13.1",
1641-
"User-Agent": "cohere-ai/7.13.1",
1640+
"X-Fern-SDK-Version": "7.13.2",
1641+
"User-Agent": "cohere-ai/7.13.2",
16421642
"X-Fern-Runtime": core.RUNTIME.type,
16431643
"X-Fern-Runtime-Version": core.RUNTIME.version,
16441644
},

src/ClientV2.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { V2 } from "./api/resources/v2/client/Client";
22
import { CohereClient } from "./Client";
33

44
// this class will require manual updates over time
5-
export class CohereClientV2 implements Omit<CohereClient, "chat" | "chatStream" | "v2">, Pick<V2, keyof V2> {
5+
export class CohereClientV2 implements Omit<CohereClient, keyof V2 | "v2">, Pick<V2, keyof V2> {
66
constructor(private _options: CohereClient.Options) {
77
}
88

@@ -11,11 +11,11 @@ export class CohereClientV2 implements Omit<CohereClient, "chat" | "chatStream"
1111

1212
chat = this.clientV2.chat.bind(this.clientV2)
1313
chatStream = this.clientV2.chatStream.bind(this.clientV2)
14+
embed = this.clientV2.embed.bind(this.clientV2)
15+
rerank = this.clientV2.rerank.bind(this.clientV2)
1416

1517
generateStream = this.client.generateStream.bind(this.clientV2)
1618
generate = this.client.generate.bind(this.clientV2)
17-
embed = this.client.embed.bind(this.clientV2)
18-
rerank = this.client.rerank.bind(this.clientV2)
1919
classify = this.client.classify.bind(this.clientV2)
2020
summarize = this.client.summarize.bind(this.clientV2)
2121
tokenize = this.client.tokenize.bind(this.clientV2)

0 commit comments

Comments
 (0)