Skip to content

Commit

Permalink
🌿 Fern Regeneration -- February 1, 2024 (#129)
Browse files Browse the repository at this point in the history
* SDK regeneration

* Make evalData optional

* Add _queryParams

---------

Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Co-authored-by: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com>
  • Loading branch information
fern-api[bot] and billytrend-cohere authored Feb 1, 2024
1 parent 086ec84 commit 5d51ad7
Show file tree
Hide file tree
Showing 29 changed files with 274 additions and 89 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.7.4",
"version": "7.7.5",
"private": false,
"repository": "https://github.com/cohere-ai/cohere-typescript",
"main": "./index.js",
Expand Down
95 changes: 70 additions & 25 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.ChatStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
body: {
...(await serializers.ChatStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" })),
stream: true,
},
responseType: "streaming",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
Expand Down Expand Up @@ -105,17 +108,18 @@ export class CohereClient {
*
* @example
* await cohere.chat({
* message: "string",
* message: "Can you give me a global market overview of solar panels?",
* stream: false,
* chatHistory: [{
* role: Cohere.ChatMessageRole.Chatbot,
* message: "string"
* message: "Hi!"
* }, {
* role: Cohere.ChatMessageRole.Chatbot,
* message: "How can I help you today?"
* }],
* promptTruncation: Cohere.ChatRequestPromptTruncation.Off,
* connectors: [{
* id: "string"
* }],
* citationQuality: Cohere.ChatRequestCitationQuality.Fast,
* temperature: 0.3,
* searchOptions: {},
* promptOverride: {}
* })
Expand All @@ -138,10 +142,13 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.ChatRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
body: {
...(await serializers.ChatRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" })),
stream: false,
},
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
Expand Down Expand Up @@ -198,10 +205,13 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.GenerateStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
body: {
...(await serializers.GenerateStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" })),
stream: true,
},
responseType: "streaming",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
Expand Down Expand Up @@ -283,10 +293,13 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.GenerateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
body: {
...(await serializers.GenerateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" })),
stream: false,
},
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
Expand Down Expand Up @@ -356,7 +369,7 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.EmbedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -407,7 +420,8 @@ export class CohereClient {
*
* @example
* await cohere.rerank({
* query: "string",
* model: "rerank-english-v2.0",
* query: "What is the capital of the United States?",
* documents: []
* })
*/
Expand All @@ -429,7 +443,7 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.RerankRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -476,8 +490,38 @@ export class CohereClient {
*
* @example
* await cohere.classify({
* inputs: [],
* examples: [{}],
* inputs: ["Confirm your email address", "hey i need u to send some $"],
* examples: [{
* text: "Dermatologists don't like her!",
* label: "Spam"
* }, {
* text: "Hello, open to this?",
* label: "Spam"
* }, {
* text: "I need help please wire me $1000 right now",
* label: "Spam"
* }, {
* text: "Nice to know you ;)",
* label: "Spam"
* }, {
* text: "Please help me?",
* label: "Spam"
* }, {
* text: "Your parcel will be delivered today",
* label: "Not spam"
* }, {
* text: "Review changes to our Terms and Conditions",
* label: "Not spam"
* }, {
* text: "Weekly sync notes",
* label: "Not spam"
* }, {
* text: "Re: Follow up from today\u2019s meeting",
* label: "Not spam"
* }, {
* text: "Pre-read for tomorrow",
* label: "Not spam"
* }],
* preset: "my-preset-a58sbd",
* truncate: Cohere.ClassifyRequestTruncate.None
* })
Expand All @@ -500,7 +544,7 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.ClassifyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -551,7 +595,7 @@ export class CohereClient {
*
* @example
* await cohere.summarize({
* text: "string",
* text: "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. It may be made from milk or cream and is flavoured with a sweetener, either sugar or an alternative, and a spice, such as cocoa or vanilla, or with fruit such as strawberries or peaches. It can also be made by whisking a flavored cream base and liquid nitrogen together. Food coloring is sometimes added, in addition to stabilizers. The mixture is cooled below the freezing point of water and stirred to incorporate air spaces and to prevent detectable ice crystals from forming. The result is a smooth, semi-solid foam that is solid at very low temperatures (below 2 \u00B0C or 35 \u00B0F). It becomes more malleable as its temperature increases.\n\nThe meaning of the name \"ice cream\" varies from one country to another. In some countries, such as the United States, \"ice cream\" applies only to a specific variety, and most governments regulate the commercial use of the various terms according to the relative quantities of the main ingredients, notably the amount of cream. Products that do not meet the criteria to be called ice cream are sometimes labelled \"frozen dairy dessert\" instead. In other countries, such as Italy and Argentina, one word is used fo\r all variants. Analogues made from dairy alternatives, such as goat's or sheep's milk, or milk substitutes (e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are lactose intolerant, allergic to dairy protein or vegan.",
* length: Cohere.SummarizeRequestLength.Short,
* format: Cohere.SummarizeRequestFormat.Paragraph,
* extractiveness: Cohere.SummarizeRequestExtractiveness.Low
Expand All @@ -575,7 +619,7 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.SummarizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -621,7 +665,8 @@ export class CohereClient {
*
* @example
* await cohere.tokenize({
* text: "string"
* text: "tokenize me! :D",
* model: "command"
* })
*/
public async tokenize(
Expand All @@ -642,7 +687,7 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.TokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -693,7 +738,7 @@ export class CohereClient {
*
* @example
* await cohere.detokenize({
* tokens: []
* tokens: [10104, 12221, 1315, 34, 1420, 69]
* })
*/
public async detokenize(
Expand All @@ -714,7 +759,7 @@ export class CohereClient {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "cohere-ai",
"X-Fern-SDK-Version": "7.7.4",
"X-Fern-SDK-Version": "7.7.5",
},
contentType: "application/json",
body: await serializers.DetokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down
28 changes: 23 additions & 5 deletions src/api/client/requests/ChatRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ import * as Cohere from "../..";
/**
* @example
* {
* message: "string",
* message: "Can you give me a global market overview of solar panels?",
* stream: false,
* chatHistory: [{
* role: Cohere.ChatMessageRole.Chatbot,
* message: "string"
* message: "Hi!"
* }, {
* role: Cohere.ChatMessageRole.Chatbot,
* message: "How can I help you today?"
* }],
* promptTruncation: Cohere.ChatRequestPromptTruncation.Off,
* connectors: [{
* id: "string"
* }],
* citationQuality: Cohere.ChatRequestCitationQuality.Fast,
* temperature: 0.3,
* searchOptions: {},
* promptOverride: {}
* }
Expand Down Expand Up @@ -101,6 +102,23 @@ export interface ChatRequest {
*
*/
temperature?: number;
/**
* The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.
*
*/
maxTokens?: number;
/**
* Ensures only the top `k` most likely tokens are considered for generation at each step.
* Defaults to `0`, min value of `0`, max value of `500`.
*
*/
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.75`. min value of `0.01`, max value of `0.99`.
*
*/
p?: number;
/**
* Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
*
Expand Down
17 changes: 17 additions & 0 deletions src/api/client/requests/ChatStreamRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ export interface ChatStreamRequest {
*
*/
temperature?: number;
/**
* The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.
*
*/
maxTokens?: number;
/**
* Ensures only the top `k` most likely tokens are considered for generation at each step.
* Defaults to `0`, min value of `0`, max value of `500`.
*
*/
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.75`. min value of `0.01`, max value of `0.99`.
*
*/
p?: number;
/**
* Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
*
Expand Down
36 changes: 33 additions & 3 deletions src/api/client/requests/ClassifyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,38 @@ import * as Cohere from "../..";
/**
* @example
* {
* inputs: [],
* examples: [{}],
* inputs: ["Confirm your email address", "hey i need u to send some $"],
* examples: [{
* text: "Dermatologists don't like her!",
* label: "Spam"
* }, {
* text: "Hello, open to this?",
* label: "Spam"
* }, {
* text: "I need help please wire me $1000 right now",
* label: "Spam"
* }, {
* text: "Nice to know you ;)",
* label: "Spam"
* }, {
* text: "Please help me?",
* label: "Spam"
* }, {
* text: "Your parcel will be delivered today",
* label: "Not spam"
* }, {
* text: "Review changes to our Terms and Conditions",
* label: "Not spam"
* }, {
* text: "Weekly sync notes",
* label: "Not spam"
* }, {
* text: "Re: Follow up from today\u2019s meeting",
* label: "Not spam"
* }, {
* text: "Pre-read for tomorrow",
* label: "Not spam"
* }],
* preset: "my-preset-a58sbd",
* truncate: Cohere.ClassifyRequestTruncate.None
* }
Expand All @@ -24,7 +54,7 @@ export interface ClassifyRequest {
* An array of examples to provide context to the model. Each example is a text string and its associated label/class. Each unique label requires at least 2 examples associated with it; the maximum number of examples is 2500, and each example has a maximum length of 512 tokens. The values should be structured as `{text: "...",label: "..."}`.
* Note: [Fine-tuned Models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly.
*/
examples: Cohere.ClassifyRequestExamplesItem[];
examples: Cohere.ClassifyExample[];
/** The identifier of the model. Currently available models are `embed-multilingual-v2.0`, `embed-english-light-v2.0`, and `embed-english-v2.0` (default). Smaller "light" models are faster, while larger models will perform better. [Fine-tuned models](https://docs.cohere.com/docs/fine-tuning) can also be supplied with their full ID. */
model?: string;
/** The ID of a custom playground preset. You can create presets in the [playground](https://dashboard.cohere.ai/playground/classify?model=large). If you use a preset, all other parameters become optional, and any included parameters will override the preset's parameters. */
Expand Down
2 changes: 1 addition & 1 deletion src/api/client/requests/DetokenizeRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* @example
* {
* tokens: []
* tokens: [10104, 12221, 1315, 34, 1420, 69]
* }
*/
export interface DetokenizeRequest {
Expand Down
2 changes: 1 addition & 1 deletion src/api/client/requests/EmbedRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface EmbedRequest {
* * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for only v3 models.
* * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models.
*/
embeddingTypes?: string[];
embeddingTypes?: Cohere.EmbedRequestEmbeddingTypesItem[];
/**
* One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.
*
Expand Down
3 changes: 2 additions & 1 deletion src/api/client/requests/RerankRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import * as Cohere from "../..";
/**
* @example
* {
* query: "string",
* model: "rerank-english-v2.0",
* query: "What is the capital of the United States?",
* documents: []
* }
*/
Expand Down
2 changes: 1 addition & 1 deletion src/api/client/requests/SummarizeRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as Cohere from "../..";
/**
* @example
* {
* text: "string",
* text: "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. It may be made from milk or cream and is flavoured with a sweetener, either sugar or an alternative, and a spice, such as cocoa or vanilla, or with fruit such as strawberries or peaches. It can also be made by whisking a flavored cream base and liquid nitrogen together. Food coloring is sometimes added, in addition to stabilizers. The mixture is cooled below the freezing point of water and stirred to incorporate air spaces and to prevent detectable ice crystals from forming. The result is a smooth, semi-solid foam that is solid at very low temperatures (below 2 \u00B0C or 35 \u00B0F). It becomes more malleable as its temperature increases.\n\nThe meaning of the name \"ice cream\" varies from one country to another. In some countries, such as the United States, \"ice cream\" applies only to a specific variety, and most governments regulate the commercial use of the various terms according to the relative quantities of the main ingredients, notably the amount of cream. Products that do not meet the criteria to be called ice cream are sometimes labelled \"frozen dairy dessert\" instead. In other countries, such as Italy and Argentina, one word is used fo\r all variants. Analogues made from dairy alternatives, such as goat's or sheep's milk, or milk substitutes (e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are lactose intolerant, allergic to dairy protein or vegan.",
* length: Cohere.SummarizeRequestLength.Short,
* format: Cohere.SummarizeRequestFormat.Paragraph,
* extractiveness: Cohere.SummarizeRequestExtractiveness.Low
Expand Down
3 changes: 2 additions & 1 deletion src/api/client/requests/TokenizeRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
/**
* @example
* {
* text: "string"
* text: "tokenize me! :D",
* model: "command"
* }
*/
export interface TokenizeRequest {
Expand Down
Loading

0 comments on commit 5d51ad7

Please sign in to comment.