diff --git a/README.md b/README.md index b790c0e..b01b0a8 100644 --- a/README.md +++ b/README.md @@ -203,7 +203,7 @@ import { GenAIChatModel } from '@ibm-generative-ai/node-sdk/langchain'; import { SystemMessage, HumanMessage } from '@langchain/core/messages'; const client = new GenAIChatModel({ - model_id: 'meta-llama/llama-2-70b-chat', + model_id: 'meta-llama/llama-3-70b-instruct', client: new Client({ endpoint: process.env.ENDPOINT, apiKey: process.env.API_KEY, diff --git a/examples/langchain/llm-chat.ts b/examples/langchain/llm-chat.ts index 130db81..795acf8 100644 --- a/examples/langchain/llm-chat.ts +++ b/examples/langchain/llm-chat.ts @@ -5,7 +5,7 @@ import { Client } from '../../src/index.js'; const makeClient = () => new GenAIChatModel({ - model_id: 'meta-llama/llama-2-70b-chat', + model_id: 'meta-llama/llama-3-70b-instruct', client: new Client({ endpoint: process.env.ENDPOINT, apiKey: process.env.API_KEY, diff --git a/examples/shared/constants.ts b/examples/shared/constants.ts index 7184bfc..b336f0d 100644 --- a/examples/shared/constants.ts +++ b/examples/shared/constants.ts @@ -1,2 +1,2 @@ export const MODEL = 'google/flan-ul2'; -export const CHAT_MODEL = 'meta-llama/llama-2-70b-chat'; +export const CHAT_MODEL = 'meta-llama/llama-3-70b-instruct'; diff --git a/package.json b/package.json index 1447ca6..abd2b40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ibm-generative-ai/node-sdk", - "version": "0.0.0", + "version": "2.0.6", "description": "IBM Generative AI Node.js SDK (Tech Preview)", "keywords": [ "ai", diff --git a/src/api/schema.d.ts b/src/api/schema.d.ts index 66c1b70..9573d43 100644 --- a/src/api/schema.d.ts +++ b/src/api/schema.d.ts @@ -5,80 +5,11 @@ export interface paths { - "/v2/text/embeddings": { - post: { - parameters: { - query: { - version: "2024-04-15"; - }; - }; - requestBody: { - content: { - "application/json": { - model_id: string; - input: string | string[]; - parameters?: ({ - truncate_input_tokens?: boolean | null; - return_options?: { - input_text?: boolean | null; - }; - }) | null; - }; - }; - }; - responses: { - /** @description Default Response */ - 200: { - content: { - "application/json": { - model_id: string; - /** Format: date-time */ - created_at: string; - results: { - embedding: number[]; - input_text?: string; - }[]; - }; - }; - }; - /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ - 400: { - content: { - "application/json": components["schemas"]["BadRequestResponse"]; - }; - }; - /** @description Unauthorized route access. */ - 401: { - content: { - "application/json": components["schemas"]["UnauthorizedResponse"]; - }; - }; - /** @description The server can not find requested resource. */ - 404: { - content: { - "application/json": components["schemas"]["NotFoundResponse"]; - }; - }; - /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ - 500: { - content: { - "application/json": components["schemas"]["InternalServerErrorResponse"]; - }; - }; - /** @description The remote server is not ready to handle the request. */ - 503: { - content: { - "application/json": components["schemas"]["UnavailableResponse"]; - }; - }; - }; - }; - }; "/v2/files/{id}": { get: { parameters: { query: { - version: "2024-04-09"; + version: "2024-05-13"; }; path: { id: string; @@ -111,6 +42,12 @@ export interface paths { descendants?: { id: string; }[]; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; + }; }; }; }; @@ -249,6 +186,12 @@ export interface paths { descendants?: { id: string; }[]; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; + }; }; }; }; @@ -303,7 +246,7 @@ export interface paths { search?: string; purpose?: "tune" | "template" | "tune_import" | "extraction" | "generic_structured"; format_id?: number; - version: "2024-04-09"; + version: "2024-05-13"; }; }; responses: { @@ -333,6 +276,12 @@ export interface paths { descendants?: { id: string; }[]; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; + }; })[]; total_count: number; }; @@ -373,7 +322,7 @@ export interface paths { post: { parameters: { query: { - version: "2024-04-09"; + version: "2024-05-13"; }; }; requestBody: { @@ -414,6 +363,12 @@ export interface paths { descendants?: { id: string; }[]; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; + }; }; }; }; @@ -457,6 +412,75 @@ export interface paths { }; }; }; + "/v2/text/embeddings": { + post: { + parameters: { + query: { + version: "2024-04-15"; + }; + }; + requestBody: { + content: { + "application/json": { + model_id: string; + input: string | string[]; + parameters?: ({ + truncate_input_tokens?: boolean | null; + return_options?: { + input_text?: boolean | null; + }; + }) | null; + }; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + model_id: string; + /** Format: date-time */ + created_at: string; + results: { + embedding: number[]; + input_text?: string; + }[]; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; "/v2/text/moderations": { post: { parameters: { @@ -577,6 +601,7 @@ export interface paths { /** * Input string * @description The input is the prompt to generate completions, passed as a string. Note: The method tokenizes the input internally. It is recommended not to leave any trailing spaces. + * @example How are you */ input?: string; /** @@ -689,6 +714,7 @@ export interface paths { /** * Stop sequences * @description Stop sequences are one or more strings which will cause the text generation to stop if/when they are produced as part of the output. Stop sequences encountered prior to the minimum number of tokens being generated will be ignored. + * @example [" and "] */ stop_sequences?: string[] | null; /** @@ -1254,6 +1280,7 @@ export interface paths { /** * Input string * @description The input is the prompt to generate completions, passed as a string. Note: The method tokenizes the input internally. It is recommended not to leave any trailing spaces. + * @example How are you */ input?: string; /** @@ -1366,6 +1393,7 @@ export interface paths { /** * Stop sequences * @description Stop sequences are one or more strings which will cause the text generation to stop if/when they are produced as part of the output. Stop sequences encountered prior to the minimum number of tokens being generated will be ignored. + * @example [" and "] */ stop_sequences?: string[] | null; /** @@ -4654,6 +4682,8 @@ export interface paths { /** Format: date-time */ finished_at?: string | null; /** Format: date-time */ + last_used_at?: string; + /** Format: date-time */ created_at: string; validation_files?: { id: string; @@ -4683,6 +4713,15 @@ export interface paths { /** Format: date-time */ timestamp: string; }[]; + validation_loss?: { + data: { + value: number; + step?: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; }; vectors?: string | null; contents?: { @@ -4822,6 +4861,8 @@ export interface paths { /** Format: date-time */ finished_at?: string | null; /** Format: date-time */ + last_used_at?: string; + /** Format: date-time */ created_at: string; validation_files?: { id: string; @@ -4851,6 +4892,15 @@ export interface paths { /** Format: date-time */ timestamp: string; }[]; + validation_loss?: { + data: { + value: number; + step?: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; }; vectors?: string | null; contents?: { @@ -4899,7 +4949,7 @@ export interface paths { }; }; }; - "/v2/tunes/import": { + "/v2/tunes/preflight": { post: { parameters: { query: { @@ -4910,7 +4960,23 @@ export interface paths { content: { "application/json": { name: string; - file_id: string; + model_id: string; + task_id: string; + training_file_ids: string[]; + validation_file_ids?: string[] | null; + evaluation_file_ids?: string[] | null; + tuning_type: string; + parameters?: ({ + batch_size?: number | null; + num_epochs?: number | null; + verbalizer?: string | null; + learning_rate?: number | null; + accumulate_steps?: number | null; + max_input_tokens?: number | null; + max_output_tokens?: number | null; + num_virtual_tokens?: number | null; + [key: string]: unknown; + }) | null; }; }; }; @@ -4920,56 +4986,11 @@ export interface paths { content: { "application/json": { result: { - id: string; - name: string; - model_id: string; - model_name: string | null; - /** @enum {string} */ - status: "initializing" | "not_started" | "pending" | "halted" | "running" | "queued" | "completed" | "failed"; - status_message?: string | null; - tuning_type: string; - parameters?: Record; - preferred: boolean; - task_id: string; - task_name: string; - /** Format: date-time */ - started_at?: string | null; - /** Format: date-time */ - finished_at?: string | null; - /** Format: date-time */ - created_at: string; - validation_files?: { - id: string; - file_name: string; - /** Format: date-time */ - created_at?: string; - }[] | null; - training_files?: { - id: string; - file_name: string; - /** Format: date-time */ - created_at?: string; - }[] | null; - evaluation_files?: { - id: string; - file_name: string; - /** Format: date-time */ - created_at?: string; - }[] | null; - datapoints?: { - loss: { - data: { - value: number; - step?: number; - epoch: number; - }; - /** Format: date-time */ - timestamp: string; - }[]; - }; - vectors?: string | null; - contents?: { - name: string; + training_file_preview?: { + [key: string]: unknown; + }[]; + validation_file_preview?: { + [key: string]: unknown; }[]; }; }; @@ -5014,23 +5035,149 @@ export interface paths { }; }; }; - "/v2/tunes": { - get: { + "/v2/tunes/import": { + post: { parameters: { query: { - limit?: number; - offset?: number; - status?: "initializing" | "not_started" | "pending" | "halted" | "running" | "queued" | "completed" | "failed"; - search?: string | null; - sort_by?: "status" | "created_at" | "name" | "id" | "model"; - direction?: "asc" | "desc"; version: "2023-11-22"; }; }; - responses: { - /** @description Default Response */ - 200: { - content: { + requestBody: { + content: { + "application/json": { + name: string; + file_id: string; + }; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: string; + name: string; + model_id: string; + model_name: string | null; + /** @enum {string} */ + status: "initializing" | "not_started" | "pending" | "halted" | "running" | "queued" | "completed" | "failed"; + status_message?: string | null; + tuning_type: string; + parameters?: Record; + preferred: boolean; + task_id: string; + task_name: string; + /** Format: date-time */ + started_at?: string | null; + /** Format: date-time */ + finished_at?: string | null; + /** Format: date-time */ + last_used_at?: string; + /** Format: date-time */ + created_at: string; + validation_files?: { + id: string; + file_name: string; + /** Format: date-time */ + created_at?: string; + }[] | null; + training_files?: { + id: string; + file_name: string; + /** Format: date-time */ + created_at?: string; + }[] | null; + evaluation_files?: { + id: string; + file_name: string; + /** Format: date-time */ + created_at?: string; + }[] | null; + datapoints?: { + loss: { + data: { + value: number; + step?: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; + validation_loss?: { + data: { + value: number; + step?: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; + }; + vectors?: string | null; + contents?: { + name: string; + }[]; + }; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; + "/v2/tunes": { + get: { + parameters: { + query: { + limit?: number; + offset?: number; + status?: "initializing" | "not_started" | "pending" | "halted" | "running" | "queued" | "completed" | "failed"; + search?: string | null; + sort_by?: "status" | "created_at" | "name" | "id" | "model"; + direction?: "asc" | "desc"; + version: "2023-11-22"; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { "application/json": { total_count: number; results: ({ @@ -5051,6 +5198,8 @@ export interface paths { /** Format: date-time */ finished_at?: string | null; /** Format: date-time */ + last_used_at?: string; + /** Format: date-time */ created_at: string; validation_files?: { id: string; @@ -5080,6 +5229,15 @@ export interface paths { /** Format: date-time */ timestamp: string; }[]; + validation_loss?: { + data: { + value: number; + step?: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; }; vectors?: string | null; contents?: { @@ -5174,6 +5332,8 @@ export interface paths { /** Format: date-time */ finished_at?: string | null; /** Format: date-time */ + last_used_at?: string; + /** Format: date-time */ created_at: string; validation_files?: { id: string; @@ -5203,6 +5363,15 @@ export interface paths { /** Format: date-time */ timestamp: string; }[]; + validation_loss?: { + data: { + value: number; + step?: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; }; vectors?: string | null; contents?: { @@ -6452,12 +6621,15 @@ export interface paths { }; }; }; - "/v2/beta/time_series/limits": { + "/v2/deployments/{id}": { get: { parameters: { query: { version: "2023-11-22"; }; + path: { + id: string; + }; }; responses: { /** @description Default Response */ @@ -6465,10 +6637,18 @@ export interface paths { content: { "application/json": { result: { - concurrency: { - limit: number; - remaining: number; - }; + id: string; + tune_id?: string | null; + /** Format: date-time */ + created_at: string; + /** Format: date-time */ + updated_at: string; + /** Format: date-time */ + deployed_at?: string; + /** @enum {string} */ + status: "queued" | "initializing" | "ready" | "failed" | "expired"; + /** Format: date-time */ + expires_at?: string; }; }; }; @@ -6485,6 +6665,18 @@ export interface paths { "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { @@ -6499,89 +6691,19 @@ export interface paths { }; }; }; - }; - "/v2/beta/time_series/forecasting": { - post: { + delete: { parameters: { query: { version: "2023-11-22"; }; - }; - requestBody: { - content: { - "application/json": { - model_id: string; - /** - * Data - * Format: byte - * @description Base64 encoded string of data. - */ - data: string; - /** - * Timestamp Column - * @description A valid column in the data that should be treated as the timestamp. - */ - timestamp_column: string; - /** - * Id Columns - * @description Columns that define a unique key for time series. - */ - id_columns?: string[]; - /** - * Target Columns - * @description An array of column headings which constitute the target variables. - */ - target_columns?: string[]; - /** - * Observable Columns - * @description An optional array of column headings which constitute the observable variables. - */ - observable_columns?: string[]; - /** - * Control Columns - * @description An optional array of column headings which constitute the control variables. - */ - control_columns?: string[]; - /** - * Conditional Columns - * @description An optional array of column headings which constitute the conditional variables. - */ - conditional_columns?: string[]; - /** - * Static Categorical Columns - * @description An optional array of column headings which constitute the static categorical variables. - */ - static_categorical_columns?: string[]; - /** - * Future Data - * Format: byte - * @description Base64 encoded string of data for future supporting features. - */ - future_data?: string; - /** - * Prediction Length - * @description The prediction length for the forecast. - */ - prediction_length?: number; - /** - * Context Length - * @description Context length of the forecast. - */ - context_length?: number; - }; + path: { + id: string; }; }; responses: { - /** @description Default Response */ - 200: { - content: { - "application/json": { - result: { - /** Format: byte */ - predictions: string; - }; - }; - }; + /** @description Success */ + 204: { + content: never; }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { @@ -6601,6 +6723,12 @@ export interface paths { "application/json": components["schemas"]["NotFoundResponse"]; }; }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { @@ -6616,7 +6744,71 @@ export interface paths { }; }; }; - "/v2/beta/text/sentence-similarity": { + "/v2/deployments": { + get: { + parameters: { + query: { + id?: string[] | string; + limit?: number; + offset?: number; + version: "2023-11-22"; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + results: ({ + id: string; + tune_id?: string | null; + /** Format: date-time */ + created_at: string; + /** Format: date-time */ + updated_at: string; + /** Format: date-time */ + deployed_at?: string; + /** @enum {string} */ + status: "queued" | "initializing" | "ready" | "failed" | "expired"; + /** Format: date-time */ + expires_at?: string; + })[]; + total_count: number; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; post: { parameters: { query: { @@ -6626,23 +6818,29 @@ export interface paths { requestBody: { content: { "application/json": { - model_id: string; - source_sentence: string; - sentences: string[]; - parameters?: ({ - truncate_input_tokens?: boolean | null; - }) | null; + tune_id: string; }; }; }; responses: { /** @description Default Response */ - 200: { + 201: { content: { "application/json": { - results: { - score: number; - }[]; + result: { + id: string; + tune_id?: string | null; + /** Format: date-time */ + created_at: string; + /** Format: date-time */ + updated_at: string; + /** Format: date-time */ + deployed_at?: string; + /** @enum {string} */ + status: "queued" | "initializing" | "ready" | "failed" | "expired"; + /** Format: date-time */ + expires_at?: string; + }; }; }; }; @@ -6664,6 +6862,12 @@ export interface paths { "application/json": components["schemas"]["NotFoundResponse"]; }; }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { @@ -6679,7 +6883,55 @@ export interface paths { }; }; }; - "/v2/beta/text/rerank": { + "/v2/beta/time_series/limits": { + get: { + parameters: { + query: { + version: "2023-11-22"; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + concurrency: { + limit: number; + remaining: number; + }; + }; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; + "/v2/beta/time_series/forecasting": { post: { parameters: { query: { @@ -6690,16 +6942,63 @@ export interface paths { content: { "application/json": { model_id: string; - query: string; - documents: string[]; - parameters?: ({ - truncate_input_tokens?: boolean | null; - return_options?: { - top_n?: number | null; - query?: boolean | null; - documents?: boolean | null; - }; - }) | null; + /** + * Data + * Format: byte + * @description Base64 encoded string of data. + */ + data: string; + /** + * Timestamp Column + * @description A valid column in the data that should be treated as the timestamp. + */ + timestamp_column: string; + /** + * Id Columns + * @description Columns that define a unique key for time series. + */ + id_columns?: string[]; + /** + * Target Columns + * @description An array of column headings which constitute the target variables. + */ + target_columns?: string[]; + /** + * Observable Columns + * @description An optional array of column headings which constitute the observable variables. + */ + observable_columns?: string[]; + /** + * Control Columns + * @description An optional array of column headings which constitute the control variables. + */ + control_columns?: string[]; + /** + * Conditional Columns + * @description An optional array of column headings which constitute the conditional variables. + */ + conditional_columns?: string[]; + /** + * Static Categorical Columns + * @description An optional array of column headings which constitute the static categorical variables. + */ + static_categorical_columns?: string[]; + /** + * Future Data + * Format: byte + * @description Base64 encoded string of data for future supporting features. + */ + future_data?: string; + /** + * Prediction Length + * @description The prediction length for the forecast. + */ + prediction_length?: number; + /** + * Context Length + * @description Context length of the forecast. + */ + context_length?: number; }; }; }; @@ -6709,10 +7008,8 @@ export interface paths { content: { "application/json": { result: { - query?: string; - results: { - score: number; - }[]; + /** Format: byte */ + predictions: string; }; }; }; @@ -6750,7 +7047,7 @@ export interface paths { }; }; }; - "/v2/beta/text/classification": { + "/v2/beta/text/sentence-similarity": { post: { parameters: { query: { @@ -6761,11 +7058,11 @@ export interface paths { content: { "application/json": { model_id: string; - input: string; - data: { - text: string; - labels: string[]; - }[]; + source_sentence: string; + sentences: string[]; + parameters?: ({ + truncate_input_tokens?: boolean | null; + }) | null; }; }; }; @@ -6774,16 +7071,9 @@ export interface paths { 200: { content: { "application/json": { - result: { - predictions: string[]; - log_likelihood: { - [key: string]: number; - }; - /** @enum {string} */ - classification_type: "multi_class" | "multi_label" | "binary"; - model_input: string; - model_output: string; - }; + results: { + score: number; + }[]; }; }; }; @@ -6805,12 +7095,6 @@ export interface paths { "application/json": components["schemas"]["NotFoundResponse"]; }; }; - /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ - 429: { - content: { - "application/json": components["schemas"]["TooManyRequestsResponse"]; - }; - }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { @@ -6826,8 +7110,155 @@ export interface paths { }; }; }; - "/v2/beta/evaluation/{id}/instance_results": { - get: { + "/v2/beta/text/rerank": { + post: { + parameters: { + query: { + version: "2023-11-22"; + }; + }; + requestBody: { + content: { + "application/json": { + model_id: string; + query: string; + documents: string[]; + parameters?: ({ + truncate_input_tokens?: boolean | null; + return_options?: { + top_n?: number | null; + query?: boolean | null; + documents?: boolean | null; + }; + }) | null; + }; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + query?: string; + results: { + score: number; + }[]; + }; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; + "/v2/beta/text/classification": { + post: { + parameters: { + query: { + version: "2023-11-22"; + }; + }; + requestBody: { + content: { + "application/json": { + model_id: string; + input: string; + data: { + text: string; + labels: string[]; + }[]; + }; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + predictions: string[]; + log_likelihood: { + [key: string]: number; + }; + /** @enum {string} */ + classification_type: "multi_class" | "multi_label" | "binary"; + model_input: string; + model_output: string; + }; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; + "/v2/beta/evaluations/{id}/instance_results": { + get: { parameters: { query: { limit?: number; @@ -6843,26 +7274,481 @@ export interface paths { 200: { content: { "application/json": { - results: ({ - /** EvaluationScore */ - score: { - /** Score */ - score: number; - /** Score Name */ - score_name: string; - [key: string]: unknown; - }; - /** Source */ - source: string; - /** Target */ - target: string | string[]; - /** Prediction */ - prediction: string[]; - /** References */ - references: string[][]; - /** Generation Info */ - generation_info?: Record | null; - })[]; + results: ({ + score: { + [key: string]: unknown; + }; + /** Generation Info */ + generation_info?: Record | null; + })[]; + total_count: number; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; + "/v2/beta/evaluations/{id}": { + get: { + parameters: { + query: { + version: "2023-11-22"; + }; + path: { + id: string; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: string; + name: string; + description?: string; + experiment_id: string | null; + model_id: string | null; + /** @enum {string} */ + status: "pending" | "queued" | "running" | "completed" | "failed"; + status_message?: string | null; + parameters?: Record; + prompt: { + id: string; + name: string; + input?: string; + metadata?: { + [key: string]: unknown; + }; + }; + template_id: string; + template_name: string; + task_id: string | null; + /** Format: date-time */ + created_at: string; + /** Format: date-time */ + started_at?: string | null; + /** Format: date-time */ + finished_at?: string | null; + result: { + [key: string]: unknown; + } | null; + file: { + id: string; + file_name: string; + /** Format: date-time */ + created_at: string; + bytes: number; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; + }; + } | null; + }; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + delete: { + parameters: { + query: { + version: "2023-11-22"; + }; + path: { + id: string; + }; + }; + responses: { + /** @description Success */ + 204: { + content: never; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; + "/v2/beta/evaluations/templates/{id}": { + get: { + parameters: { + query: { + version: "2023-11-22"; + }; + path: { + id: string; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: string; + task?: { + id: string; + name: string; + parent_task?: { + id: string; + name: string; + }; + }; + default_prompt_ids?: string[]; + name: string; + metrics: Record[]; + postprocessors: string[]; + dataset_fields: { + [key: string]: unknown; + }; + }; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; + "/v2/beta/evaluations/templates": { + get: { + parameters: { + query: { + version: "2023-11-22"; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + results: { + id: string; + task?: { + id: string; + name: string; + parent_task?: { + id: string; + name: string; + }; + }; + default_prompt_ids?: string[]; + name: string; + metrics: Record[]; + postprocessors: string[]; + dataset_fields: { + [key: string]: unknown; + }; + }[]; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; + "/v2/beta/evaluations/preview": { + post: { + parameters: { + query: { + limit?: number; + version: "2023-11-22"; + }; + }; + requestBody: { + content: { + "application/json": { + name: string; + description?: string; + experiment_id?: string; + template_id: string; + prompt_id: string; + model_id?: string; + parameters?: ({ + beam_width?: number | null; + /** @enum {string|null} */ + decoding_method?: "greedy" | "sample" | null; + max_new_tokens?: number | null; + min_new_tokens?: number | null; + random_seed?: number | null; + stop_sequences?: string[] | null; + temperature?: number | null; + time_limit?: number | null; + top_k?: number | null; + top_p?: number | null; + typical_p?: number | null; + repetition_penalty?: number | null; + truncate_input_tokens?: number | null; + include_stop_sequence?: boolean; + return_options?: ({ + generated_tokens?: boolean | null; + input_text?: boolean | null; + input_tokens?: boolean | null; + input_parameters?: boolean | null; + token_logprobs?: boolean | null; + token_ranks?: boolean | null; + top_n_tokens?: number | null; + }) | null; + length_penalty?: ({ + decay_factor?: number | null; + start_index?: number | null; + }) | null; + }) | null; + dataset_file_id: string; + field_operations?: ({ + /** @enum {string} */ + type: "rename_fields" | "add_fields" | "shuffle"; + [key: string]: unknown; + })[]; + metrics: string[]; + postprocessors?: string[]; + }; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + results: ({ + score: { + [key: string]: unknown; + }; + /** Generation Info */ + generation_info?: Record | null; + })[]; + total_count: number; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The server can not find requested resource. */ + 404: { + content: { + "application/json": components["schemas"]["NotFoundResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; + }; + "/v2/beta/evaluations/limits": { + get: { + parameters: { + query: { + version: "2023-11-22"; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + concurrency: { + limit: number; + remaining: number; + }; + }; }; }; }; @@ -6878,18 +7764,6 @@ export interface paths { "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; - /** @description The server can not find requested resource. */ - 404: { - content: { - "application/json": components["schemas"]["NotFoundResponse"]; - }; - }; - /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ - 429: { - content: { - "application/json": components["schemas"]["TooManyRequestsResponse"]; - }; - }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { @@ -6905,7 +7779,7 @@ export interface paths { }; }; }; - "/v2/beta/evaluation/{id}": { + "/v2/beta/evaluations/experiments/{id}": { get: { parameters: { query: { @@ -6924,12 +7798,20 @@ export interface paths { id: string; name: string; description?: string; + experiment_id: string | null; model_id: string | null; /** @enum {string} */ status: "pending" | "queued" | "running" | "completed" | "failed"; status_message?: string | null; parameters?: Record; - prompt_id: string; + prompt: { + id: string; + name: string; + input?: string; + metadata?: { + [key: string]: unknown; + }; + }; template_id: string; template_name: string; task_id: string | null; @@ -6946,7 +7828,14 @@ export interface paths { id: string; file_name: string; /** Format: date-time */ - created_at?: string; + created_at: string; + bytes: number; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; + }; } | null; }; }; @@ -6990,9 +7879,7 @@ export interface paths { }; }; }; - }; - "/v2/beta/evaluation/template/{id}": { - get: { + delete: { parameters: { query: { version: "2023-11-22"; @@ -7002,30 +7889,9 @@ export interface paths { }; }; responses: { - /** @description Default Response */ - 200: { - content: { - "application/json": { - result: { - id: string; - task?: { - id: string; - name: string; - parent_task?: { - id: string; - name: string; - }; - }; - default_prompt_ids?: string[]; - name: string; - metrics: Record[]; - postprocessors: string[]; - dataset_fields: { - [key: string]: unknown; - }; - }; - }; - }; + /** @description Success */ + 204: { + content: never; }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { @@ -7066,10 +7932,14 @@ export interface paths { }; }; }; - "/v2/beta/evaluation/template": { + "/v2/beta/evaluations/experiments": { get: { parameters: { query: { + limit?: number; + offset?: number; + sort_by?: "name" | "id" | "template"; + direction?: "asc" | "desc"; version: "2023-11-22"; }; }; @@ -7078,9 +7948,28 @@ export interface paths { 200: { content: { "application/json": { - results: { + results: ({ id: string; - task?: { + name: string; + description?: string; + template_id: string; + /** Format: date-time */ + created_at: string; + evaluations_count: number; + file?: { + id: string; + file_name: string; + /** Format: date-time */ + created_at: string; + bytes: number; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; + }; + } | null; + task: { id: string; name: string; parent_task?: { @@ -7088,14 +7977,8 @@ export interface paths { name: string; }; }; - default_prompt_ids?: string[]; - name: string; - metrics: Record[]; - postprocessors: string[]; - dataset_fields: { - [key: string]: unknown; - }; - }[]; + })[]; + total_count: number; }; }; }; @@ -7131,12 +8014,9 @@ export interface paths { }; }; }; - }; - "/v2/beta/evaluation/preview": { post: { parameters: { query: { - limit?: number; version: "2023-11-22"; }; }; @@ -7146,46 +8026,7 @@ export interface paths { name: string; description?: string; template_id: string; - prompt_id: string; - model_id?: string; - parameters?: ({ - beam_width?: number | null; - /** @enum {string|null} */ - decoding_method?: "greedy" | "sample" | null; - max_new_tokens?: number | null; - min_new_tokens?: number | null; - random_seed?: number | null; - stop_sequences?: string[] | null; - temperature?: number | null; - time_limit?: number | null; - top_k?: number | null; - top_p?: number | null; - typical_p?: number | null; - repetition_penalty?: number | null; - truncate_input_tokens?: number | null; - include_stop_sequence?: boolean; - return_options?: ({ - generated_tokens?: boolean | null; - input_text?: boolean | null; - input_tokens?: boolean | null; - input_parameters?: boolean | null; - token_logprobs?: boolean | null; - token_ranks?: boolean | null; - top_n_tokens?: number | null; - }) | null; - length_penalty?: ({ - decay_factor?: number | null; - start_index?: number | null; - }) | null; - }) | null; dataset_file_id: string; - field_operations?: ({ - /** @enum {string} */ - type: "rename_fields" | "add_fields" | "shuffle"; - [key: string]: unknown; - })[]; - metrics: string[]; - postprocessors?: string[]; }; }; }; @@ -7194,26 +8035,36 @@ export interface paths { 200: { content: { "application/json": { - results: ({ - /** EvaluationScore */ - score: { - /** Score */ - score: number; - /** Score Name */ - score_name: string; - [key: string]: unknown; + result: { + id: string; + name: string; + description?: string; + template_id: string; + /** Format: date-time */ + created_at: string; + evaluations_count: number; + file?: { + id: string; + file_name: string; + /** Format: date-time */ + created_at: string; + bytes: number; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; }; - /** Source */ - source: string; - /** Target */ - target: string | string[]; - /** Prediction */ - prediction: string[]; - /** References */ - references: string[][]; - /** Generation Info */ - generation_info?: Record | null; - })[]; + } | null; + task: { + id: string; + name: string; + parent_task?: { + id: string; + name: string; + }; + }; + }; }; }; }; @@ -7256,7 +8107,103 @@ export interface paths { }; }; }; - "/v2/beta/evaluation": { + "/v2/beta/evaluations": { + get: { + parameters: { + query: { + limit?: number; + offset?: number; + sort_by?: "name" | "id" | "template"; + direction?: "asc" | "desc"; + experiment_id?: string; + version: "2023-11-22"; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + results: ({ + id: string; + name: string; + description?: string; + experiment_id: string | null; + model_id: string | null; + /** @enum {string} */ + status: "pending" | "queued" | "running" | "completed" | "failed"; + status_message?: string | null; + parameters?: Record; + prompt: { + id: string; + name: string; + input?: string; + metadata?: { + [key: string]: unknown; + }; + }; + template_id: string; + template_name: string; + task_id: string | null; + /** Format: date-time */ + created_at: string; + /** Format: date-time */ + started_at?: string | null; + /** Format: date-time */ + finished_at?: string | null; + result: { + [key: string]: unknown; + } | null; + file: { + id: string; + file_name: string; + /** Format: date-time */ + created_at: string; + bytes: number; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; + }; + } | null; + })[]; + total_count: number; + }; + }; + }; + /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ + 400: { + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description Unauthorized route access. */ + 401: { + content: { + "application/json": components["schemas"]["UnauthorizedResponse"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ + 429: { + content: { + "application/json": components["schemas"]["TooManyRequestsResponse"]; + }; + }; + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + 500: { + content: { + "application/json": components["schemas"]["InternalServerErrorResponse"]; + }; + }; + /** @description The remote server is not ready to handle the request. */ + 503: { + content: { + "application/json": components["schemas"]["UnavailableResponse"]; + }; + }; + }; + }; post: { parameters: { query: { @@ -7268,6 +8215,7 @@ export interface paths { "application/json": { name: string; description?: string; + experiment_id?: string; template_id: string; prompt_id: string; model_id?: string; @@ -7321,12 +8269,20 @@ export interface paths { id: string; name: string; description?: string; + experiment_id: string | null; model_id: string | null; /** @enum {string} */ status: "pending" | "queued" | "running" | "completed" | "failed"; status_message?: string | null; parameters?: Record; - prompt_id: string; + prompt: { + id: string; + name: string; + input?: string; + metadata?: { + [key: string]: unknown; + }; + }; template_id: string; template_name: string; task_id: string | null; @@ -7343,7 +8299,14 @@ export interface paths { id: string; file_name: string; /** Format: date-time */ - created_at?: string; + created_at: string; + bytes: number; + metadata?: { + stats: { + columns: string[]; + records_count: number; + }; + }; } | null; }; }; diff --git a/src/services/FileService.ts b/src/services/FileService.ts index 18e9400..5ec55ef 100644 --- a/src/services/FileService.ts +++ b/src/services/FileService.ts @@ -32,7 +32,7 @@ export class FileService extends BaseService { }, params: { query: { - version: '2024-04-09', + version: '2024-05-13', }, }, }), @@ -49,7 +49,7 @@ export class FileService extends BaseService { params: { path: input, query: { - version: '2024-04-09', + version: '2024-05-13', }, }, }), @@ -101,7 +101,7 @@ export class FileService extends BaseService { params: { query: { ...input, - version: '2024-04-09', + version: '2024-05-13', }, }, }),