diff --git a/package.json b/package.json index a4908eb..3f4507e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cohere-ai", - "version": "7.6.2", + "version": "7.7.0", "private": false, "repository": "https://github.com/cohere-ai/cohere-typescript", "main": "./index.js", diff --git a/src/Client.ts b/src/Client.ts index b9eb515..3baaf57 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -9,12 +9,15 @@ import * as serializers from "./serialization"; import urlJoin from "url-join"; import * as stream from "stream"; import * as errors from "./errors"; +import { Datasets } from "./api/resources/datasets/client/Client"; import { Connectors } from "./api/resources/connectors/client/Client"; +import { EmbedJobs } from "./api/resources/embedJobs/client/Client"; export declare namespace CohereClient { interface Options { environment?: core.Supplier; token: core.Supplier; + clientName?: core.Supplier; } interface RequestOptions { @@ -28,8 +31,8 @@ export class CohereClient { /** * The `chat` endpoint allows users to have conversations with a Large Language Model (LLM) from Cohere. Users can send messages as part of a persisted conversation using the `conversation_id` parameter, or they can pass in their own conversation history using the `chat_history` parameter. - * The endpoint features additional parameters such as [connectors](https://docs.cohere.com/docs/connectors) and `documents` that enable conversations enriched by external knowledge. We call this "Retrieval Augmented Generation", or "RAG". * + * The endpoint features additional parameters such as [connectors](https://docs.cohere.com/docs/connectors) and `documents` that enable conversations enriched by external knowledge. We call this ["Retrieval Augmented Generation"](https://docs.cohere.com/docs/retrieval-augmented-generation-rag), or "RAG". For a full breakdown of the Chat API endpoint, document and connector modes, and streaming (with code samples), see [this guide](https://docs.cohere.com/docs/cochat-beta). */ public async chatStream( request: Cohere.ChatStreamRequest, @@ -43,15 +46,16 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", - body: { - ...(await serializers.ChatStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" })), - stream: true, - }, + body: await serializers.ChatStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), responseType: "streaming", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -96,8 +100,8 @@ export class CohereClient { /** * The `chat` endpoint allows users to have conversations with a Large Language Model (LLM) from Cohere. Users can send messages as part of a persisted conversation using the `conversation_id` parameter, or they can pass in their own conversation history using the `chat_history` parameter. - * The endpoint features additional parameters such as [connectors](https://docs.cohere.com/docs/connectors) and `documents` that enable conversations enriched by external knowledge. We call this "Retrieval Augmented Generation", or "RAG". * + * The endpoint features additional parameters such as [connectors](https://docs.cohere.com/docs/connectors) and `documents` that enable conversations enriched by external knowledge. We call this ["Retrieval Augmented Generation"](https://docs.cohere.com/docs/retrieval-augmented-generation-rag), or "RAG". For a full breakdown of the Chat API endpoint, document and connector modes, and streaming (with code samples), see [this guide](https://docs.cohere.com/docs/cochat-beta). */ public async chat( request: Cohere.ChatRequest, @@ -111,15 +115,16 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", - body: { - ...(await serializers.ChatRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" })), - stream: false, - }, + body: await serializers.ChatRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); @@ -155,6 +160,80 @@ export class CohereClient { } } + /** + * This endpoint generates realistic text conditioned on a given input. + */ + public async generateStream( + request: Cohere.GenerateStreamRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise> { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/generate" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "application/json", + body: await serializers.GenerateStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + responseType: "streaming", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return new core.Stream({ + stream: _response.body, + terminator: "\n", + parse: async (data) => { + return await serializers.GenerateStreamedResponse.parseOrThrow(data, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + }, + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + /** * This endpoint generates realistic text conditioned on a given input. * @throws {@link Cohere.BadRequestError} @@ -172,9 +251,13 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", body: await serializers.GenerateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -241,9 +324,13 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", body: await serializers.EmbedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -304,9 +391,13 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", body: await serializers.RerankRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -347,7 +438,7 @@ export class CohereClient { /** * This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference. - * Note: [Custom Models](/training-representation-models) trained on classification examples don't require the `examples` parameter to be passed in explicitly. + * 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. * @throws {@link Cohere.BadRequestError} * @throws {@link Cohere.InternalServerError} */ @@ -363,9 +454,13 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", body: await serializers.ClassifyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -431,9 +526,13 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", body: await serializers.DetectLanguageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -487,9 +586,13 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", body: await serializers.SummarizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -545,9 +648,13 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", body: await serializers.TokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -608,9 +715,13 @@ export class CohereClient { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", body: await serializers.DetokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -649,12 +760,24 @@ export class CohereClient { } } + protected _datasets: Datasets | undefined; + + public get datasets(): Datasets { + return (this._datasets ??= new Datasets(this._options)); + } + protected _connectors: Connectors | undefined; public get connectors(): Connectors { return (this._connectors ??= new Connectors(this._options)); } + protected _embedJobs: EmbedJobs | undefined; + + public get embedJobs(): EmbedJobs { + return (this._embedJobs ??= new EmbedJobs(this._options)); + } + protected async _getAuthorizationHeader() { return `Bearer ${await core.Supplier.get(this._options.token)}`; } diff --git a/src/api/client/requests/ChatRequest.ts b/src/api/client/requests/ChatRequest.ts index 1df70dc..e834788 100644 --- a/src/api/client/requests/ChatRequest.ts +++ b/src/api/client/requests/ChatRequest.ts @@ -13,7 +13,9 @@ export interface ChatRequest { message: string; /** * Defaults to `command`. - * The identifier of the model, which can be one of the existing Cohere models or the full ID for a [finetuned custom model](/docs/training-custom-models). + * + * The identifier of the model, which can be one of the existing Cohere models or the full ID for a [fine-tuned custom model](https://docs.cohere.com/docs/chat-fine-tuning). + * * Compatible Cohere models are `command` and `command-light` as well as the experimental `command-nightly` and `command-light-nightly` variants. Read more about [Cohere models](https://docs.cohere.com/docs/models). * */ @@ -30,26 +32,32 @@ export interface ChatRequest { chatHistory?: Cohere.ChatMessage[]; /** * An alternative to `chat_history`. Previous conversations can be resumed by providing the conversation's identifier. The contents of `message` and the model's response will be stored as part of this conversation. + * * If a conversation with this id does not already exist, a new conversation will be created. * */ conversationId?: string; /** * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. + * * Dictates how the prompt will be constructed. + * * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. + * * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. * */ promptTruncation?: Cohere.ChatRequestPromptTruncation; /** * Accepts `{"id": "web-search"}`, and/or the `"id"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/docs/creating-and-deploying-a-connector) one. + * * When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG). * */ connectors?: Cohere.ChatConnector[]; /** * Defaults to `false`. + * * When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated. * */ @@ -61,12 +69,14 @@ export interface ChatRequest { documents?: Cohere.ChatDocument[]; /** * Defaults to `"accurate"`. + * * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results or `"fast"` results. * */ citationQuality?: Cohere.ChatRequestCitationQuality; /** - * Defaults to `0.3` + * Defaults to `0.3`. + * * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations. * */ diff --git a/src/api/client/requests/ChatStreamRequest.ts b/src/api/client/requests/ChatStreamRequest.ts index 6e33887..43c322e 100644 --- a/src/api/client/requests/ChatStreamRequest.ts +++ b/src/api/client/requests/ChatStreamRequest.ts @@ -13,7 +13,9 @@ export interface ChatStreamRequest { message: string; /** * Defaults to `command`. - * The identifier of the model, which can be one of the existing Cohere models or the full ID for a [finetuned custom model](/docs/training-custom-models). + * + * The identifier of the model, which can be one of the existing Cohere models or the full ID for a [fine-tuned custom model](https://docs.cohere.com/docs/chat-fine-tuning). + * * Compatible Cohere models are `command` and `command-light` as well as the experimental `command-nightly` and `command-light-nightly` variants. Read more about [Cohere models](https://docs.cohere.com/docs/models). * */ @@ -30,26 +32,32 @@ export interface ChatStreamRequest { chatHistory?: Cohere.ChatMessage[]; /** * An alternative to `chat_history`. Previous conversations can be resumed by providing the conversation's identifier. The contents of `message` and the model's response will be stored as part of this conversation. + * * If a conversation with this id does not already exist, a new conversation will be created. * */ conversationId?: string; /** * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. + * * Dictates how the prompt will be constructed. + * * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. + * * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. * */ promptTruncation?: Cohere.ChatStreamRequestPromptTruncation; /** * Accepts `{"id": "web-search"}`, and/or the `"id"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/docs/creating-and-deploying-a-connector) one. + * * When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG). * */ connectors?: Cohere.ChatConnector[]; /** * Defaults to `false`. + * * When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated. * */ @@ -61,12 +69,14 @@ export interface ChatStreamRequest { documents?: Cohere.ChatDocument[]; /** * Defaults to `"accurate"`. + * * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results or `"fast"` results. * */ citationQuality?: Cohere.ChatStreamRequestCitationQuality; /** - * Defaults to `0.3` + * Defaults to `0.3`. + * * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations. * */ diff --git a/src/api/client/requests/ClassifyRequest.ts b/src/api/client/requests/ClassifyRequest.ts index e39c962..f3540a4 100644 --- a/src/api/client/requests/ClassifyRequest.ts +++ b/src/api/client/requests/ClassifyRequest.ts @@ -5,14 +5,18 @@ import * as Cohere from "../.."; export interface ClassifyRequest { - /** Represents a list of queries to be classified, each entry must not be empty. The maximum is 96 inputs. */ + /** + * A list of up to 96 texts to be classified. Each one must be a non-empty string. + * There is, however, no consistent, universal limit to the length a particular input can be. We perform classification on the first `x` tokens of each input, and `x` varies depending on which underlying model is powering classification. The maximum token length for each model is listed in the "max tokens" column [here](https://docs.cohere.com/docs/models). + * Note: by default the `truncate` parameter is set to `END`, so tokens exceeding the limit will be automatically dropped. This behavior can be disabled by setting `truncate` to `NONE`, which will result in validation errors for longer texts. + */ inputs: string[]; /** * 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: [Custom Models](/training-representation-models) trained on classification examples don't require the `examples` parameter to be passed in explicitly. + * 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[]; - /** 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. [Custom models](/docs/training-custom-models) can also be supplied with their full ID. */ + /** 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. */ preset?: string; diff --git a/src/api/client/requests/EmbedRequest.ts b/src/api/client/requests/EmbedRequest.ts index f81dded..35cc797 100644 --- a/src/api/client/requests/EmbedRequest.ts +++ b/src/api/client/requests/EmbedRequest.ts @@ -24,15 +24,7 @@ export interface EmbedRequest { * * `embed-multilingual-v2.0` 768 */ model?: string; - /** - * Specifies the type of input you're giving to the model. Not required for older versions of the embedding models (i.e. anything lower than v3), but is required for more recent versions (i.e. anything bigger than v2). - * - * * `"search_document"`: Use this when you encode documents for embeddings that you store in a vector database for search use-cases. - * * `"search_query"`: Use this when you query your vector DB to find relevant documents. - * * `"classification"`: Use this when you use the embeddings as an input to a text classifier. - * * `"clustering"`: Use this when you want to cluster the embeddings. - */ - inputType?: string; + inputType?: Cohere.EmbedInputType; /** * Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types. * diff --git a/src/api/client/requests/GenerateRequest.ts b/src/api/client/requests/GenerateRequest.ts index a78e837..fe29cef 100644 --- a/src/api/client/requests/GenerateRequest.ts +++ b/src/api/client/requests/GenerateRequest.ts @@ -21,17 +21,6 @@ export interface GenerateRequest { * */ numGenerations?: number; - /** - * When `true`, the response will be a JSON stream of events. Streaming is beneficial for user interfaces that render the contents of the response piece by piece, as it gets generated. - * - * The final event will contain the complete response, and will contain an `is_finished` field set to `true`. The event will also contain a `finish_reason`, which can be one of the following: - * - `COMPLETE` - the model sent back a finished reply - * - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens for its context length - * - `ERROR` - something went wrong when generating the reply - * - `ERROR_TOXIC` - the model generated a reply that was deemed toxic - * - */ - stream?: boolean; /** * The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. * diff --git a/src/api/client/requests/GenerateStreamRequest.ts b/src/api/client/requests/GenerateStreamRequest.ts new file mode 100644 index 0000000..8c6860c --- /dev/null +++ b/src/api/client/requests/GenerateStreamRequest.ts @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../.."; + +export interface GenerateStreamRequest { + /** + * The input text that serves as the starting point for generating the response. + * Note: The prompt will be pre-processed and modified before reaching the model. + * + */ + prompt: string; + /** + * The identifier of the model to generate with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental). + * Smaller, "light" models are faster, while larger models will perform better. [Custom models](/docs/training-custom-models) can also be supplied with their full ID. + */ + model?: string; + /** + * The maximum number of generations that will be returned. Defaults to `1`, min value of `1`, max value of `5`. + * + */ + numGenerations?: 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. + * + * This parameter is off by default, and if it's not specified, the model will continue generating until it emits an EOS completion token. See [BPE Tokens](/bpe-tokens-wiki) for more details. + * + * Can only be set to `0` if `return_likelihoods` is set to `ALL` to get the likelihood of the prompt. + * + */ + maxTokens?: number; + /** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ + truncate?: Cohere.GenerateStreamRequestTruncate; + /** + * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations. See [Temperature](/temperature-wiki) for more details. + * Defaults to `0.75`, min value of `0.0`, max value of `5.0`. + * + */ + temperature?: number; + /** + * Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.ai/playground/generate). + * When a preset is specified, the `prompt` parameter becomes optional, and any included parameters will override the preset's parameters. + * + */ + preset?: string; + /** The generated text will be cut at the beginning of the earliest occurrence of an end sequence. The sequence will be excluded from the text. */ + endSequences?: string[]; + /** The generated text will be cut at the end of the earliest occurrence of a stop sequence. The sequence will be included the text. */ + stopSequences?: string[]; + /** + * 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.' + * + */ + frequencyPenalty?: number; + /** Defaults to `0.0`, min value of `0.0`, max value of `1.0`. Can be used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. */ + presencePenalty?: number; + /** + * One of `GENERATION|ALL|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. + * + * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. + * + * If `ALL` is selected, the token likelihoods will be provided both for the prompt and the generated text. + */ + returnLikelihoods?: Cohere.GenerateStreamRequestReturnLikelihoods; + /** + * 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. + * + * Note: logit bias may not be supported for all custom models. + */ + logitBias?: Record; +} diff --git a/src/api/client/requests/index.ts b/src/api/client/requests/index.ts index f881ade..72d990c 100644 --- a/src/api/client/requests/index.ts +++ b/src/api/client/requests/index.ts @@ -1,5 +1,6 @@ export { ChatStreamRequest } from "./ChatStreamRequest"; export { ChatRequest } from "./ChatRequest"; +export { GenerateStreamRequest } from "./GenerateStreamRequest"; export { GenerateRequest } from "./GenerateRequest"; export { EmbedRequest } from "./EmbedRequest"; export { RerankRequest } from "./RerankRequest"; diff --git a/src/api/index.ts b/src/api/index.ts index dba65ab..d5c609c 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,4 +1,4 @@ +export * from "./resources"; export * from "./types"; export * from "./errors"; -export * from "./resources"; export * from "./client"; diff --git a/src/api/resources/connectors/client/Client.ts b/src/api/resources/connectors/client/Client.ts index b53b510..09dd3f2 100644 --- a/src/api/resources/connectors/client/Client.ts +++ b/src/api/resources/connectors/client/Client.ts @@ -13,6 +13,7 @@ export declare namespace Connectors { interface Options { environment?: core.Supplier; token: core.Supplier; + clientName?: core.Supplier; } interface RequestOptions { @@ -25,7 +26,7 @@ export class Connectors { constructor(protected readonly _options: Connectors.Options) {} /** - * Returns a list of connectors ordered by descending creation date (newer first). + * Returns a list of connectors ordered by descending creation date (newer first). See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information. * @throws {@link Cohere.BadRequestError} * @throws {@link Cohere.InternalServerError} * @@ -35,7 +36,7 @@ export class Connectors { public async list( request: Cohere.ConnectorsListRequest = {}, requestOptions?: Connectors.RequestOptions - ): Promise { + ): Promise { const { limit, offset } = request; const _queryParams: Record = {}; if (limit != null) { @@ -54,9 +55,13 @@ export class Connectors { method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", queryParameters: _queryParams, @@ -64,7 +69,7 @@ export class Connectors { maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return await serializers.ListResponse.parseOrThrow(_response.body, { + return await serializers.ListConnectorsResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -103,16 +108,15 @@ export class Connectors { } /** - * Creates a new connector. The connector is tested during registration - * and will cancel registration when the test is unsuccessful. + * Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/docs/creating-and-deploying-a-connector) for more information. * @throws {@link Cohere.BadRequestError} * @throws {@link Cohere.ForbiddenError} * @throws {@link Cohere.InternalServerError} */ public async create( - request: Cohere.CreateRequest, + request: Cohere.CreateConnectorRequest, requestOptions?: Connectors.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, @@ -121,17 +125,21 @@ export class Connectors { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", - body: await serializers.CreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + body: await serializers.CreateConnectorRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return await serializers.CreateResponse.parseOrThrow(_response.body, { + return await serializers.CreateConnectorResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -172,12 +180,12 @@ export class Connectors { } /** - * Retrieve a connector by ID. + * Retrieve a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information. * @throws {@link Cohere.BadRequestError} * @throws {@link Cohere.NotFoundError} * @throws {@link Cohere.InternalServerError} */ - public async get(id: string, requestOptions?: Connectors.RequestOptions): Promise { + public async get(id: string, requestOptions?: Connectors.RequestOptions): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, @@ -186,16 +194,20 @@ export class Connectors { method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return await serializers.GetResponse.parseOrThrow(_response.body, { + return await serializers.GetConnectorResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -236,7 +248,7 @@ export class Connectors { } /** - * Delete a connector by ID. + * Delete a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information. * @throws {@link Cohere.BadRequestError} * @throws {@link Cohere.ForbiddenError} * @throws {@link Cohere.NotFoundError} @@ -245,7 +257,10 @@ export class Connectors { * @example * await cohere.connectors.delete("id") */ - public async delete(id: string, requestOptions?: Connectors.RequestOptions): Promise { + public async delete( + id: string, + requestOptions?: Connectors.RequestOptions + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, @@ -254,16 +269,20 @@ export class Connectors { method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return await serializers.DeleteResponse.parseOrThrow(_response.body, { + return await serializers.DeleteConnectorResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -306,7 +325,7 @@ export class Connectors { } /** - * Update a connector by ID. Omitted fields will not be updated. + * Update a connector by ID. Omitted fields will not be updated. See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information. * @throws {@link Cohere.BadRequestError} * @throws {@link Cohere.ForbiddenError} * @throws {@link Cohere.NotFoundError} @@ -314,9 +333,9 @@ export class Connectors { */ public async update( id: string, - request: Cohere.UpdateRequest = {}, + request: Cohere.UpdateConnectorRequest = {}, requestOptions?: Connectors.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, @@ -325,17 +344,21 @@ export class Connectors { method: "PATCH", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", - body: await serializers.UpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + body: await serializers.UpdateConnectorRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return await serializers.UpdateResponse.parseOrThrow(_response.body, { + return await serializers.UpdateConnectorResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -378,18 +401,25 @@ export class Connectors { } /** - * Authorize the connector with the given ID for the connector oauth app. + * Authorize the connector with the given ID for the connector oauth app. See ['Connector Authentication'](https://docs.cohere.com/docs/connector-authentication) for more information. * @throws {@link Cohere.BadRequestError} * @throws {@link Cohere.NotFoundError} * @throws {@link Cohere.InternalServerError} * * @example - * await cohere.connectors.oAuthAuthorize("id") + * await cohere.connectors.oAuthAuthorize("id", {}) */ public async oAuthAuthorize( id: string, + request: Cohere.ConnectorsOAuthAuthorizeRequest = {}, requestOptions?: Connectors.RequestOptions ): Promise { + const { afterTokenRedirect } = request; + const _queryParams: Record = {}; + if (afterTokenRedirect != null) { + _queryParams["after_token_redirect"] = afterTokenRedirect; + } + const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, @@ -398,11 +428,16 @@ export class Connectors { method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.6.2", + "X-Fern-SDK-Version": "7.7.0", }, contentType: "application/json", + queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); diff --git a/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts b/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts new file mode 100644 index 0000000..d3a9c10 --- /dev/null +++ b/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ConnectorsOAuthAuthorizeRequest { + /** + * The URL to redirect to after the connector has been authorized. + */ + afterTokenRedirect?: string; +} diff --git a/src/api/resources/connectors/client/requests/CreateRequest.ts b/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts similarity index 95% rename from src/api/resources/connectors/client/requests/CreateRequest.ts rename to src/api/resources/connectors/client/requests/CreateConnectorRequest.ts index ee8f4e1..275a439 100644 --- a/src/api/resources/connectors/client/requests/CreateRequest.ts +++ b/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts @@ -4,7 +4,7 @@ import * as Cohere from "../../../.."; -export interface CreateRequest { +export interface CreateConnectorRequest { /** A human-readable name for the connector. */ name: string; /** A description of the connector. */ diff --git a/src/api/resources/connectors/client/requests/UpdateRequest.ts b/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts similarity index 94% rename from src/api/resources/connectors/client/requests/UpdateRequest.ts rename to src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts index 8c08600..8c96ac7 100644 --- a/src/api/resources/connectors/client/requests/UpdateRequest.ts +++ b/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts @@ -4,7 +4,7 @@ import * as Cohere from "../../../.."; -export interface UpdateRequest { +export interface UpdateConnectorRequest { /** A human-readable name for the connector. */ name?: string; /** The URL of the connector that will be used to search for documents. */ diff --git a/src/api/resources/connectors/client/requests/index.ts b/src/api/resources/connectors/client/requests/index.ts index 40c97bf..ee526b6 100644 --- a/src/api/resources/connectors/client/requests/index.ts +++ b/src/api/resources/connectors/client/requests/index.ts @@ -1,3 +1,4 @@ export { ConnectorsListRequest } from "./ConnectorsListRequest"; -export { CreateRequest } from "./CreateRequest"; -export { UpdateRequest } from "./UpdateRequest"; +export { CreateConnectorRequest } from "./CreateConnectorRequest"; +export { UpdateConnectorRequest } from "./UpdateConnectorRequest"; +export { ConnectorsOAuthAuthorizeRequest } from "./ConnectorsOAuthAuthorizeRequest"; diff --git a/src/api/resources/datasets/client/Client.ts b/src/api/resources/datasets/client/Client.ts new file mode 100644 index 0000000..02c9604 --- /dev/null +++ b/src/api/resources/datasets/client/Client.ts @@ -0,0 +1,359 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Cohere from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; +import * as fs from "fs"; +import { default as FormData } from "form-data"; + +export declare namespace Datasets { + interface Options { + environment?: core.Supplier; + token: core.Supplier; + clientName?: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Datasets { + constructor(protected readonly _options: Datasets.Options) {} + + /** + * List datasets that have been created. + * + * @example + * await cohere.datasets.list({}) + */ + public async list( + request: Cohere.DatasetsListRequest = {}, + requestOptions?: Datasets.RequestOptions + ): Promise { + const { datasetType, before, after, limit, offset } = request; + const _queryParams: Record = {}; + if (datasetType != null) { + _queryParams["datasetType"] = datasetType; + } + + if (before != null) { + _queryParams["before"] = before.toISOString(); + } + + if (after != null) { + _queryParams["after"] = after.toISOString(); + } + + if (limit != null) { + _queryParams["limit"] = limit; + } + + if (offset != null) { + _queryParams["offset"] = offset; + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/datasets" + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.DatasetsListResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a dataset by uploading a file. See ['Dataset Creation'](https://docs.cohere.com/docs/datasets#dataset-creation) for more information. + */ + public async create( + data: File | fs.ReadStream, + evalData: File | fs.ReadStream, + requestOptions?: Datasets.RequestOptions + ): Promise { + const _request = new FormData(); + _request.append("data", data); + _request.append("eval_data", evalData); + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/datasets" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "multipart/form-data; boundary=" + _request.getBoundary(), + body: _request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.DatasetsCreateResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * View the dataset storage usage for your Organization. Each Organization can have up to 10GB of storage across all their users. + * + * @example + * await cohere.datasets.getUsage() + */ + public async getUsage(requestOptions?: Datasets.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/datasets/usage" + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.DatasetsGetUsageResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve a dataset by ID. See ['Datasets'](https://docs.cohere.com/docs/datasets) for more information. + * + * @example + * await cohere.datasets.get("id") + */ + public async get(id: string, requestOptions?: Datasets.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + `v1/datasets/${id}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.DatasetsGetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete a dataset by ID. Datasets are automatically deleted after 30 days, but they can also be deleted manually. + * + * @example + * await cohere.datasets.delete("id") + */ + public async delete(id: string, requestOptions?: Datasets.RequestOptions): Promise> { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + `v1/datasets/${id}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.datasets.delete.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.token)}`; + } +} diff --git a/src/api/resources/datasets/client/index.ts b/src/api/resources/datasets/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/datasets/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts b/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts new file mode 100644 index 0000000..a4b022e --- /dev/null +++ b/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../.."; + +export interface DatasetsCreateRequest { + /** + * The name of the uploaded dataset. + */ + name?: string; + /** + * The dataset type, which is used to validate the data. + */ + type?: Cohere.DatasetType; + /** + * Indicates if the original file should be stored. + */ + keepOriginalFile?: boolean; + /** + * Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field. + */ + skipMalformedInput?: boolean; + /** + * List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `keep_fields` are missing from the uploaded file, Dataset validation will fail. + */ + keepFields?: string | string[]; + /** + * List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, Datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `optional_fields` are missing from the uploaded file, Dataset validation will pass. + */ + optionalFields?: string | string[]; + /** + * Raw .txt uploads will be split into entries using the text_separator value. + */ + textSeparator?: string; + /** + * The delimiter used for .csv uploads. + */ + csvDelimiter?: string; +} diff --git a/src/api/resources/datasets/client/requests/DatasetsListRequest.ts b/src/api/resources/datasets/client/requests/DatasetsListRequest.ts new file mode 100644 index 0000000..4a59770 --- /dev/null +++ b/src/api/resources/datasets/client/requests/DatasetsListRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface DatasetsListRequest { + /** + * optional filter by dataset type + */ + datasetType?: string; + /** + * optional filter before a date + */ + before?: Date; + /** + * optional filter after a date + */ + after?: Date; + /** + * optional limit to number of results + */ + limit?: string; + /** + * optional offset to start of results + */ + offset?: string; +} diff --git a/src/api/resources/datasets/client/requests/index.ts b/src/api/resources/datasets/client/requests/index.ts new file mode 100644 index 0000000..f548905 --- /dev/null +++ b/src/api/resources/datasets/client/requests/index.ts @@ -0,0 +1,2 @@ +export { DatasetsListRequest } from "./DatasetsListRequest"; +export { DatasetsCreateRequest } from "./DatasetsCreateRequest"; diff --git a/src/api/resources/datasets/index.ts b/src/api/resources/datasets/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/datasets/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/datasets/types/DatasetsCreateResponse.ts b/src/api/resources/datasets/types/DatasetsCreateResponse.ts new file mode 100644 index 0000000..5090b75 --- /dev/null +++ b/src/api/resources/datasets/types/DatasetsCreateResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DatasetsCreateResponse { + /** The dataset ID */ + id?: string; +} diff --git a/src/api/resources/datasets/types/DatasetsGetResponse.ts b/src/api/resources/datasets/types/DatasetsGetResponse.ts new file mode 100644 index 0000000..7da5b93 --- /dev/null +++ b/src/api/resources/datasets/types/DatasetsGetResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../.."; + +export interface DatasetsGetResponse { + dataset?: Cohere.Dataset; +} diff --git a/src/api/resources/datasets/types/DatasetsGetUsageResponse.ts b/src/api/resources/datasets/types/DatasetsGetUsageResponse.ts new file mode 100644 index 0000000..b5de7b9 --- /dev/null +++ b/src/api/resources/datasets/types/DatasetsGetUsageResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DatasetsGetUsageResponse { + /** The total number of bytes used by the organization. */ + organizationUsage?: string; +} diff --git a/src/api/resources/datasets/types/DatasetsListResponse.ts b/src/api/resources/datasets/types/DatasetsListResponse.ts new file mode 100644 index 0000000..3ce3e15 --- /dev/null +++ b/src/api/resources/datasets/types/DatasetsListResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../.."; + +export interface DatasetsListResponse { + datasets?: Cohere.Dataset[]; +} diff --git a/src/api/resources/datasets/types/index.ts b/src/api/resources/datasets/types/index.ts new file mode 100644 index 0000000..54dc414 --- /dev/null +++ b/src/api/resources/datasets/types/index.ts @@ -0,0 +1,4 @@ +export * from "./DatasetsListResponse"; +export * from "./DatasetsCreateResponse"; +export * from "./DatasetsGetUsageResponse"; +export * from "./DatasetsGetResponse"; diff --git a/src/api/resources/embedJobs/client/Client.ts b/src/api/resources/embedJobs/client/Client.ts new file mode 100644 index 0000000..908f093 --- /dev/null +++ b/src/api/resources/embedJobs/client/Client.ts @@ -0,0 +1,301 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Cohere from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace EmbedJobs { + interface Options { + environment?: core.Supplier; + token: core.Supplier; + clientName?: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class EmbedJobs { + constructor(protected readonly _options: EmbedJobs.Options) {} + + /** + * The list embed job endpoint allows users to view all embed jobs history for that specific user. + * @throws {@link Cohere.BadRequestError} + * @throws {@link Cohere.InternalServerError} + * + * @example + * await cohere.embedJobs.list() + */ + public async list(requestOptions?: EmbedJobs.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/embed-jobs" + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ListEmbedJobResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This API launches an async Embed job for a [Dataset](https://docs.cohere.com/docs/datasets) of type `embed-input`. The result of a completed embed job is new Dataset of type `embed-output`, which contains the original text entries and the corresponding embeddings. + * @throws {@link Cohere.BadRequestError} + * @throws {@link Cohere.InternalServerError} + */ + public async create( + request: Cohere.CreateEmbedJobRequest, + requestOptions?: EmbedJobs.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/embed-jobs" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "application/json", + body: await serializers.CreateEmbedJobRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.CreateEmbedJobResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This API retrieves the details about an embed job started by the same user. + * @throws {@link Cohere.BadRequestError} + * @throws {@link Cohere.NotFoundError} + * @throws {@link Cohere.InternalServerError} + */ + public async get(id: string, requestOptions?: EmbedJobs.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + `v1/embed-jobs/${id}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.EmbedJob.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 404: + throw new Cohere.NotFoundError(_response.error.body); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This API allows users to cancel an active embed job. Once invoked, the embedding process will be terminated, and users will be charged for the embeddings processed up to the cancellation point. It's important to note that partial results will not be available to users after cancellation. + * @throws {@link Cohere.BadRequestError} + * @throws {@link Cohere.NotFoundError} + * @throws {@link Cohere.InternalServerError} + * + * @example + * await cohere.embedJobs.cancel("id") + */ + public async cancel(id: string, requestOptions?: EmbedJobs.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + `v1/embed-jobs/${id}/cancel` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.7.0", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 404: + throw new Cohere.NotFoundError(_response.error.body); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.token)}`; + } +} diff --git a/src/api/resources/embedJobs/client/index.ts b/src/api/resources/embedJobs/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/embedJobs/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts b/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts new file mode 100644 index 0000000..634e249 --- /dev/null +++ b/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../.."; + +export interface CreateEmbedJobRequest { + /** + * ID of the embedding model. + * + * Available models and corresponding embedding dimensions: + * + * - `embed-english-v3.0` : 1024 + * - `embed-multilingual-v3.0` : 1024 + * - `embed-english-light-v3.0` : 384 + * - `embed-multilingual-light-v3.0` : 384 + * + */ + model: string; + /** ID of a [Dataset](https://docs.cohere.com/docs/datasets). The Dataset must be of type `embed-input` and must have a validation status `Validated` */ + datasetId: string; + inputType: Cohere.EmbedInputType; + /** The name of the embed job. */ + name?: string; + /** + * One of `START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + */ + truncate?: Cohere.CreateEmbedJobRequestTruncate; +} diff --git a/src/api/resources/embedJobs/client/requests/index.ts b/src/api/resources/embedJobs/client/requests/index.ts new file mode 100644 index 0000000..91c845d --- /dev/null +++ b/src/api/resources/embedJobs/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateEmbedJobRequest } from "./CreateEmbedJobRequest"; diff --git a/src/api/resources/embedJobs/index.ts b/src/api/resources/embedJobs/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/embedJobs/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts b/src/api/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts new file mode 100644 index 0000000..711e8c6 --- /dev/null +++ b/src/api/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + */ +export type CreateEmbedJobRequestTruncate = "START" | "END"; + +export const CreateEmbedJobRequestTruncate = { + Start: "START", + End: "END", +} as const; diff --git a/src/api/resources/embedJobs/types/index.ts b/src/api/resources/embedJobs/types/index.ts new file mode 100644 index 0000000..f6698e4 --- /dev/null +++ b/src/api/resources/embedJobs/types/index.ts @@ -0,0 +1 @@ +export * from "./CreateEmbedJobRequestTruncate"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 6efb964..43a42b6 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,2 +1,8 @@ +export * as datasets from "./datasets"; +export * from "./datasets/types"; +export * as embedJobs from "./embedJobs"; +export * from "./embedJobs/types"; export * as connectors from "./connectors"; +export * from "./datasets/client/requests"; export * from "./connectors/client/requests"; +export * from "./embedJobs/client/requests"; diff --git a/src/api/types/ApiMeta.ts b/src/api/types/ApiMeta.ts index 2f0de32..5e0cefb 100644 --- a/src/api/types/ApiMeta.ts +++ b/src/api/types/ApiMeta.ts @@ -6,5 +6,6 @@ import * as Cohere from ".."; export interface ApiMeta { apiVersion?: Cohere.ApiMetaApiVersion; + billedUnits?: Cohere.ApiMetaBilledUnits; warnings?: string[]; } diff --git a/src/api/types/ApiMetaApiVersion.ts b/src/api/types/ApiMetaApiVersion.ts index 6d44941..44f1591 100644 --- a/src/api/types/ApiMetaApiVersion.ts +++ b/src/api/types/ApiMetaApiVersion.ts @@ -2,11 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from ".."; - export interface ApiMetaApiVersion { version: string; isDeprecated?: boolean; isExperimental?: boolean; - billedUnits?: Cohere.ApiMetaApiVersionBilledUnits; } diff --git a/src/api/types/ApiMetaApiVersionBilledUnits.ts b/src/api/types/ApiMetaApiVersionBilledUnits.ts deleted file mode 100644 index 9328bd9..0000000 --- a/src/api/types/ApiMetaApiVersionBilledUnits.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ApiMetaApiVersionBilledUnits { - /** - * The number of billed input tokens. - * - */ - inputTokens?: number; - /** - * The number of billed output tokens. - * - */ - outputTokens?: number; - /** - * The number of billed search units. - * - */ - searchUnits?: number; - /** - * The number of billed classifications units. - * - */ - classifications?: number; -} diff --git a/src/api/types/ApiMetaBilledUnits.ts b/src/api/types/ApiMetaBilledUnits.ts new file mode 100644 index 0000000..ffaf597 --- /dev/null +++ b/src/api/types/ApiMetaBilledUnits.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ApiMetaBilledUnits { + /** The number of billed input tokens. */ + inputTokens?: number; + /** The number of billed output tokens. */ + outputTokens?: number; + /** The number of billed search units. */ + searchUnits?: number; + /** The number of billed classifications units. */ + classifications?: number; +} diff --git a/src/api/types/AuthTokenType.ts b/src/api/types/AuthTokenType.ts new file mode 100644 index 0000000..02bcc6a --- /dev/null +++ b/src/api/types/AuthTokenType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The token_type specifies the way the token is passed in the Authorization header. Valid values are "bearer", "basic", and "noscheme". + */ +export type AuthTokenType = "bearer" | "basic" | "noscheme"; + +export const AuthTokenType = { + Bearer: "bearer", + Basic: "basic", + Noscheme: "noscheme", +} as const; diff --git a/src/api/types/ChatCitation.ts b/src/api/types/ChatCitation.ts index a1791b2..05a8972 100644 --- a/src/api/types/ChatCitation.ts +++ b/src/api/types/ChatCitation.ts @@ -4,27 +4,14 @@ /** * A section of the generated reply which cites external knowledge. - * */ export interface ChatCitation { - /** - * The index of text that the citation starts at, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have a start value of `7`. This is because the citation starts at `w`, which is the seventh character. - * - */ + /** The index of text that the citation starts at, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have a start value of `7`. This is because the citation starts at `w`, which is the seventh character. */ start: number; - /** - * The index of text that the citation ends after, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have an end value of `11`. This is because the citation ends after `d`, which is the eleventh character. - * - */ + /** The index of text that the citation ends after, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have an end value of `11`. This is because the citation ends after `d`, which is the eleventh character. */ end: number; - /** - * The text of the citation. For example, a generation of `Hello, world!` with a citation of `world` would have a text value of `world`. - * - */ + /** The text of the citation. For example, a generation of `Hello, world!` with a citation of `world` would have a text value of `world`. */ text: string; - /** - * Identifiers of documents cited by this section of the generated reply. - * - */ + /** Identifiers of documents cited by this section of the generated reply. */ documentIds: string[]; } diff --git a/src/api/types/ChatCitationGenerationEvent.ts b/src/api/types/ChatCitationGenerationEvent.ts index 13fe719..4eb495d 100644 --- a/src/api/types/ChatCitationGenerationEvent.ts +++ b/src/api/types/ChatCitationGenerationEvent.ts @@ -5,9 +5,6 @@ import * as Cohere from ".."; export interface ChatCitationGenerationEvent extends Cohere.ChatStreamEvent { - /** - * Citations for the generated reply. - * - */ + /** Citations for the generated reply. */ citations: Cohere.ChatCitation[]; } diff --git a/src/api/types/ChatConnector.ts b/src/api/types/ChatConnector.ts index ecab2d2..1643fca 100644 --- a/src/api/types/ChatConnector.ts +++ b/src/api/types/ChatConnector.ts @@ -4,23 +4,13 @@ /** * The connector used for fetching documents. - * */ export interface ChatConnector { - /** - * The identifier of the connector. Currently only 'web-search' is supported. - * - */ + /** The identifier of the connector. Currently only 'web-search' is supported. */ id: string; - /** - * An optional override to set the token that Cohere passes to the connector in the Authorization header. - * - */ + /** An optional override to set the token that Cohere passes to the connector in the Authorization header. */ userAccessToken?: string; - /** - * An optional override to set whether or not the request continues if this connector fails. - * - */ + /** An optional override to set whether or not the request continues if this connector fails. */ continueOnFailure?: boolean; /** * Provides the connector with different settings at request time. The key/value pairs of this object are specific to each connector. @@ -31,9 +21,9 @@ export interface ChatConnector { * * **site** - The web search results will be restricted to this domain (and TLD) when specified. Only a single domain is specified, and subdomains are also accepted. * Examples: - * * `{"options": {"site": "cohere.com"}}` would restrict the results to all subdomains at cohere.com - * * `{"options": {"site": "txt.cohere.com"}}` would restrict the results to `txt.cohere.com` * + * - `{"options": {"site": "cohere.com"}}` would restrict the results to all subdomains at cohere.com + * - `{"options": {"site": "txt.cohere.com"}}` would restrict the results to `txt.cohere.com` */ options?: Record; } diff --git a/src/api/types/ChatDocument.ts b/src/api/types/ChatDocument.ts index 2adb94e..267a0c8 100644 --- a/src/api/types/ChatDocument.ts +++ b/src/api/types/ChatDocument.ts @@ -7,6 +7,5 @@ * The contents of each document are generally short (under 300 words), and are passed in the form of a * dictionary of strings. Some suggested keys are "text", "author", "date". Both the key name and the value will be * passed to the model. - * */ export type ChatDocument = Record; diff --git a/src/api/types/ChatMessage.ts b/src/api/types/ChatMessage.ts index 4444225..0006e5e 100644 --- a/src/api/types/ChatMessage.ts +++ b/src/api/types/ChatMessage.ts @@ -6,7 +6,6 @@ import * as Cohere from ".."; /** * A single message in a chat history. Contains the role of the sender, the text contents of the message, and optionally a username. - * */ export interface ChatMessage { role: Cohere.ChatMessageRole; diff --git a/src/api/types/ChatRequestCitationQuality.ts b/src/api/types/ChatRequestCitationQuality.ts index 321d604..26db0c1 100644 --- a/src/api/types/ChatRequestCitationQuality.ts +++ b/src/api/types/ChatRequestCitationQuality.ts @@ -4,8 +4,8 @@ /** * Defaults to `"accurate"`. - * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results or `"fast"` results. * + * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results or `"fast"` results. */ export type ChatRequestCitationQuality = "fast" | "accurate"; diff --git a/src/api/types/ChatRequestPromptTruncation.ts b/src/api/types/ChatRequestPromptTruncation.ts index 18f0858..9bf2a52 100644 --- a/src/api/types/ChatRequestPromptTruncation.ts +++ b/src/api/types/ChatRequestPromptTruncation.ts @@ -4,10 +4,12 @@ /** * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. + * * Dictates how the prompt will be constructed. + * * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. - * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. * + * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. */ export type ChatRequestPromptTruncation = "OFF" | "AUTO"; diff --git a/src/api/types/ChatSearchQuery.ts b/src/api/types/ChatSearchQuery.ts index 528a92f..48ea2f7 100644 --- a/src/api/types/ChatSearchQuery.ts +++ b/src/api/types/ChatSearchQuery.ts @@ -4,17 +4,10 @@ /** * The generated search query. Contains the text of the query and a unique identifier for the query. - * */ export interface ChatSearchQuery { - /** - * The text of the search query. - * - */ + /** The text of the search query. */ text: string; - /** - * Unique identifier for the generated search query. Useful for submitting feedback. - * - */ + /** Unique identifier for the generated search query. Useful for submitting feedback. */ generationId: string; } diff --git a/src/api/types/ChatSearchResult.ts b/src/api/types/ChatSearchResult.ts index abdbfde..831d10d 100644 --- a/src/api/types/ChatSearchResult.ts +++ b/src/api/types/ChatSearchResult.ts @@ -6,14 +6,8 @@ import * as Cohere from ".."; export interface ChatSearchResult { searchQuery: Cohere.ChatSearchQuery; - /** - * The connector from which this result comes from. - * - */ + /** The connector from which this result comes from. */ connector: Cohere.ChatConnector; - /** - * Identifiers of documents found by this search query. - * - */ + /** Identifiers of documents found by this search query. */ documentIds: string[]; } diff --git a/src/api/types/ChatSearchResultsEvent.ts b/src/api/types/ChatSearchResultsEvent.ts index 3128659..3059ebd 100644 --- a/src/api/types/ChatSearchResultsEvent.ts +++ b/src/api/types/ChatSearchResultsEvent.ts @@ -5,14 +5,8 @@ import * as Cohere from ".."; export interface ChatSearchResultsEvent extends Cohere.ChatStreamEvent { - /** - * Conducted searches and the ids of documents retrieved from each of them. - * - */ + /** Conducted searches and the ids of documents retrieved from each of them. */ searchResults: Cohere.ChatSearchResult[]; - /** - * Documents fetched from searches or provided by the user. - * - */ + /** Documents fetched from searches or provided by the user. */ documents: Cohere.ChatDocument[]; } diff --git a/src/api/types/ChatStreamEndEvent.ts b/src/api/types/ChatStreamEndEvent.ts index 6413e46..ebebe2a 100644 --- a/src/api/types/ChatStreamEndEvent.ts +++ b/src/api/types/ChatStreamEndEvent.ts @@ -11,12 +11,8 @@ export interface ChatStreamEndEvent extends Cohere.ChatStreamEvent { * - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens specified by the max_tokens parameter * - `ERROR` - something went wrong when generating the reply * - `ERROR_TOXIC` - the model generated a reply that was deemed toxic - * */ finishReason: Cohere.ChatStreamEndEventFinishReason; - /** - * The consolidated response from the model. Contains the generated reply and all the other information streamed back in the previous events. - * - */ + /** The consolidated response from the model. Contains the generated reply and all the other information streamed back in the previous events. */ response: Cohere.ChatStreamEndEventResponse; } diff --git a/src/api/types/ChatStreamEndEventFinishReason.ts b/src/api/types/ChatStreamEndEventFinishReason.ts index 62a4390..8e94503 100644 --- a/src/api/types/ChatStreamEndEventFinishReason.ts +++ b/src/api/types/ChatStreamEndEventFinishReason.ts @@ -8,7 +8,6 @@ * - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens specified by the max_tokens parameter * - `ERROR` - something went wrong when generating the reply * - `ERROR_TOXIC` - the model generated a reply that was deemed toxic - * */ export type ChatStreamEndEventFinishReason = "COMPLETE" | "ERROR_LIMIT" | "MAX_TOKENS" | "ERROR" | "ERROR_TOXIC"; diff --git a/src/api/types/ChatStreamEndEventResponse.ts b/src/api/types/ChatStreamEndEventResponse.ts index dd5a740..032a1e1 100644 --- a/src/api/types/ChatStreamEndEventResponse.ts +++ b/src/api/types/ChatStreamEndEventResponse.ts @@ -6,6 +6,5 @@ import * as Cohere from ".."; /** * The consolidated response from the model. Contains the generated reply and all the other information streamed back in the previous events. - * */ export type ChatStreamEndEventResponse = Cohere.NonStreamedChatResponse | Cohere.SearchQueriesOnlyResponse; diff --git a/src/api/types/ChatStreamRequestCitationQuality.ts b/src/api/types/ChatStreamRequestCitationQuality.ts index 0da1a17..682cae6 100644 --- a/src/api/types/ChatStreamRequestCitationQuality.ts +++ b/src/api/types/ChatStreamRequestCitationQuality.ts @@ -4,8 +4,8 @@ /** * Defaults to `"accurate"`. - * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results or `"fast"` results. * + * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results or `"fast"` results. */ export type ChatStreamRequestCitationQuality = "fast" | "accurate"; diff --git a/src/api/types/ChatStreamRequestPromptTruncation.ts b/src/api/types/ChatStreamRequestPromptTruncation.ts index 432b2fc..a050772 100644 --- a/src/api/types/ChatStreamRequestPromptTruncation.ts +++ b/src/api/types/ChatStreamRequestPromptTruncation.ts @@ -4,10 +4,12 @@ /** * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. + * * Dictates how the prompt will be constructed. + * * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. - * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. * + * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. */ export type ChatStreamRequestPromptTruncation = "OFF" | "AUTO"; diff --git a/src/api/types/ChatStreamStartEvent.ts b/src/api/types/ChatStreamStartEvent.ts index fbb7280..c6f8296 100644 --- a/src/api/types/ChatStreamStartEvent.ts +++ b/src/api/types/ChatStreamStartEvent.ts @@ -5,9 +5,6 @@ import * as Cohere from ".."; export interface ChatStreamStartEvent extends Cohere.ChatStreamEvent { - /** - * Unique identifier for the generated reply. Useful for submitting feedback. - * - */ + /** Unique identifier for the generated reply. Useful for submitting feedback. */ generationId: string; } diff --git a/src/api/types/ChatTextGenerationEvent.ts b/src/api/types/ChatTextGenerationEvent.ts index 9e3ca9f..2c00192 100644 --- a/src/api/types/ChatTextGenerationEvent.ts +++ b/src/api/types/ChatTextGenerationEvent.ts @@ -5,9 +5,6 @@ import * as Cohere from ".."; export interface ChatTextGenerationEvent extends Cohere.ChatStreamEvent { - /** - * The next batch of text generated by the model. - * - */ + /** The next batch of text generated by the model. */ text: string; } diff --git a/src/api/types/ConnectorOAuth.ts b/src/api/types/ConnectorOAuth.ts index 880ff59..ba3fcd0 100644 --- a/src/api/types/ConnectorOAuth.ts +++ b/src/api/types/ConnectorOAuth.ts @@ -4,9 +4,9 @@ export interface ConnectorOAuth { /** The OAuth 2.0 /authorize endpoint to use when users authorize the connector. */ - authorizeUrl?: string; + authorizeUrl: string; /** The OAuth 2.0 /token endpoint to use when users authorize the connector. */ - tokenUrl?: string; + tokenUrl: string; /** The OAuth scopes to request when users authorize the connector. */ scope?: string; } diff --git a/src/api/types/CreateConnectorOAuth.ts b/src/api/types/CreateConnectorOAuth.ts index f4b782f..a90ab6c 100644 --- a/src/api/types/CreateConnectorOAuth.ts +++ b/src/api/types/CreateConnectorOAuth.ts @@ -4,13 +4,13 @@ export interface CreateConnectorOAuth { /** The OAuth 2.0 client ID. This fields is encrypted at rest. */ - clientId: string; + clientId?: string; /** The OAuth 2.0 client Secret. This field is encrypted at rest and never returned in a response. */ - clientSecret: string; + clientSecret?: string; /** The OAuth 2.0 /authorize endpoint to use when users authorize the connector. */ - authorizeUrl: string; + authorizeUrl?: string; /** The OAuth 2.0 /token endpoint to use when users authorize the connector. */ - tokenUrl: string; + tokenUrl?: string; /** The OAuth scopes to request when users authorize the connector. */ scope?: string; } diff --git a/src/api/types/GetResponse.ts b/src/api/types/CreateConnectorResponse.ts similarity index 76% rename from src/api/types/GetResponse.ts rename to src/api/types/CreateConnectorResponse.ts index 0d8cd4b..3661e46 100644 --- a/src/api/types/GetResponse.ts +++ b/src/api/types/CreateConnectorResponse.ts @@ -4,6 +4,6 @@ import * as Cohere from ".."; -export interface GetResponse { +export interface CreateConnectorResponse { connector: Cohere.Connector; } diff --git a/src/api/types/CreateConnectorServiceAuth.ts b/src/api/types/CreateConnectorServiceAuth.ts index 367edd3..1c8cfb1 100644 --- a/src/api/types/CreateConnectorServiceAuth.ts +++ b/src/api/types/CreateConnectorServiceAuth.ts @@ -2,9 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as Cohere from ".."; + export interface CreateConnectorServiceAuth { - /** The token_type specifies the way the token is passed in the Authorization header. Valid values are "bearer", "basic", and "noscheme". */ - type: string; + type: Cohere.AuthTokenType; /** The token that will be used in the HTTP Authorization header when making requests to the connector. This field is encrypted at rest and never returned in a response. */ token: string; } diff --git a/src/api/types/CreateEmbedJobResponse.ts b/src/api/types/CreateEmbedJobResponse.ts new file mode 100644 index 0000000..cc44e0a --- /dev/null +++ b/src/api/types/CreateEmbedJobResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +/** + * Response from creating an embed job. + */ +export interface CreateEmbedJobResponse { + jobId: string; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/Dataset.ts b/src/api/types/Dataset.ts new file mode 100644 index 0000000..e0c3641 --- /dev/null +++ b/src/api/types/Dataset.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface Dataset { + /** The dataset ID */ + id: string; + /** The name of the dataset */ + name: string; + /** The creation date */ + createdAt: Date; + /** The last update date */ + updatedAt: Date; + /** Errors found during validation */ + validationError?: string; + /** the avro schema of the dataset */ + schema?: string; + requiredFields?: string[]; + preserveFields?: string[]; + /** the underlying files that make up the dataset */ + datasetParts?: Cohere.DatasetPart[]; + /** warnings found during validation */ + validationWarnings?: string[]; +} diff --git a/src/api/types/DatasetPart.ts b/src/api/types/DatasetPart.ts new file mode 100644 index 0000000..584bab3 --- /dev/null +++ b/src/api/types/DatasetPart.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DatasetPart { + /** The dataset part ID */ + id: string; + /** The name of the dataset part */ + name: string; + /** The download url of the file */ + url?: string; + /** The index of the file */ + index?: number; + /** The size of the file in bytes */ + sizeBytes?: number; + /** The number of rows in the file */ + numRows?: number; + /** The download url of the original file */ + originalUrl?: string; +} diff --git a/src/api/types/DatasetType.ts b/src/api/types/DatasetType.ts new file mode 100644 index 0000000..1c14e26 --- /dev/null +++ b/src/api/types/DatasetType.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of the dataset + */ +export type DatasetType = + | "embed-input" + | "embed-result" + | "cluster-result" + | "cluster-outliers" + | "reranker-finetune-input" + | "prompt-completion-finetune-input" + | "single-label-classification-finetune-input" + | "chat-finetune-input" + | "multi-label-classification-finetune-input"; + +export const DatasetType = { + EmbedInput: "embed-input", + EmbedResult: "embed-result", + ClusterResult: "cluster-result", + ClusterOutliers: "cluster-outliers", + RerankerFinetuneInput: "reranker-finetune-input", + PromptCompletionFinetuneInput: "prompt-completion-finetune-input", + SingleLabelClassificationFinetuneInput: "single-label-classification-finetune-input", + ChatFinetuneInput: "chat-finetune-input", + MultiLabelClassificationFinetuneInput: "multi-label-classification-finetune-input", +} as const; diff --git a/src/api/types/DatasetValidationStatus.ts b/src/api/types/DatasetValidationStatus.ts new file mode 100644 index 0000000..d8cd7ab --- /dev/null +++ b/src/api/types/DatasetValidationStatus.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The validation status of the dataset + */ +export type DatasetValidationStatus = "unknown" | "queued" | "processing" | "failed" | "validated" | "skipped"; + +export const DatasetValidationStatus = { + Unknown: "unknown", + Queued: "queued", + Processing: "processing", + Failed: "failed", + Validated: "validated", + Skipped: "skipped", +} as const; diff --git a/src/api/types/DeleteConnectorResponse.ts b/src/api/types/DeleteConnectorResponse.ts new file mode 100644 index 0000000..3948451 --- /dev/null +++ b/src/api/types/DeleteConnectorResponse.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type DeleteConnectorResponse = Record; diff --git a/src/api/types/EmbedInputType.ts b/src/api/types/EmbedInputType.ts new file mode 100644 index 0000000..b8898cb --- /dev/null +++ b/src/api/types/EmbedInputType.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specifies the type of input passed to the model. Required for embedding models v3 and higher. + * + * - `"search_document"`: Used for embeddings stored in a vector database for search use-cases. + * - `"search_query"`: Used for embeddings of search queries run against a vector DB to find relevant documents. + * - `"classification"`: Used for embeddings passed through a text classifier. + * - `"clustering"`: Used for the embeddings run through a clustering algorithm. + */ +export type EmbedInputType = "search_document" | "search_query" | "classification" | "clustering"; + +export const EmbedInputType = { + SearchDocument: "search_document", + SearchQuery: "search_query", + Classification: "classification", + Clustering: "clustering", +} as const; diff --git a/src/api/types/EmbedJob.ts b/src/api/types/EmbedJob.ts new file mode 100644 index 0000000..ce87ddf --- /dev/null +++ b/src/api/types/EmbedJob.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface EmbedJob { + /** ID of the embed job */ + jobId: string; + /** The name of the embed job */ + name?: string; + /** The status of the embed job */ + status: Cohere.EmbedJobStatus; + /** The creation date of the embed job */ + createdAt: Date; + /** ID of the input dataset */ + inputDatasetId: string; + /** ID of the resulting output dataset */ + outputDatasetId?: string; + /** ID of the model used to embed */ + model: string; + /** The truncation option used */ + truncate: Cohere.EmbedJobTruncate; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/EmbedJobStatus.ts b/src/api/types/EmbedJobStatus.ts new file mode 100644 index 0000000..9430302 --- /dev/null +++ b/src/api/types/EmbedJobStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The status of the embed job + */ +export type EmbedJobStatus = "processing" | "complete" | "cancelling" | "cancelled" | "failed"; + +export const EmbedJobStatus = { + Processing: "processing", + Complete: "complete", + Cancelling: "cancelling", + Cancelled: "cancelled", + Failed: "failed", +} as const; diff --git a/src/api/types/EmbedJobTruncate.ts b/src/api/types/EmbedJobTruncate.ts new file mode 100644 index 0000000..140c86a --- /dev/null +++ b/src/api/types/EmbedJobTruncate.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The truncation option used + */ +export type EmbedJobTruncate = "START" | "END"; + +export const EmbedJobTruncate = { + Start: "START", + End: "END", +} as const; diff --git a/src/api/types/FinishReason.ts b/src/api/types/FinishReason.ts new file mode 100644 index 0000000..8313cb7 --- /dev/null +++ b/src/api/types/FinishReason.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type FinishReason = "COMPLETE" | "ERROR" | "ERROR_TOXIC" | "ERROR_LIMIT" | "USER_CANCEL" | "MAX_TOKENS"; + +export const FinishReason = { + Complete: "COMPLETE", + Error: "ERROR", + ErrorToxic: "ERROR_TOXIC", + ErrorLimit: "ERROR_LIMIT", + UserCancel: "USER_CANCEL", + MaxTokens: "MAX_TOKENS", +} as const; diff --git a/src/api/types/GenerateStreamEnd.ts b/src/api/types/GenerateStreamEnd.ts new file mode 100644 index 0000000..6d5f3b6 --- /dev/null +++ b/src/api/types/GenerateStreamEnd.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface GenerateStreamEnd extends Cohere.GenerateStreamEvent { + isFinished: boolean; + finishReason?: Cohere.FinishReason; + response: Cohere.GenerateStreamEndResponse; +} diff --git a/src/api/types/GenerateStreamEndResponse.ts b/src/api/types/GenerateStreamEndResponse.ts new file mode 100644 index 0000000..1f8e842 --- /dev/null +++ b/src/api/types/GenerateStreamEndResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface GenerateStreamEndResponse { + id: string; + prompt?: string; + generations?: Cohere.SingleGenerationInStream[]; +} diff --git a/src/api/types/GenerateStreamError.ts b/src/api/types/GenerateStreamError.ts new file mode 100644 index 0000000..48d6446 --- /dev/null +++ b/src/api/types/GenerateStreamError.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface GenerateStreamError extends Cohere.GenerateStreamEvent { + /** Refers to the nth generation. Only present when `num_generations` is greater than zero. */ + index?: number; + isFinished: boolean; + finishReason: Cohere.FinishReason; + /** Error message */ + err: string; +} diff --git a/src/api/types/DeleteResponse.ts b/src/api/types/GenerateStreamEvent.ts similarity index 57% rename from src/api/types/DeleteResponse.ts rename to src/api/types/GenerateStreamEvent.ts index 0b26181..e4e1d55 100644 --- a/src/api/types/DeleteResponse.ts +++ b/src/api/types/GenerateStreamEvent.ts @@ -2,4 +2,4 @@ * This file was auto-generated by Fern from our API Definition. */ -export type DeleteResponse = Record; +export interface GenerateStreamEvent {} diff --git a/src/api/types/GenerateStreamRequestReturnLikelihoods.ts b/src/api/types/GenerateStreamRequestReturnLikelihoods.ts new file mode 100644 index 0000000..f45f254 --- /dev/null +++ b/src/api/types/GenerateStreamRequestReturnLikelihoods.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `GENERATION|ALL|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. + * + * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. + * + * If `ALL` is selected, the token likelihoods will be provided both for the prompt and the generated text. + */ +export type GenerateStreamRequestReturnLikelihoods = "GENERATION" | "ALL" | "NONE"; + +export const GenerateStreamRequestReturnLikelihoods = { + Generation: "GENERATION", + All: "ALL", + None: "NONE", +} as const; diff --git a/src/api/types/GenerateStreamRequestTruncate.ts b/src/api/types/GenerateStreamRequestTruncate.ts new file mode 100644 index 0000000..ac39cd2 --- /dev/null +++ b/src/api/types/GenerateStreamRequestTruncate.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ +export type GenerateStreamRequestTruncate = "NONE" | "START" | "END"; + +export const GenerateStreamRequestTruncate = { + None: "NONE", + Start: "START", + End: "END", +} as const; diff --git a/src/api/types/GenerateStreamText.ts b/src/api/types/GenerateStreamText.ts new file mode 100644 index 0000000..b79d138 --- /dev/null +++ b/src/api/types/GenerateStreamText.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface GenerateStreamText extends Cohere.GenerateStreamEvent { + /** A segment of text of the generation. */ + text: string; + /** Refers to the nth generation. Only present when `num_generations` is greater than zero, and only when text responses are being streamed. */ + index?: number; + isFinished: boolean; +} diff --git a/src/api/types/GenerateStreamedResponse.ts b/src/api/types/GenerateStreamedResponse.ts new file mode 100644 index 0000000..a7754bd --- /dev/null +++ b/src/api/types/GenerateStreamedResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +/** + * Response in content type stream when `stream` is `true` in the request parameters. Generation tokens are streamed with the GenerationStream response. The final response is of type GenerationFinalResponse. + */ +export type GenerateStreamedResponse = + | Cohere.GenerateStreamedResponse.TextGeneration + | Cohere.GenerateStreamedResponse.StreamEnd + | Cohere.GenerateStreamedResponse.StreamError; + +export declare namespace GenerateStreamedResponse { + interface TextGeneration extends Cohere.GenerateStreamText { + eventType: "text-generation"; + } + + interface StreamEnd extends Cohere.GenerateStreamEnd { + eventType: "stream-end"; + } + + interface StreamError extends Cohere.GenerateStreamError { + eventType: "stream-error"; + } +} diff --git a/src/api/types/UpdateResponse.ts b/src/api/types/GetConnectorResponse.ts similarity index 77% rename from src/api/types/UpdateResponse.ts rename to src/api/types/GetConnectorResponse.ts index 5aa1291..f7ef9e5 100644 --- a/src/api/types/UpdateResponse.ts +++ b/src/api/types/GetConnectorResponse.ts @@ -4,6 +4,6 @@ import * as Cohere from ".."; -export interface UpdateResponse { +export interface GetConnectorResponse { connector: Cohere.Connector; } diff --git a/src/api/types/ListResponse.ts b/src/api/types/ListConnectorsResponse.ts similarity index 77% rename from src/api/types/ListResponse.ts rename to src/api/types/ListConnectorsResponse.ts index 4fe8439..702810f 100644 --- a/src/api/types/ListResponse.ts +++ b/src/api/types/ListConnectorsResponse.ts @@ -4,6 +4,6 @@ import * as Cohere from ".."; -export interface ListResponse { +export interface ListConnectorsResponse { connectors: Cohere.Connector[]; } diff --git a/src/api/types/ListEmbedJobResponse.ts b/src/api/types/ListEmbedJobResponse.ts new file mode 100644 index 0000000..1f8dcdd --- /dev/null +++ b/src/api/types/ListEmbedJobResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ListEmbedJobResponse { + embedJobs?: Cohere.EmbedJob[]; +} diff --git a/src/api/types/SingleGenerationInStream.ts b/src/api/types/SingleGenerationInStream.ts new file mode 100644 index 0000000..5bb1394 --- /dev/null +++ b/src/api/types/SingleGenerationInStream.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface SingleGenerationInStream { + id: string; + /** Full text of the generation. */ + text: string; + /** Refers to the nth generation. Only present when `num_generations` is greater than zero. */ + index?: number; +} diff --git a/src/api/types/CreateResponse.ts b/src/api/types/UpdateConnectorResponse.ts similarity index 76% rename from src/api/types/CreateResponse.ts rename to src/api/types/UpdateConnectorResponse.ts index de27281..54bf5e7 100644 --- a/src/api/types/CreateResponse.ts +++ b/src/api/types/UpdateConnectorResponse.ts @@ -4,6 +4,6 @@ import * as Cohere from ".."; -export interface CreateResponse { +export interface UpdateConnectorResponse { connector: Cohere.Connector; } diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 77668e5..d9e8f7a 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -2,31 +2,33 @@ export * from "./ChatStreamRequestPromptTruncation"; export * from "./ChatStreamRequestCitationQuality"; export * from "./ChatRequestPromptTruncation"; export * from "./ChatRequestCitationQuality"; +export * from "./GenerateStreamRequestTruncate"; +export * from "./GenerateStreamRequestReturnLikelihoods"; export * from "./GenerateRequestTruncate"; export * from "./GenerateRequestReturnLikelihoods"; export * from "./EmbedRequestTruncate"; export * from "./EmbedResponse"; -export * from "./RerankRequestDocumentsItem"; export * from "./RerankRequestDocumentsItemText"; -export * from "./RerankResponse"; -export * from "./RerankResponseResultsItem"; +export * from "./RerankRequestDocumentsItem"; export * from "./RerankResponseResultsItemDocument"; +export * from "./RerankResponseResultsItem"; +export * from "./RerankResponse"; export * from "./ClassifyRequestExamplesItem"; export * from "./ClassifyRequestTruncate"; -export * from "./ClassifyResponse"; -export * from "./ClassifyResponseClassificationsItem"; export * from "./ClassifyResponseClassificationsItemLabelsValue"; export * from "./ClassifyResponseClassificationsItemClassificationType"; -export * from "./DetectLanguageResponse"; +export * from "./ClassifyResponseClassificationsItem"; +export * from "./ClassifyResponse"; export * from "./DetectLanguageResponseResultsItem"; +export * from "./DetectLanguageResponse"; export * from "./SummarizeRequestLength"; export * from "./SummarizeRequestFormat"; export * from "./SummarizeRequestExtractiveness"; export * from "./SummarizeResponse"; export * from "./TokenizeResponse"; export * from "./DetokenizeResponse"; -export * from "./ChatMessage"; export * from "./ChatMessageRole"; +export * from "./ChatMessage"; export * from "./ChatConnector"; export * from "./ChatDocument"; export * from "./ChatCitation"; @@ -40,27 +42,46 @@ export * from "./ChatSearchResultsEvent"; export * from "./ChatTextGenerationEvent"; export * from "./ChatCitationGenerationEvent"; export * from "./SearchQueriesOnlyResponse"; -export * from "./ChatStreamEndEvent"; export * from "./ChatStreamEndEventFinishReason"; export * from "./ChatStreamEndEventResponse"; +export * from "./ChatStreamEndEvent"; export * from "./StreamedChatResponse"; -export * from "./SingleGeneration"; export * from "./SingleGenerationTokenLikelihoodsItem"; -export * from "./ApiMeta"; +export * from "./SingleGeneration"; export * from "./ApiMetaApiVersion"; -export * from "./ApiMetaApiVersionBilledUnits"; +export * from "./ApiMetaBilledUnits"; +export * from "./ApiMeta"; export * from "./Generation"; +export * from "./GenerateStreamEvent"; +export * from "./GenerateStreamText"; +export * from "./FinishReason"; +export * from "./SingleGenerationInStream"; +export * from "./GenerateStreamEndResponse"; +export * from "./GenerateStreamEnd"; +export * from "./GenerateStreamError"; +export * from "./GenerateStreamedResponse"; +export * from "./EmbedInputType"; export * from "./EmbedFloatsResponse"; -export * from "./EmbedByTypeResponse"; export * from "./EmbedByTypeResponseEmbeddings"; +export * from "./EmbedByTypeResponse"; +export * from "./DatasetType"; +export * from "./DatasetValidationStatus"; +export * from "./DatasetPart"; +export * from "./Dataset"; export * from "./ConnectorOAuth"; -export * from "./Connector"; export * from "./ConnectorAuthStatus"; -export * from "./ListResponse"; +export * from "./Connector"; +export * from "./ListConnectorsResponse"; export * from "./CreateConnectorOAuth"; +export * from "./AuthTokenType"; export * from "./CreateConnectorServiceAuth"; -export * from "./CreateResponse"; -export * from "./GetResponse"; -export * from "./DeleteResponse"; -export * from "./UpdateResponse"; +export * from "./CreateConnectorResponse"; +export * from "./GetConnectorResponse"; +export * from "./DeleteConnectorResponse"; +export * from "./UpdateConnectorResponse"; export * from "./OAuthAuthorizeResponse"; +export * from "./EmbedJobStatus"; +export * from "./EmbedJobTruncate"; +export * from "./EmbedJob"; +export * from "./ListEmbedJobResponse"; +export * from "./CreateEmbedJobResponse"; diff --git a/src/environments.ts b/src/environments.ts index 081ded8..e4b16e4 100644 --- a/src/environments.ts +++ b/src/environments.ts @@ -3,7 +3,7 @@ */ export const CohereEnvironment = { - Production: "https://api.cohere.ai", + Production: "https://api.cohere.ai/v1", } as const; export type CohereEnvironment = typeof CohereEnvironment.Production; diff --git a/src/serialization/client/requests/EmbedRequest.ts b/src/serialization/client/requests/EmbedRequest.ts index 1dc619f..f71d753 100644 --- a/src/serialization/client/requests/EmbedRequest.ts +++ b/src/serialization/client/requests/EmbedRequest.ts @@ -10,7 +10,10 @@ export const EmbedRequest: core.serialization.Schema (await import("../..")).EmbedInputType).optional() + ), embeddingTypes: core.serialization.property( "embedding_types", core.serialization.list(core.serialization.string()).optional() @@ -22,7 +25,7 @@ export declare namespace EmbedRequest { interface Raw { texts: string[]; model?: string | null; - input_type?: string | null; + input_type?: serializers.EmbedInputType.Raw | null; embedding_types?: string[] | null; truncate?: serializers.EmbedRequestTruncate.Raw | null; } diff --git a/src/serialization/client/requests/GenerateRequest.ts b/src/serialization/client/requests/GenerateRequest.ts index 3f361d0..620669b 100644 --- a/src/serialization/client/requests/GenerateRequest.ts +++ b/src/serialization/client/requests/GenerateRequest.ts @@ -11,7 +11,6 @@ export const GenerateRequest: core.serialization.Schema (await import("../..")).GenerateRequestTruncate).optional(), temperature: core.serialization.number().optional(), @@ -43,7 +42,6 @@ export declare namespace GenerateRequest { prompt: string; model?: string | null; num_generations?: number | null; - stream?: boolean | null; max_tokens?: number | null; truncate?: serializers.GenerateRequestTruncate.Raw | null; temperature?: number | null; diff --git a/src/serialization/client/requests/GenerateStreamRequest.ts b/src/serialization/client/requests/GenerateStreamRequest.ts new file mode 100644 index 0000000..746999e --- /dev/null +++ b/src/serialization/client/requests/GenerateStreamRequest.ts @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const GenerateStreamRequest: core.serialization.Schema< + serializers.GenerateStreamRequest.Raw, + Cohere.GenerateStreamRequest +> = core.serialization.object({ + prompt: core.serialization.string(), + model: core.serialization.string().optional(), + numGenerations: core.serialization.property("num_generations", core.serialization.number().optional()), + maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), + truncate: core.serialization.lazy(async () => (await import("../..")).GenerateStreamRequestTruncate).optional(), + temperature: core.serialization.number().optional(), + preset: core.serialization.string().optional(), + endSequences: core.serialization.property( + "end_sequences", + core.serialization.list(core.serialization.string()).optional() + ), + stopSequences: core.serialization.property( + "stop_sequences", + core.serialization.list(core.serialization.string()).optional() + ), + k: core.serialization.number().optional(), + p: core.serialization.number().optional(), + frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), + presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), + returnLikelihoods: core.serialization.property( + "return_likelihoods", + core.serialization.lazy(async () => (await import("../..")).GenerateStreamRequestReturnLikelihoods).optional() + ), + logitBias: core.serialization.property( + "logit_bias", + core.serialization.record(core.serialization.string(), core.serialization.number()).optional() + ), +}); + +export declare namespace GenerateStreamRequest { + interface Raw { + prompt: string; + model?: string | null; + num_generations?: number | null; + max_tokens?: number | null; + truncate?: serializers.GenerateStreamRequestTruncate.Raw | null; + temperature?: number | null; + preset?: string | null; + end_sequences?: string[] | null; + stop_sequences?: string[] | null; + k?: number | null; + p?: number | null; + frequency_penalty?: number | null; + presence_penalty?: number | null; + return_likelihoods?: serializers.GenerateStreamRequestReturnLikelihoods.Raw | null; + logit_bias?: Record | null; + } +} diff --git a/src/serialization/client/requests/index.ts b/src/serialization/client/requests/index.ts index f881ade..72d990c 100644 --- a/src/serialization/client/requests/index.ts +++ b/src/serialization/client/requests/index.ts @@ -1,5 +1,6 @@ export { ChatStreamRequest } from "./ChatStreamRequest"; export { ChatRequest } from "./ChatRequest"; +export { GenerateStreamRequest } from "./GenerateStreamRequest"; export { GenerateRequest } from "./GenerateRequest"; export { EmbedRequest } from "./EmbedRequest"; export { RerankRequest } from "./RerankRequest"; diff --git a/src/serialization/index.ts b/src/serialization/index.ts index 848e75a..d3c5080 100644 --- a/src/serialization/index.ts +++ b/src/serialization/index.ts @@ -1,3 +1,3 @@ +export * from "./resources"; export * from "./types"; export * from "./client"; -export * from "./resources"; diff --git a/src/serialization/resources/connectors/client/requests/CreateConnectorRequest.ts b/src/serialization/resources/connectors/client/requests/CreateConnectorRequest.ts new file mode 100644 index 0000000..9cd2e06 --- /dev/null +++ b/src/serialization/resources/connectors/client/requests/CreateConnectorRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Cohere from "../../../../../api"; +import * as core from "../../../../../core"; + +export const CreateConnectorRequest: core.serialization.Schema< + serializers.CreateConnectorRequest.Raw, + Cohere.CreateConnectorRequest +> = core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string().optional(), + url: core.serialization.string(), + excludes: core.serialization.list(core.serialization.string()).optional(), + oauth: core.serialization.lazyObject(async () => (await import("../../../..")).CreateConnectorOAuth).optional(), + active: core.serialization.boolean().optional(), + continueOnFailure: core.serialization.property("continue_on_failure", core.serialization.boolean().optional()), + serviceAuth: core.serialization.property( + "service_auth", + core.serialization.lazyObject(async () => (await import("../../../..")).CreateConnectorServiceAuth).optional() + ), +}); + +export declare namespace CreateConnectorRequest { + interface Raw { + name: string; + description?: string | null; + url: string; + excludes?: string[] | null; + oauth?: serializers.CreateConnectorOAuth.Raw | null; + active?: boolean | null; + continue_on_failure?: boolean | null; + service_auth?: serializers.CreateConnectorServiceAuth.Raw | null; + } +} diff --git a/src/serialization/resources/connectors/client/requests/CreateRequest.ts b/src/serialization/resources/connectors/client/requests/CreateRequest.ts deleted file mode 100644 index d67a639..0000000 --- a/src/serialization/resources/connectors/client/requests/CreateRequest.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../.."; -import * as Cohere from "../../../../../api"; -import * as core from "../../../../../core"; - -export const CreateRequest: core.serialization.Schema = - core.serialization.object({ - name: core.serialization.string(), - description: core.serialization.string().optional(), - url: core.serialization.string(), - excludes: core.serialization.list(core.serialization.string()).optional(), - oauth: core.serialization.lazyObject(async () => (await import("../../../..")).CreateConnectorOAuth).optional(), - active: core.serialization.boolean().optional(), - continueOnFailure: core.serialization.property("continue_on_failure", core.serialization.boolean().optional()), - serviceAuth: core.serialization.property( - "service_auth", - core.serialization - .lazyObject(async () => (await import("../../../..")).CreateConnectorServiceAuth) - .optional() - ), - }); - -export declare namespace CreateRequest { - interface Raw { - name: string; - description?: string | null; - url: string; - excludes?: string[] | null; - oauth?: serializers.CreateConnectorOAuth.Raw | null; - active?: boolean | null; - continue_on_failure?: boolean | null; - service_auth?: serializers.CreateConnectorServiceAuth.Raw | null; - } -} diff --git a/src/serialization/resources/connectors/client/requests/UpdateConnectorRequest.ts b/src/serialization/resources/connectors/client/requests/UpdateConnectorRequest.ts new file mode 100644 index 0000000..5962d62 --- /dev/null +++ b/src/serialization/resources/connectors/client/requests/UpdateConnectorRequest.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Cohere from "../../../../../api"; +import * as core from "../../../../../core"; + +export const UpdateConnectorRequest: core.serialization.Schema< + serializers.UpdateConnectorRequest.Raw, + Cohere.UpdateConnectorRequest +> = core.serialization.object({ + name: core.serialization.string().optional(), + url: core.serialization.string().optional(), + excludes: core.serialization.list(core.serialization.string()).optional(), + oauth: core.serialization.lazyObject(async () => (await import("../../../..")).CreateConnectorOAuth).optional(), + active: core.serialization.boolean().optional(), + continueOnFailure: core.serialization.property("continue_on_failure", core.serialization.boolean().optional()), + serviceAuth: core.serialization.property( + "service_auth", + core.serialization.lazyObject(async () => (await import("../../../..")).CreateConnectorServiceAuth).optional() + ), +}); + +export declare namespace UpdateConnectorRequest { + interface Raw { + name?: string | null; + url?: string | null; + excludes?: string[] | null; + oauth?: serializers.CreateConnectorOAuth.Raw | null; + active?: boolean | null; + continue_on_failure?: boolean | null; + service_auth?: serializers.CreateConnectorServiceAuth.Raw | null; + } +} diff --git a/src/serialization/resources/connectors/client/requests/UpdateRequest.ts b/src/serialization/resources/connectors/client/requests/UpdateRequest.ts deleted file mode 100644 index 1821c7d..0000000 --- a/src/serialization/resources/connectors/client/requests/UpdateRequest.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../.."; -import * as Cohere from "../../../../../api"; -import * as core from "../../../../../core"; - -export const UpdateRequest: core.serialization.Schema = - core.serialization.object({ - name: core.serialization.string().optional(), - url: core.serialization.string().optional(), - excludes: core.serialization.list(core.serialization.string()).optional(), - oauth: core.serialization.lazyObject(async () => (await import("../../../..")).CreateConnectorOAuth).optional(), - active: core.serialization.boolean().optional(), - continueOnFailure: core.serialization.property("continue_on_failure", core.serialization.boolean().optional()), - serviceAuth: core.serialization.property( - "service_auth", - core.serialization - .lazyObject(async () => (await import("../../../..")).CreateConnectorServiceAuth) - .optional() - ), - }); - -export declare namespace UpdateRequest { - interface Raw { - name?: string | null; - url?: string | null; - excludes?: string[] | null; - oauth?: serializers.CreateConnectorOAuth.Raw | null; - active?: boolean | null; - continue_on_failure?: boolean | null; - service_auth?: serializers.CreateConnectorServiceAuth.Raw | null; - } -} diff --git a/src/serialization/resources/connectors/client/requests/index.ts b/src/serialization/resources/connectors/client/requests/index.ts index 64340bf..50d84c7 100644 --- a/src/serialization/resources/connectors/client/requests/index.ts +++ b/src/serialization/resources/connectors/client/requests/index.ts @@ -1,2 +1,2 @@ -export { CreateRequest } from "./CreateRequest"; -export { UpdateRequest } from "./UpdateRequest"; +export { CreateConnectorRequest } from "./CreateConnectorRequest"; +export { UpdateConnectorRequest } from "./UpdateConnectorRequest"; diff --git a/src/serialization/resources/datasets/client/delete.ts b/src/serialization/resources/datasets/client/delete.ts new file mode 100644 index 0000000..31d7bc6 --- /dev/null +++ b/src/serialization/resources/datasets/client/delete.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as core from "../../../../core"; + +export const Response: core.serialization.Schema< + serializers.datasets.delete.Response.Raw, + Record +> = core.serialization.record(core.serialization.string(), core.serialization.unknown()); + +export declare namespace Response { + type Raw = Record; +} diff --git a/src/serialization/resources/datasets/client/index.ts b/src/serialization/resources/datasets/client/index.ts new file mode 100644 index 0000000..a646657 --- /dev/null +++ b/src/serialization/resources/datasets/client/index.ts @@ -0,0 +1 @@ +export * as delete from "./delete"; diff --git a/src/serialization/resources/datasets/index.ts b/src/serialization/resources/datasets/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/datasets/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/datasets/types/DatasetsCreateResponse.ts b/src/serialization/resources/datasets/types/DatasetsCreateResponse.ts new file mode 100644 index 0000000..dbe4105 --- /dev/null +++ b/src/serialization/resources/datasets/types/DatasetsCreateResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Cohere from "../../../../api"; +import * as core from "../../../../core"; + +export const DatasetsCreateResponse: core.serialization.ObjectSchema< + serializers.DatasetsCreateResponse.Raw, + Cohere.DatasetsCreateResponse +> = core.serialization.object({ + id: core.serialization.string().optional(), +}); + +export declare namespace DatasetsCreateResponse { + interface Raw { + id?: string | null; + } +} diff --git a/src/serialization/resources/datasets/types/DatasetsGetResponse.ts b/src/serialization/resources/datasets/types/DatasetsGetResponse.ts new file mode 100644 index 0000000..c91587c --- /dev/null +++ b/src/serialization/resources/datasets/types/DatasetsGetResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Cohere from "../../../../api"; +import * as core from "../../../../core"; + +export const DatasetsGetResponse: core.serialization.ObjectSchema< + serializers.DatasetsGetResponse.Raw, + Cohere.DatasetsGetResponse +> = core.serialization.object({ + dataset: core.serialization.lazyObject(async () => (await import("../../..")).Dataset).optional(), +}); + +export declare namespace DatasetsGetResponse { + interface Raw { + dataset?: serializers.Dataset.Raw | null; + } +} diff --git a/src/serialization/resources/datasets/types/DatasetsGetUsageResponse.ts b/src/serialization/resources/datasets/types/DatasetsGetUsageResponse.ts new file mode 100644 index 0000000..1f0284f --- /dev/null +++ b/src/serialization/resources/datasets/types/DatasetsGetUsageResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Cohere from "../../../../api"; +import * as core from "../../../../core"; + +export const DatasetsGetUsageResponse: core.serialization.ObjectSchema< + serializers.DatasetsGetUsageResponse.Raw, + Cohere.DatasetsGetUsageResponse +> = core.serialization.object({ + organizationUsage: core.serialization.property("organization_usage", core.serialization.string().optional()), +}); + +export declare namespace DatasetsGetUsageResponse { + interface Raw { + organization_usage?: string | null; + } +} diff --git a/src/serialization/resources/datasets/types/DatasetsListResponse.ts b/src/serialization/resources/datasets/types/DatasetsListResponse.ts new file mode 100644 index 0000000..ea1e255 --- /dev/null +++ b/src/serialization/resources/datasets/types/DatasetsListResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Cohere from "../../../../api"; +import * as core from "../../../../core"; + +export const DatasetsListResponse: core.serialization.ObjectSchema< + serializers.DatasetsListResponse.Raw, + Cohere.DatasetsListResponse +> = core.serialization.object({ + datasets: core.serialization + .list(core.serialization.lazyObject(async () => (await import("../../..")).Dataset)) + .optional(), +}); + +export declare namespace DatasetsListResponse { + interface Raw { + datasets?: serializers.Dataset.Raw[] | null; + } +} diff --git a/src/serialization/resources/datasets/types/index.ts b/src/serialization/resources/datasets/types/index.ts new file mode 100644 index 0000000..54dc414 --- /dev/null +++ b/src/serialization/resources/datasets/types/index.ts @@ -0,0 +1,4 @@ +export * from "./DatasetsListResponse"; +export * from "./DatasetsCreateResponse"; +export * from "./DatasetsGetUsageResponse"; +export * from "./DatasetsGetResponse"; diff --git a/src/serialization/resources/embedJobs/client/index.ts b/src/serialization/resources/embedJobs/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/resources/embedJobs/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts b/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts new file mode 100644 index 0000000..e6efca8 --- /dev/null +++ b/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Cohere from "../../../../../api"; +import * as core from "../../../../../core"; + +export const CreateEmbedJobRequest: core.serialization.Schema< + serializers.CreateEmbedJobRequest.Raw, + Cohere.CreateEmbedJobRequest +> = core.serialization.object({ + model: core.serialization.string(), + datasetId: core.serialization.property("dataset_id", core.serialization.string()), + inputType: core.serialization.property( + "input_type", + core.serialization.lazy(async () => (await import("../../../..")).EmbedInputType) + ), + name: core.serialization.string().optional(), + truncate: core.serialization + .lazy(async () => (await import("../../../..")).CreateEmbedJobRequestTruncate) + .optional(), +}); + +export declare namespace CreateEmbedJobRequest { + interface Raw { + model: string; + dataset_id: string; + input_type: serializers.EmbedInputType.Raw; + name?: string | null; + truncate?: serializers.CreateEmbedJobRequestTruncate.Raw | null; + } +} diff --git a/src/serialization/resources/embedJobs/client/requests/index.ts b/src/serialization/resources/embedJobs/client/requests/index.ts new file mode 100644 index 0000000..91c845d --- /dev/null +++ b/src/serialization/resources/embedJobs/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateEmbedJobRequest } from "./CreateEmbedJobRequest"; diff --git a/src/serialization/resources/embedJobs/index.ts b/src/serialization/resources/embedJobs/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/embedJobs/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts b/src/serialization/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts new file mode 100644 index 0000000..525f4cd --- /dev/null +++ b/src/serialization/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Cohere from "../../../../api"; +import * as core from "../../../../core"; + +export const CreateEmbedJobRequestTruncate: core.serialization.Schema< + serializers.CreateEmbedJobRequestTruncate.Raw, + Cohere.CreateEmbedJobRequestTruncate +> = core.serialization.enum_(["START", "END"]); + +export declare namespace CreateEmbedJobRequestTruncate { + type Raw = "START" | "END"; +} diff --git a/src/serialization/resources/embedJobs/types/index.ts b/src/serialization/resources/embedJobs/types/index.ts new file mode 100644 index 0000000..f6698e4 --- /dev/null +++ b/src/serialization/resources/embedJobs/types/index.ts @@ -0,0 +1 @@ +export * from "./CreateEmbedJobRequestTruncate"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index 6efb964..5ac751e 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -1,2 +1,7 @@ +export * as datasets from "./datasets"; +export * from "./datasets/types"; +export * as embedJobs from "./embedJobs"; +export * from "./embedJobs/types"; export * as connectors from "./connectors"; export * from "./connectors/client/requests"; +export * from "./embedJobs/client/requests"; diff --git a/src/serialization/types/ApiMeta.ts b/src/serialization/types/ApiMeta.ts index 44bda46..d981771 100644 --- a/src/serialization/types/ApiMeta.ts +++ b/src/serialization/types/ApiMeta.ts @@ -12,12 +12,17 @@ export const ApiMeta: core.serialization.ObjectSchema (await import("..")).ApiMetaApiVersion).optional() ), + billedUnits: core.serialization.property( + "billed_units", + core.serialization.lazyObject(async () => (await import("..")).ApiMetaBilledUnits).optional() + ), warnings: core.serialization.list(core.serialization.string()).optional(), }); export declare namespace ApiMeta { interface Raw { api_version?: serializers.ApiMetaApiVersion.Raw | null; + billed_units?: serializers.ApiMetaBilledUnits.Raw | null; warnings?: string[] | null; } } diff --git a/src/serialization/types/ApiMetaApiVersion.ts b/src/serialization/types/ApiMetaApiVersion.ts index 257b257..986e8a1 100644 --- a/src/serialization/types/ApiMetaApiVersion.ts +++ b/src/serialization/types/ApiMetaApiVersion.ts @@ -13,10 +13,6 @@ export const ApiMetaApiVersion: core.serialization.ObjectSchema< version: core.serialization.string(), isDeprecated: core.serialization.property("is_deprecated", core.serialization.boolean().optional()), isExperimental: core.serialization.property("is_experimental", core.serialization.boolean().optional()), - billedUnits: core.serialization.property( - "billed_units", - core.serialization.lazyObject(async () => (await import("..")).ApiMetaApiVersionBilledUnits).optional() - ), }); export declare namespace ApiMetaApiVersion { @@ -24,6 +20,5 @@ export declare namespace ApiMetaApiVersion { version: string; is_deprecated?: boolean | null; is_experimental?: boolean | null; - billed_units?: serializers.ApiMetaApiVersionBilledUnits.Raw | null; } } diff --git a/src/serialization/types/ApiMetaApiVersionBilledUnits.ts b/src/serialization/types/ApiMetaBilledUnits.ts similarity index 77% rename from src/serialization/types/ApiMetaApiVersionBilledUnits.ts rename to src/serialization/types/ApiMetaBilledUnits.ts index b75d580..8787992 100644 --- a/src/serialization/types/ApiMetaApiVersionBilledUnits.ts +++ b/src/serialization/types/ApiMetaBilledUnits.ts @@ -6,9 +6,9 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; -export const ApiMetaApiVersionBilledUnits: core.serialization.ObjectSchema< - serializers.ApiMetaApiVersionBilledUnits.Raw, - Cohere.ApiMetaApiVersionBilledUnits +export const ApiMetaBilledUnits: core.serialization.ObjectSchema< + serializers.ApiMetaBilledUnits.Raw, + Cohere.ApiMetaBilledUnits > = core.serialization.object({ inputTokens: core.serialization.property("input_tokens", core.serialization.number().optional()), outputTokens: core.serialization.property("output_tokens", core.serialization.number().optional()), @@ -16,7 +16,7 @@ export const ApiMetaApiVersionBilledUnits: core.serialization.ObjectSchema< classifications: core.serialization.number().optional(), }); -export declare namespace ApiMetaApiVersionBilledUnits { +export declare namespace ApiMetaBilledUnits { interface Raw { input_tokens?: number | null; output_tokens?: number | null; diff --git a/src/serialization/types/AuthTokenType.ts b/src/serialization/types/AuthTokenType.ts new file mode 100644 index 0000000..eb4657c --- /dev/null +++ b/src/serialization/types/AuthTokenType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const AuthTokenType: core.serialization.Schema = + core.serialization.enum_(["bearer", "basic", "noscheme"]); + +export declare namespace AuthTokenType { + type Raw = "bearer" | "basic" | "noscheme"; +} diff --git a/src/serialization/types/ConnectorOAuth.ts b/src/serialization/types/ConnectorOAuth.ts index a5b8460..a6a84ab 100644 --- a/src/serialization/types/ConnectorOAuth.ts +++ b/src/serialization/types/ConnectorOAuth.ts @@ -8,15 +8,15 @@ import * as core from "../../core"; export const ConnectorOAuth: core.serialization.ObjectSchema = core.serialization.object({ - authorizeUrl: core.serialization.string().optional(), - tokenUrl: core.serialization.string().optional(), + authorizeUrl: core.serialization.property("authorize_url", core.serialization.string()), + tokenUrl: core.serialization.property("token_url", core.serialization.string()), scope: core.serialization.string().optional(), }); export declare namespace ConnectorOAuth { interface Raw { - authorizeUrl?: string | null; - tokenUrl?: string | null; + authorize_url: string; + token_url: string; scope?: string | null; } } diff --git a/src/serialization/types/CreateConnectorOAuth.ts b/src/serialization/types/CreateConnectorOAuth.ts index 2468540..9354dde 100644 --- a/src/serialization/types/CreateConnectorOAuth.ts +++ b/src/serialization/types/CreateConnectorOAuth.ts @@ -10,19 +10,19 @@ export const CreateConnectorOAuth: core.serialization.ObjectSchema< serializers.CreateConnectorOAuth.Raw, Cohere.CreateConnectorOAuth > = core.serialization.object({ - clientId: core.serialization.string(), - clientSecret: core.serialization.string(), - authorizeUrl: core.serialization.string(), - tokenUrl: core.serialization.string(), + clientId: core.serialization.property("client_id", core.serialization.string().optional()), + clientSecret: core.serialization.property("client_secret", core.serialization.string().optional()), + authorizeUrl: core.serialization.property("authorize_url", core.serialization.string().optional()), + tokenUrl: core.serialization.property("token_url", core.serialization.string().optional()), scope: core.serialization.string().optional(), }); export declare namespace CreateConnectorOAuth { interface Raw { - clientId: string; - clientSecret: string; - authorizeUrl: string; - tokenUrl: string; + client_id?: string | null; + client_secret?: string | null; + authorize_url?: string | null; + token_url?: string | null; scope?: string | null; } } diff --git a/src/serialization/types/CreateConnectorResponse.ts b/src/serialization/types/CreateConnectorResponse.ts new file mode 100644 index 0000000..fddc464 --- /dev/null +++ b/src/serialization/types/CreateConnectorResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const CreateConnectorResponse: core.serialization.ObjectSchema< + serializers.CreateConnectorResponse.Raw, + Cohere.CreateConnectorResponse +> = core.serialization.object({ + connector: core.serialization.lazyObject(async () => (await import("..")).Connector), +}); + +export declare namespace CreateConnectorResponse { + interface Raw { + connector: serializers.Connector.Raw; + } +} diff --git a/src/serialization/types/CreateConnectorServiceAuth.ts b/src/serialization/types/CreateConnectorServiceAuth.ts index 851f7ac..43da623 100644 --- a/src/serialization/types/CreateConnectorServiceAuth.ts +++ b/src/serialization/types/CreateConnectorServiceAuth.ts @@ -10,13 +10,13 @@ export const CreateConnectorServiceAuth: core.serialization.ObjectSchema< serializers.CreateConnectorServiceAuth.Raw, Cohere.CreateConnectorServiceAuth > = core.serialization.object({ - type: core.serialization.string(), + type: core.serialization.lazy(async () => (await import("..")).AuthTokenType), token: core.serialization.string(), }); export declare namespace CreateConnectorServiceAuth { interface Raw { - type: string; + type: serializers.AuthTokenType.Raw; token: string; } } diff --git a/src/serialization/types/CreateEmbedJobResponse.ts b/src/serialization/types/CreateEmbedJobResponse.ts new file mode 100644 index 0000000..0096281 --- /dev/null +++ b/src/serialization/types/CreateEmbedJobResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const CreateEmbedJobResponse: core.serialization.ObjectSchema< + serializers.CreateEmbedJobResponse.Raw, + Cohere.CreateEmbedJobResponse +> = core.serialization.object({ + jobId: core.serialization.property("job_id", core.serialization.string()), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), +}); + +export declare namespace CreateEmbedJobResponse { + interface Raw { + job_id: string; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/CreateResponse.ts b/src/serialization/types/CreateResponse.ts deleted file mode 100644 index 653986f..0000000 --- a/src/serialization/types/CreateResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from ".."; -import * as Cohere from "../../api"; -import * as core from "../../core"; - -export const CreateResponse: core.serialization.ObjectSchema = - core.serialization.object({ - connector: core.serialization.lazyObject(async () => (await import("..")).Connector), - }); - -export declare namespace CreateResponse { - interface Raw { - connector: serializers.Connector.Raw; - } -} diff --git a/src/serialization/types/Dataset.ts b/src/serialization/types/Dataset.ts new file mode 100644 index 0000000..2bd8ebb --- /dev/null +++ b/src/serialization/types/Dataset.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const Dataset: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + name: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + validationError: core.serialization.property("validation_error", core.serialization.string().optional()), + schema: core.serialization.string().optional(), + requiredFields: core.serialization.property( + "required_fields", + core.serialization.list(core.serialization.string()).optional() + ), + preserveFields: core.serialization.property( + "preserve_fields", + core.serialization.list(core.serialization.string()).optional() + ), + datasetParts: core.serialization.property( + "dataset_parts", + core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).DatasetPart)) + .optional() + ), + validationWarnings: core.serialization.property( + "validation_warnings", + core.serialization.list(core.serialization.string()).optional() + ), + }); + +export declare namespace Dataset { + interface Raw { + id: string; + name: string; + created_at: string; + updated_at: string; + validation_error?: string | null; + schema?: string | null; + required_fields?: string[] | null; + preserve_fields?: string[] | null; + dataset_parts?: serializers.DatasetPart.Raw[] | null; + validation_warnings?: string[] | null; + } +} diff --git a/src/serialization/types/DatasetPart.ts b/src/serialization/types/DatasetPart.ts new file mode 100644 index 0000000..9861d67 --- /dev/null +++ b/src/serialization/types/DatasetPart.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const DatasetPart: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + name: core.serialization.string(), + url: core.serialization.string().optional(), + index: core.serialization.number().optional(), + sizeBytes: core.serialization.property("size_bytes", core.serialization.number().optional()), + numRows: core.serialization.property("num_rows", core.serialization.number().optional()), + originalUrl: core.serialization.property("original_url", core.serialization.string().optional()), + }); + +export declare namespace DatasetPart { + interface Raw { + id: string; + name: string; + url?: string | null; + index?: number | null; + size_bytes?: number | null; + num_rows?: number | null; + original_url?: string | null; + } +} diff --git a/src/serialization/types/DatasetType.ts b/src/serialization/types/DatasetType.ts new file mode 100644 index 0000000..3f77fbf --- /dev/null +++ b/src/serialization/types/DatasetType.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const DatasetType: core.serialization.Schema = + core.serialization.enum_([ + "embed-input", + "embed-result", + "cluster-result", + "cluster-outliers", + "reranker-finetune-input", + "prompt-completion-finetune-input", + "single-label-classification-finetune-input", + "chat-finetune-input", + "multi-label-classification-finetune-input", + ]); + +export declare namespace DatasetType { + type Raw = + | "embed-input" + | "embed-result" + | "cluster-result" + | "cluster-outliers" + | "reranker-finetune-input" + | "prompt-completion-finetune-input" + | "single-label-classification-finetune-input" + | "chat-finetune-input" + | "multi-label-classification-finetune-input"; +} diff --git a/src/serialization/types/DatasetValidationStatus.ts b/src/serialization/types/DatasetValidationStatus.ts new file mode 100644 index 0000000..b31a964 --- /dev/null +++ b/src/serialization/types/DatasetValidationStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const DatasetValidationStatus: core.serialization.Schema< + serializers.DatasetValidationStatus.Raw, + Cohere.DatasetValidationStatus +> = core.serialization.enum_(["unknown", "queued", "processing", "failed", "validated", "skipped"]); + +export declare namespace DatasetValidationStatus { + type Raw = "unknown" | "queued" | "processing" | "failed" | "validated" | "skipped"; +} diff --git a/src/serialization/types/DeleteConnectorResponse.ts b/src/serialization/types/DeleteConnectorResponse.ts new file mode 100644 index 0000000..6d9a0e7 --- /dev/null +++ b/src/serialization/types/DeleteConnectorResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const DeleteConnectorResponse: core.serialization.Schema< + serializers.DeleteConnectorResponse.Raw, + Cohere.DeleteConnectorResponse +> = core.serialization.record(core.serialization.string(), core.serialization.unknown()); + +export declare namespace DeleteConnectorResponse { + type Raw = Record; +} diff --git a/src/serialization/types/DeleteResponse.ts b/src/serialization/types/DeleteResponse.ts deleted file mode 100644 index 49c1ff2..0000000 --- a/src/serialization/types/DeleteResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from ".."; -import * as Cohere from "../../api"; -import * as core from "../../core"; - -export const DeleteResponse: core.serialization.Schema = - core.serialization.record(core.serialization.string(), core.serialization.unknown()); - -export declare namespace DeleteResponse { - type Raw = Record; -} diff --git a/src/serialization/types/EmbedInputType.ts b/src/serialization/types/EmbedInputType.ts new file mode 100644 index 0000000..8699fd5 --- /dev/null +++ b/src/serialization/types/EmbedInputType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const EmbedInputType: core.serialization.Schema = + core.serialization.enum_(["search_document", "search_query", "classification", "clustering"]); + +export declare namespace EmbedInputType { + type Raw = "search_document" | "search_query" | "classification" | "clustering"; +} diff --git a/src/serialization/types/EmbedJob.ts b/src/serialization/types/EmbedJob.ts new file mode 100644 index 0000000..6ec569f --- /dev/null +++ b/src/serialization/types/EmbedJob.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const EmbedJob: core.serialization.ObjectSchema = + core.serialization.object({ + jobId: core.serialization.property("job_id", core.serialization.string()), + name: core.serialization.string().optional(), + status: core.serialization.lazy(async () => (await import("..")).EmbedJobStatus), + createdAt: core.serialization.property("created_at", core.serialization.date()), + inputDatasetId: core.serialization.property("input_dataset_id", core.serialization.string()), + outputDatasetId: core.serialization.property("output_dataset_id", core.serialization.string().optional()), + model: core.serialization.string(), + truncate: core.serialization.lazy(async () => (await import("..")).EmbedJobTruncate), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + }); + +export declare namespace EmbedJob { + interface Raw { + job_id: string; + name?: string | null; + status: serializers.EmbedJobStatus.Raw; + created_at: string; + input_dataset_id: string; + output_dataset_id?: string | null; + model: string; + truncate: serializers.EmbedJobTruncate.Raw; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/EmbedJobStatus.ts b/src/serialization/types/EmbedJobStatus.ts new file mode 100644 index 0000000..8ee7ecd --- /dev/null +++ b/src/serialization/types/EmbedJobStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const EmbedJobStatus: core.serialization.Schema = + core.serialization.enum_(["processing", "complete", "cancelling", "cancelled", "failed"]); + +export declare namespace EmbedJobStatus { + type Raw = "processing" | "complete" | "cancelling" | "cancelled" | "failed"; +} diff --git a/src/serialization/types/EmbedJobTruncate.ts b/src/serialization/types/EmbedJobTruncate.ts new file mode 100644 index 0000000..ec41458 --- /dev/null +++ b/src/serialization/types/EmbedJobTruncate.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const EmbedJobTruncate: core.serialization.Schema = + core.serialization.enum_(["START", "END"]); + +export declare namespace EmbedJobTruncate { + type Raw = "START" | "END"; +} diff --git a/src/serialization/types/FinishReason.ts b/src/serialization/types/FinishReason.ts new file mode 100644 index 0000000..15dd9e9 --- /dev/null +++ b/src/serialization/types/FinishReason.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const FinishReason: core.serialization.Schema = + core.serialization.enum_(["COMPLETE", "ERROR", "ERROR_TOXIC", "ERROR_LIMIT", "USER_CANCEL", "MAX_TOKENS"]); + +export declare namespace FinishReason { + type Raw = "COMPLETE" | "ERROR" | "ERROR_TOXIC" | "ERROR_LIMIT" | "USER_CANCEL" | "MAX_TOKENS"; +} diff --git a/src/serialization/types/GenerateStreamEnd.ts b/src/serialization/types/GenerateStreamEnd.ts new file mode 100644 index 0000000..2778298 --- /dev/null +++ b/src/serialization/types/GenerateStreamEnd.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateStreamEnd: core.serialization.ObjectSchema< + serializers.GenerateStreamEnd.Raw, + Cohere.GenerateStreamEnd +> = core.serialization + .object({ + isFinished: core.serialization.property("is_finished", core.serialization.boolean()), + finishReason: core.serialization.property( + "finish_reason", + core.serialization.lazy(async () => (await import("..")).FinishReason).optional() + ), + response: core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEndResponse), + }) + .extend(core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEvent)); + +export declare namespace GenerateStreamEnd { + interface Raw extends serializers.GenerateStreamEvent.Raw { + is_finished: boolean; + finish_reason?: serializers.FinishReason.Raw | null; + response: serializers.GenerateStreamEndResponse.Raw; + } +} diff --git a/src/serialization/types/GenerateStreamEndResponse.ts b/src/serialization/types/GenerateStreamEndResponse.ts new file mode 100644 index 0000000..0cf2149 --- /dev/null +++ b/src/serialization/types/GenerateStreamEndResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateStreamEndResponse: core.serialization.ObjectSchema< + serializers.GenerateStreamEndResponse.Raw, + Cohere.GenerateStreamEndResponse +> = core.serialization.object({ + id: core.serialization.string(), + prompt: core.serialization.string().optional(), + generations: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).SingleGenerationInStream)) + .optional(), +}); + +export declare namespace GenerateStreamEndResponse { + interface Raw { + id: string; + prompt?: string | null; + generations?: serializers.SingleGenerationInStream.Raw[] | null; + } +} diff --git a/src/serialization/types/GenerateStreamError.ts b/src/serialization/types/GenerateStreamError.ts new file mode 100644 index 0000000..bd01a65 --- /dev/null +++ b/src/serialization/types/GenerateStreamError.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateStreamError: core.serialization.ObjectSchema< + serializers.GenerateStreamError.Raw, + Cohere.GenerateStreamError +> = core.serialization + .object({ + index: core.serialization.number().optional(), + isFinished: core.serialization.property("is_finished", core.serialization.boolean()), + finishReason: core.serialization.property( + "finish_reason", + core.serialization.lazy(async () => (await import("..")).FinishReason) + ), + err: core.serialization.string(), + }) + .extend(core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEvent)); + +export declare namespace GenerateStreamError { + interface Raw extends serializers.GenerateStreamEvent.Raw { + index?: number | null; + is_finished: boolean; + finish_reason: serializers.FinishReason.Raw; + err: string; + } +} diff --git a/src/serialization/types/GenerateStreamEvent.ts b/src/serialization/types/GenerateStreamEvent.ts new file mode 100644 index 0000000..ce39156 --- /dev/null +++ b/src/serialization/types/GenerateStreamEvent.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateStreamEvent: core.serialization.ObjectSchema< + serializers.GenerateStreamEvent.Raw, + Cohere.GenerateStreamEvent +> = core.serialization.object({}); + +export declare namespace GenerateStreamEvent { + interface Raw {} +} diff --git a/src/serialization/types/GenerateStreamRequestReturnLikelihoods.ts b/src/serialization/types/GenerateStreamRequestReturnLikelihoods.ts new file mode 100644 index 0000000..667434d --- /dev/null +++ b/src/serialization/types/GenerateStreamRequestReturnLikelihoods.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateStreamRequestReturnLikelihoods: core.serialization.Schema< + serializers.GenerateStreamRequestReturnLikelihoods.Raw, + Cohere.GenerateStreamRequestReturnLikelihoods +> = core.serialization.enum_(["GENERATION", "ALL", "NONE"]); + +export declare namespace GenerateStreamRequestReturnLikelihoods { + type Raw = "GENERATION" | "ALL" | "NONE"; +} diff --git a/src/serialization/types/GenerateStreamRequestTruncate.ts b/src/serialization/types/GenerateStreamRequestTruncate.ts new file mode 100644 index 0000000..5a7015b --- /dev/null +++ b/src/serialization/types/GenerateStreamRequestTruncate.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateStreamRequestTruncate: core.serialization.Schema< + serializers.GenerateStreamRequestTruncate.Raw, + Cohere.GenerateStreamRequestTruncate +> = core.serialization.enum_(["NONE", "START", "END"]); + +export declare namespace GenerateStreamRequestTruncate { + type Raw = "NONE" | "START" | "END"; +} diff --git a/src/serialization/types/GenerateStreamText.ts b/src/serialization/types/GenerateStreamText.ts new file mode 100644 index 0000000..52b47ea --- /dev/null +++ b/src/serialization/types/GenerateStreamText.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateStreamText: core.serialization.ObjectSchema< + serializers.GenerateStreamText.Raw, + Cohere.GenerateStreamText +> = core.serialization + .object({ + text: core.serialization.string(), + index: core.serialization.number().optional(), + isFinished: core.serialization.property("is_finished", core.serialization.boolean()), + }) + .extend(core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEvent)); + +export declare namespace GenerateStreamText { + interface Raw extends serializers.GenerateStreamEvent.Raw { + text: string; + index?: number | null; + is_finished: boolean; + } +} diff --git a/src/serialization/types/GenerateStreamedResponse.ts b/src/serialization/types/GenerateStreamedResponse.ts new file mode 100644 index 0000000..67b9e96 --- /dev/null +++ b/src/serialization/types/GenerateStreamedResponse.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateStreamedResponse: core.serialization.Schema< + serializers.GenerateStreamedResponse.Raw, + Cohere.GenerateStreamedResponse +> = core.serialization + .union(core.serialization.discriminant("eventType", "event_type"), { + "text-generation": core.serialization.lazyObject(async () => (await import("..")).GenerateStreamText), + "stream-end": core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEnd), + "stream-error": core.serialization.lazyObject(async () => (await import("..")).GenerateStreamError), + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace GenerateStreamedResponse { + type Raw = + | GenerateStreamedResponse.TextGeneration + | GenerateStreamedResponse.StreamEnd + | GenerateStreamedResponse.StreamError; + + interface TextGeneration extends serializers.GenerateStreamText.Raw { + event_type: "text-generation"; + } + + interface StreamEnd extends serializers.GenerateStreamEnd.Raw { + event_type: "stream-end"; + } + + interface StreamError extends serializers.GenerateStreamError.Raw { + event_type: "stream-error"; + } +} diff --git a/src/serialization/types/GetConnectorResponse.ts b/src/serialization/types/GetConnectorResponse.ts new file mode 100644 index 0000000..d098e9f --- /dev/null +++ b/src/serialization/types/GetConnectorResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GetConnectorResponse: core.serialization.ObjectSchema< + serializers.GetConnectorResponse.Raw, + Cohere.GetConnectorResponse +> = core.serialization.object({ + connector: core.serialization.lazyObject(async () => (await import("..")).Connector), +}); + +export declare namespace GetConnectorResponse { + interface Raw { + connector: serializers.Connector.Raw; + } +} diff --git a/src/serialization/types/GetResponse.ts b/src/serialization/types/GetResponse.ts deleted file mode 100644 index 690b2ad..0000000 --- a/src/serialization/types/GetResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from ".."; -import * as Cohere from "../../api"; -import * as core from "../../core"; - -export const GetResponse: core.serialization.ObjectSchema = - core.serialization.object({ - connector: core.serialization.lazyObject(async () => (await import("..")).Connector), - }); - -export declare namespace GetResponse { - interface Raw { - connector: serializers.Connector.Raw; - } -} diff --git a/src/serialization/types/ListConnectorsResponse.ts b/src/serialization/types/ListConnectorsResponse.ts new file mode 100644 index 0000000..bc7d825 --- /dev/null +++ b/src/serialization/types/ListConnectorsResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ListConnectorsResponse: core.serialization.ObjectSchema< + serializers.ListConnectorsResponse.Raw, + Cohere.ListConnectorsResponse +> = core.serialization.object({ + connectors: core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).Connector)), +}); + +export declare namespace ListConnectorsResponse { + interface Raw { + connectors: serializers.Connector.Raw[]; + } +} diff --git a/src/serialization/types/ListEmbedJobResponse.ts b/src/serialization/types/ListEmbedJobResponse.ts new file mode 100644 index 0000000..915fe8c --- /dev/null +++ b/src/serialization/types/ListEmbedJobResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ListEmbedJobResponse: core.serialization.ObjectSchema< + serializers.ListEmbedJobResponse.Raw, + Cohere.ListEmbedJobResponse +> = core.serialization.object({ + embedJobs: core.serialization.property( + "embed_jobs", + core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).EmbedJob)).optional() + ), +}); + +export declare namespace ListEmbedJobResponse { + interface Raw { + embed_jobs?: serializers.EmbedJob.Raw[] | null; + } +} diff --git a/src/serialization/types/ListResponse.ts b/src/serialization/types/ListResponse.ts deleted file mode 100644 index a7d1d6e..0000000 --- a/src/serialization/types/ListResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from ".."; -import * as Cohere from "../../api"; -import * as core from "../../core"; - -export const ListResponse: core.serialization.ObjectSchema = - core.serialization.object({ - connectors: core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).Connector)), - }); - -export declare namespace ListResponse { - interface Raw { - connectors: serializers.Connector.Raw[]; - } -} diff --git a/src/serialization/types/SingleGenerationInStream.ts b/src/serialization/types/SingleGenerationInStream.ts new file mode 100644 index 0000000..48ca473 --- /dev/null +++ b/src/serialization/types/SingleGenerationInStream.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SingleGenerationInStream: core.serialization.ObjectSchema< + serializers.SingleGenerationInStream.Raw, + Cohere.SingleGenerationInStream +> = core.serialization.object({ + id: core.serialization.string(), + text: core.serialization.string(), + index: core.serialization.number().optional(), +}); + +export declare namespace SingleGenerationInStream { + interface Raw { + id: string; + text: string; + index?: number | null; + } +} diff --git a/src/serialization/types/UpdateConnectorResponse.ts b/src/serialization/types/UpdateConnectorResponse.ts new file mode 100644 index 0000000..c436baf --- /dev/null +++ b/src/serialization/types/UpdateConnectorResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const UpdateConnectorResponse: core.serialization.ObjectSchema< + serializers.UpdateConnectorResponse.Raw, + Cohere.UpdateConnectorResponse +> = core.serialization.object({ + connector: core.serialization.lazyObject(async () => (await import("..")).Connector), +}); + +export declare namespace UpdateConnectorResponse { + interface Raw { + connector: serializers.Connector.Raw; + } +} diff --git a/src/serialization/types/UpdateResponse.ts b/src/serialization/types/UpdateResponse.ts deleted file mode 100644 index 0abb480..0000000 --- a/src/serialization/types/UpdateResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from ".."; -import * as Cohere from "../../api"; -import * as core from "../../core"; - -export const UpdateResponse: core.serialization.ObjectSchema = - core.serialization.object({ - connector: core.serialization.lazyObject(async () => (await import("..")).Connector), - }); - -export declare namespace UpdateResponse { - interface Raw { - connector: serializers.Connector.Raw; - } -} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 77668e5..d9e8f7a 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -2,31 +2,33 @@ export * from "./ChatStreamRequestPromptTruncation"; export * from "./ChatStreamRequestCitationQuality"; export * from "./ChatRequestPromptTruncation"; export * from "./ChatRequestCitationQuality"; +export * from "./GenerateStreamRequestTruncate"; +export * from "./GenerateStreamRequestReturnLikelihoods"; export * from "./GenerateRequestTruncate"; export * from "./GenerateRequestReturnLikelihoods"; export * from "./EmbedRequestTruncate"; export * from "./EmbedResponse"; -export * from "./RerankRequestDocumentsItem"; export * from "./RerankRequestDocumentsItemText"; -export * from "./RerankResponse"; -export * from "./RerankResponseResultsItem"; +export * from "./RerankRequestDocumentsItem"; export * from "./RerankResponseResultsItemDocument"; +export * from "./RerankResponseResultsItem"; +export * from "./RerankResponse"; export * from "./ClassifyRequestExamplesItem"; export * from "./ClassifyRequestTruncate"; -export * from "./ClassifyResponse"; -export * from "./ClassifyResponseClassificationsItem"; export * from "./ClassifyResponseClassificationsItemLabelsValue"; export * from "./ClassifyResponseClassificationsItemClassificationType"; -export * from "./DetectLanguageResponse"; +export * from "./ClassifyResponseClassificationsItem"; +export * from "./ClassifyResponse"; export * from "./DetectLanguageResponseResultsItem"; +export * from "./DetectLanguageResponse"; export * from "./SummarizeRequestLength"; export * from "./SummarizeRequestFormat"; export * from "./SummarizeRequestExtractiveness"; export * from "./SummarizeResponse"; export * from "./TokenizeResponse"; export * from "./DetokenizeResponse"; -export * from "./ChatMessage"; export * from "./ChatMessageRole"; +export * from "./ChatMessage"; export * from "./ChatConnector"; export * from "./ChatDocument"; export * from "./ChatCitation"; @@ -40,27 +42,46 @@ export * from "./ChatSearchResultsEvent"; export * from "./ChatTextGenerationEvent"; export * from "./ChatCitationGenerationEvent"; export * from "./SearchQueriesOnlyResponse"; -export * from "./ChatStreamEndEvent"; export * from "./ChatStreamEndEventFinishReason"; export * from "./ChatStreamEndEventResponse"; +export * from "./ChatStreamEndEvent"; export * from "./StreamedChatResponse"; -export * from "./SingleGeneration"; export * from "./SingleGenerationTokenLikelihoodsItem"; -export * from "./ApiMeta"; +export * from "./SingleGeneration"; export * from "./ApiMetaApiVersion"; -export * from "./ApiMetaApiVersionBilledUnits"; +export * from "./ApiMetaBilledUnits"; +export * from "./ApiMeta"; export * from "./Generation"; +export * from "./GenerateStreamEvent"; +export * from "./GenerateStreamText"; +export * from "./FinishReason"; +export * from "./SingleGenerationInStream"; +export * from "./GenerateStreamEndResponse"; +export * from "./GenerateStreamEnd"; +export * from "./GenerateStreamError"; +export * from "./GenerateStreamedResponse"; +export * from "./EmbedInputType"; export * from "./EmbedFloatsResponse"; -export * from "./EmbedByTypeResponse"; export * from "./EmbedByTypeResponseEmbeddings"; +export * from "./EmbedByTypeResponse"; +export * from "./DatasetType"; +export * from "./DatasetValidationStatus"; +export * from "./DatasetPart"; +export * from "./Dataset"; export * from "./ConnectorOAuth"; -export * from "./Connector"; export * from "./ConnectorAuthStatus"; -export * from "./ListResponse"; +export * from "./Connector"; +export * from "./ListConnectorsResponse"; export * from "./CreateConnectorOAuth"; +export * from "./AuthTokenType"; export * from "./CreateConnectorServiceAuth"; -export * from "./CreateResponse"; -export * from "./GetResponse"; -export * from "./DeleteResponse"; -export * from "./UpdateResponse"; +export * from "./CreateConnectorResponse"; +export * from "./GetConnectorResponse"; +export * from "./DeleteConnectorResponse"; +export * from "./UpdateConnectorResponse"; export * from "./OAuthAuthorizeResponse"; +export * from "./EmbedJobStatus"; +export * from "./EmbedJobTruncate"; +export * from "./EmbedJob"; +export * from "./ListEmbedJobResponse"; +export * from "./CreateEmbedJobResponse"; diff --git a/yarn.lock b/yarn.lock index e504656..7b8409b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11,9 +11,9 @@ form-data "^4.0.0" "@types/node@*": - version "20.10.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2" - integrity sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw== + version "20.11.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.5.tgz#be10c622ca7fcaa3cf226cf80166abc31389d86e" + integrity sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w== dependencies: undici-types "~5.26.4" @@ -98,7 +98,7 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" -has-property-descriptors@^1.0.0: +has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== @@ -164,14 +164,15 @@ qs@6.11.2: side-channel "^1.0.4" set-function-length@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed" - integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ== + version "1.2.0" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.0.tgz#2f81dc6c16c7059bda5ab7c82c11f03a515ed8e1" + integrity sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w== dependencies: define-data-property "^1.1.1" - get-intrinsic "^1.2.1" + function-bind "^1.1.2" + get-intrinsic "^1.2.2" gopd "^1.0.1" - has-property-descriptors "^1.0.0" + has-property-descriptors "^1.0.1" side-channel@^1.0.4: version "1.0.4"