Skip to content

Commit

Permalink
SDK regeneration (#201)
Browse files Browse the repository at this point in the history
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
  • Loading branch information
fern-api[bot] authored Sep 13, 2024
1 parent 4d33e2b commit 80d9420
Show file tree
Hide file tree
Showing 34 changed files with 916 additions and 848 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.13.0",
"version": "7.13.1",
"private": false,
"repository": "https://github.com/cohere-ai/cohere-typescript",
"main": "./index.js",
Expand Down
11 changes: 9 additions & 2 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ await client.v2.chatStream({
responseFormat: {
type: "text",
},
safetyMode: Cohere.V2ChatStreamRequestSafetyMode.Contextual,
maxTokens: 1,
stopSequences: ["string"],
temperature: 1.1,
Expand Down Expand Up @@ -194,7 +195,13 @@ Generates a message from the model in response to a provided conversation. To le
```typescript
await client.v2.chat({
model: "model",
messages: [],
messages: [
{
role: "tool",
toolCallId: "messages",
toolContent: ["messages"],
},
],
});
```

Expand Down Expand Up @@ -1402,7 +1409,7 @@ await client.finetuning.createFinetunedModel({
name: "api-test",
settings: {
baseModel: {
baseType: Cohere.BaseType.BaseTypeGenerative,
baseType: Cohere.BaseType.BaseTypeChat,
},
datasetId: "my-dataset-id",
},
Expand Down
68 changes: 35 additions & 33 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class CohereClient {
request: Cohere.ChatStreamRequest,
requestOptions?: CohereClient.RequestOptions
): Promise<core.Stream<Cohere.StreamedChatResponse>> {
const { accepts, ..._body } = request;
const _response = await (this._options.fetcher ?? core.fetcher)<stream.Readable>({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
Expand All @@ -62,15 +63,16 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Accepts: accepts != null ? accepts : undefined,
},
contentType: "application/json",
requestType: "json",
body: {
...serializers.ChatStreamRequest.jsonOrThrow(request, {
...serializers.ChatStreamRequest.jsonOrThrow(_body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
Expand Down Expand Up @@ -211,6 +213,11 @@ export class CohereClient {
* @example
* await client.chat({
* message: "Can you give me a global market overview of solar panels?",
* chatHistory: [{
* role: "TOOL"
* }, {
* role: "TOOL"
* }],
* promptTruncation: Cohere.ChatRequestPromptTruncation.Off,
* temperature: 0.3
* })
Expand All @@ -219,6 +226,7 @@ export class CohereClient {
request: Cohere.ChatRequest,
requestOptions?: CohereClient.RequestOptions
): Promise<Cohere.NonStreamedChatResponse> {
const { accepts, ..._body } = request;
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
Expand All @@ -233,15 +241,16 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Accepts: accepts != null ? accepts : undefined,
},
contentType: "application/json",
requestType: "json",
body: {
...serializers.ChatRequest.jsonOrThrow(request, {
...serializers.ChatRequest.jsonOrThrow(_body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
Expand Down Expand Up @@ -373,8 +382,8 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -544,8 +553,8 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -683,17 +692,10 @@ export class CohereClient {
* @throws {@link Cohere.GatewayTimeoutError}
*
* @example
* await client.embed({
* texts: ["string"],
* images: ["string"],
* model: "string",
* inputType: Cohere.EmbedInputType.SearchDocument,
* embeddingTypes: [Cohere.EmbeddingType.Float],
* truncate: Cohere.EmbedRequestTruncate.None
* })
* await client.embed()
*/
public async embed(
request: Cohere.EmbedRequest,
request: Cohere.EmbedRequest = {},
requestOptions?: CohereClient.RequestOptions
): Promise<Cohere.EmbedResponse> {
const _response = await (this._options.fetcher ?? core.fetcher)({
Expand All @@ -710,8 +712,8 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -865,8 +867,8 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -1020,8 +1022,8 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -1177,8 +1179,8 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -1332,8 +1334,8 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -1487,8 +1489,8 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -1635,8 +1637,8 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
9 changes: 9 additions & 0 deletions src/api/client/requests/ChatRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ import * as Cohere from "../../index";
* @example
* {
* message: "Can you give me a global market overview of solar panels?",
* chatHistory: [{
* role: "TOOL"
* }, {
* role: "TOOL"
* }],
* promptTruncation: Cohere.ChatRequestPromptTruncation.Off,
* temperature: 0.3
* }
*/
export interface ChatRequest {
/**
* Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events.
*/
accepts?: "text/event-stream";
/**
* Text input for the model to respond to.
*
Expand Down
5 changes: 5 additions & 0 deletions src/api/client/requests/ChatStreamRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as Cohere from "../../index";
/**
* @example
* {
* accepts: "text/event-stream",
* message: "string",
* model: "string",
* preamble: "string",
Expand Down Expand Up @@ -89,6 +90,10 @@ import * as Cohere from "../../index";
* }
*/
export interface ChatStreamRequest {
/**
* Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events.
*/
accepts?: "text/event-stream";
/**
* Text input for the model to respond to.
*
Expand Down
17 changes: 8 additions & 9 deletions src/api/client/requests/EmbedRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ import * as Cohere from "../../index";

/**
* @example
* {
* texts: ["string"],
* images: ["string"],
* model: "string",
* inputType: Cohere.EmbedInputType.SearchDocument,
* embeddingTypes: [Cohere.EmbeddingType.Float],
* truncate: Cohere.EmbedRequestTruncate.None
* }
* {}
*/
export interface EmbedRequest {
/** An array of strings for the model to embed. Maximum number of texts per call is `96`. We recommend reducing the length of each text to be under `512` tokens for optimal quality. */
texts: string[];
texts?: string[];
/**
* An array of image data URIs for the model to embed. Maximum number of images per call is `1`.
*
* The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg` or `image/png` format and has a maximum size of 5MB.
*/
images?: string[];
/**
* Defaults to embed-english-v2.0
*
Expand Down
24 changes: 12 additions & 12 deletions src/api/resources/connectors/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export class Connectors {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -233,8 +233,8 @@ export class Connectors {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -382,8 +382,8 @@ export class Connectors {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -529,8 +529,8 @@ export class Connectors {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -678,8 +678,8 @@ export class Connectors {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -838,8 +838,8 @@ export class Connectors {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.13.0",
"User-Agent": "cohere-ai/7.13.0",
"X-Fern-SDK-Version": "7.13.1",
"User-Agent": "cohere-ai/7.13.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
Loading

0 comments on commit 80d9420

Please sign in to comment.