Skip to content

Commit

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

* Fix test

---------

Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Co-authored-by: billytrend-cohere <[email protected]>
  • Loading branch information
fern-api[bot] and billytrend-cohere authored Mar 2, 2024
1 parent 5004153 commit 9cf91a1
Show file tree
Hide file tree
Showing 47 changed files with 667 additions and 371 deletions.
2 changes: 1 addition & 1 deletion .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ banner.png
.npmignore
src/test
jest.config.js
.github/test.yml
.github/workflows/test.yml
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,21 @@ jobs:
- name: Compile
run: yarn && yarn build

test:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3

- name: Compile
run: yarn && yarn test

publish:
needs: [ compile ]
needs: [ compile, test ]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "cohere-ai",
"version": "7.7.5",
"version": "7.7.7",
"private": false,
"repository": "https://github.com/cohere-ai/cohere-typescript",
"main": "./index.js",
"types": "./index.d.ts",
"scripts": {
"format": "prettier --write 'src/**/*.ts'",
"build": "tsc",
"prepack": "cp -rv dist/. ."
"prepack": "cp -rv dist/. .",
"test": "jest"
},
"dependencies": {
"url-join": "4.0.1",
Expand All @@ -21,10 +22,11 @@
"@types/url-join": "4.0.1",
"@types/qs": "6.9.8",
"@types/node-fetch": "2.6.9",
"jest": "^29.7.0",
"@types/jest": "^29.5.5",
"ts-jest": "^29.1.2",
"@types/node": "17.0.33",
"prettier": "2.7.1",
"typescript": "4.6.4",
"jest": "^29.7.0",
"ts-jest": "^29.1.2"
"typescript": "4.6.4"
}
}
169 changes: 113 additions & 56 deletions src/Client.ts

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/api/client/requests/ChatRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import * as Cohere from "../..";
* }, {
* role: Cohere.ChatMessageRole.Chatbot,
* message: "How can I help you today?"
* }, {
* role: Cohere.ChatMessageRole.Chatbot,
* message: "message"
* }],
* promptTruncation: Cohere.ChatRequestPromptTruncation.Off,
* citationQuality: Cohere.ChatRequestCitationQuality.Fast,
* temperature: 0.3,
* searchOptions: {},
* promptOverride: {}
* temperature: 0.3
* }
*/
export interface ChatRequest {
Expand Down
7 changes: 3 additions & 4 deletions src/api/client/requests/ClassifyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as Cohere from "../..";
/**
* @example
* {
* inputs: ["Confirm your email address", "hey i need u to send some $"],
* inputs: ["Confirm your email address", "hey i need u to send some $", "inputs"],
* examples: [{
* text: "Dermatologists don't like her!",
* label: "Spam"
Expand Down Expand Up @@ -38,9 +38,8 @@ import * as Cohere from "../..";
* }, {
* text: "Pre-read for tomorrow",
* label: "Not spam"
* }],
* preset: "my-preset-a58sbd",
* truncate: Cohere.ClassifyRequestTruncate.None
* }, {}],
* preset: "my-preset-a58sbd"
* }
*/
export interface ClassifyRequest {
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: [10104, 12221, 1315, 34, 1420, 69]
* tokens: [10104, 12221, 1315, 34, 1420, 69, 1]
* }
*/
export interface DetokenizeRequest {
Expand Down
12 changes: 1 addition & 11 deletions src/api/client/requests/GenerateRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import * as Cohere from "../..";
* {
* prompt: "Please explain to me how LLMs work",
* stream: false,
* truncate: Cohere.GenerateRequestTruncate.None,
* preset: "my-preset-a58sbd",
* returnLikelihoods: Cohere.GenerateRequestReturnLikelihoods.Generation
* preset: "my-preset-a58sbd"
* }
*/
export interface GenerateRequest {
Expand Down Expand Up @@ -100,14 +98,6 @@ export interface GenerateRequest {
* If `ALL` is selected, the token likelihoods will be provided both for the prompt and the generated text.
*/
returnLikelihoods?: Cohere.GenerateRequestReturnLikelihoods;
/**
* Certain models support the `logit_bias` parameter.
*
* Used to prevent the model from generating unwanted tokens or to incentivize it to include desired tokens. The format is `{token_id: bias}` where bias is a float between -10 and 10. Tokens can be obtained from text using [Tokenize](/reference/tokenize).
*
* For example, if the value `{'11': -10}` is provided, the model will be very unlikely to include the token 11 (`"\n"`, the newline character) anywhere in the generated text. In contrast `{'11': 10}` will result in generations that nearly only contain that token. Values between -10 and 10 will proportionally affect the likelihood of the token appearing in the generated text.
*/
logitBias?: Record<string, number>;
/** When enabled, the user's prompt will be sent to the model without any pre-processing. */
rawPrompting?: boolean;
}
8 changes: 0 additions & 8 deletions src/api/client/requests/GenerateStreamRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ export interface GenerateStreamRequest {
* If `ALL` is selected, the token likelihoods will be provided both for the prompt and the generated text.
*/
returnLikelihoods?: Cohere.GenerateStreamRequestReturnLikelihoods;
/**
* Certain models support the `logit_bias` parameter.
*
* Used to prevent the model from generating unwanted tokens or to incentivize it to include desired tokens. The format is `{token_id: bias}` where bias is a float between -10 and 10. Tokens can be obtained from text using [Tokenize](/reference/tokenize).
*
* For example, if the value `{'11': -10}` is provided, the model will be very unlikely to include the token 11 (`"\n"`, the newline character) anywhere in the generated text. In contrast `{'11': 10}` will result in generations that nearly only contain that token. Values between -10 and 10 will proportionally affect the likelihood of the token appearing in the generated text.
*/
logitBias?: Record<string, number>;
/** When enabled, the user's prompt will be sent to the model without any pre-processing. */
rawPrompting?: boolean;
}
5 changes: 1 addition & 4 deletions src/api/client/requests/SummarizeRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import * as Cohere from "../..";
/**
* @example
* {
* 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
* 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."
* }
*/
export interface SummarizeRequest {
Expand Down
16 changes: 16 additions & 0 deletions src/api/errors/TooManyRequestsError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as errors from "../../errors";

export class TooManyRequestsError extends errors.CohereError {
constructor(body?: unknown) {
super({
message: "TooManyRequestsError",
statusCode: 429,
body: body,
});
Object.setPrototypeOf(this, TooManyRequestsError.prototype);
}
}
1 change: 1 addition & 0 deletions src/api/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./BadRequestError";
export * from "./ForbiddenError";
export * from "./NotFoundError";
export * from "./TooManyRequestsError";
export * from "./InternalServerError";
Loading

0 comments on commit 9cf91a1

Please sign in to comment.