diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 716d0046..8e3d9554 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.30.0" + ".": "0.31.0" } diff --git a/.stats.yml b/.stats.yml index 3effa724..9574cfe5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-eacfa676c4ac9c051f61d4d25c1074315959b2e3d418bca529e6de2a9f6636e7.yml -openapi_spec_hash: 1d56caf3dd011e888fb911d34bd34aef -config_hash: 3c3a676f96a972da95e0e85618e64c76 +configured_endpoints: 46 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-1afddc630f2b0684aad99bda9d83dc91ee6648a2b5cd7eac5d42fdc9ff46bbfc.yml +openapi_spec_hash: a4cab3a8559f632b66ea7aabd40cd8aa +config_hash: eb8d7493024f64839cec7401a9451c78 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e30a1cd..2a8f9c78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## 0.31.0 (2025-11-14) + +Full Changelog: [v0.30.0...v0.31.0](https://github.com/togethercomputer/together-typescript/compare/v0.30.0...v0.31.0) + +### ⚠ BREAKING CHANGES + +* **api:** Access to the api for listing checkpoints has changed its name to `list_checkpoints` +* **api:** Access to fine tuning APIs namespace has changed from `fine_tune` to `fine_tuning` + +### Features + +* **api:** Add audio.voices.list sdk ([890595e](https://github.com/togethercomputer/together-typescript/commit/890595e53cdfd3e28a60cde87426f48ddb81a261)) +* **api:** Add batches.cancel API ([b1133f8](https://github.com/togethercomputer/together-typescript/commit/b1133f805588621237922f13cfd2b9e0a4401a0e)) +* **api:** Add endpoints.list_avzones ([606fea8](https://github.com/togethercomputer/together-typescript/commit/606fea8873f5d511b619cfce63c3762ffc61db89)) +* **api:** Add fine_tune.delete API ([79d0c84](https://github.com/togethercomputer/together-typescript/commit/79d0c84157bddcfe54de5d0ce1c12866b4c1243d)) +* **api:** api update ([4be10bc](https://github.com/togethercomputer/together-typescript/commit/4be10bcc5ba0f6af6b42eda9edbb8d6bb921fb02)) +* **api:** api update ([e594a76](https://github.com/togethercomputer/together-typescript/commit/e594a76294cf6c591b49f84f8769c045423b9d2a)) +* **api:** api update ([8ec7bf0](https://github.com/togethercomputer/together-typescript/commit/8ec7bf0af42f2b9c4ff21f03a8978ed947bdec74)) +* **api:** api update ([04797be](https://github.com/togethercomputer/together-typescript/commit/04797be698349057cec045107b183e19e99c0ef3)) +* **api:** api update ([c219bfd](https://github.com/togethercomputer/together-typescript/commit/c219bfd42f433da46c8689929dd99eef55c9dda4)) +* **api:** manual updates ([9f78929](https://github.com/togethercomputer/together-typescript/commit/9f78929f9162d4c84a0f0643d4070d96dac32e76)) +* **api:** Update Eval APIs ([c91b8c0](https://github.com/togethercomputer/together-typescript/commit/c91b8c082eb8e84841820d23bf7dbf1450525b67)) + + +### Styles + +* **api:** Change fine tuning method `retrieve_checkpoints` to `list_checkpoints` ([b2c168a](https://github.com/togethercomputer/together-typescript/commit/b2c168afce5f78c915b06559d2c226b5220160c1)) +* **api:** Change fine tuning namespace to `fine_tuning` ([77b1211](https://github.com/togethercomputer/together-typescript/commit/77b1211ece96ad340628409c0ae08bac9fab2e0a)) + ## 0.30.0 (2025-11-04) Full Changelog: [v0.29.0...v0.30.0](https://github.com/togethercomputer/together-typescript/compare/v0.29.0...v0.30.0) diff --git a/api.md b/api.md index 4ee67829..e6b8c00b 100644 --- a/api.md +++ b/api.md @@ -77,35 +77,37 @@ Methods: - client.files.content(id) -> Response - client.files.upload({ ...params }) -> FileUploadResponse -# FineTune +# FineTuning Types: -- CosineLrSchedulerArgs -- FineTune -- FineTuneEvent -- FullTrainingType -- LinearLrSchedulerArgs -- LoRaTrainingType -- LrScheduler -- TrainingMethodDpo -- TrainingMethodSft -- FineTuneCreateResponse -- FineTuneListResponse -- FineTuneCancelResponse -- FineTuneDownloadResponse -- FineTuneListEventsResponse -- FineTuneRetrieveCheckpointsResponse +- CosineLrSchedulerArgs +- FineTune +- FineTuneEvent +- FullTrainingType +- LinearLrSchedulerArgs +- LoRaTrainingType +- LrScheduler +- TrainingMethodDpo +- TrainingMethodSft +- FineTuningCreateResponse +- FineTuningListResponse +- FineTuningDeleteResponse +- FineTuningCancelResponse +- FineTuningDownloadResponse +- FineTuningListCheckpointsResponse +- FineTuningListEventsResponse Methods: -- client.fineTune.create({ ...params }) -> FineTuneCreateResponse -- client.fineTune.retrieve(id) -> FineTune -- client.fineTune.list() -> FineTuneListResponse -- client.fineTune.cancel(id) -> FineTuneCancelResponse -- client.fineTune.download({ ...params }) -> FineTuneDownloadResponse -- client.fineTune.listEvents(id) -> FineTuneListEventsResponse -- client.fineTune.retrieveCheckpoints(id) -> FineTuneRetrieveCheckpointsResponse +- client.fineTuning.create({ ...params }) -> FineTuningCreateResponse +- client.fineTuning.retrieve(id) -> FineTune +- client.fineTuning.list() -> FineTuningListResponse +- client.fineTuning.delete(id, { ...params }) -> FineTuningDeleteResponse +- client.fineTuning.cancel(id) -> FineTuningCancelResponse +- client.fineTuning.download({ ...params }) -> FineTuningDownloadResponse +- client.fineTuning.listCheckpoints(id) -> FineTuningListCheckpointsResponse +- client.fineTuning.listEvents(id) -> FineTuningListEventsResponse # CodeInterpreter @@ -162,6 +164,16 @@ Methods: - client.audio.create({ ...params }) -> Response +## Voices + +Types: + +- VoiceListResponse + +Methods: + +- client.audio.voices.list() -> VoiceListResponse + ## Transcriptions Types: @@ -211,18 +223,18 @@ Methods: Types: - Autoscaling -- EndpointCreateResponse -- EndpointRetrieveResponse -- EndpointUpdateResponse +- DedicatedEndpoint - EndpointListResponse +- EndpointListAvzonesResponse Methods: -- client.endpoints.create({ ...params }) -> EndpointCreateResponse -- client.endpoints.retrieve(endpointID) -> EndpointRetrieveResponse -- client.endpoints.update(endpointID, { ...params }) -> EndpointUpdateResponse +- client.endpoints.create({ ...params }) -> DedicatedEndpoint +- client.endpoints.retrieve(endpointID) -> DedicatedEndpoint +- client.endpoints.update(endpointID, { ...params }) -> DedicatedEndpoint - client.endpoints.list({ ...params }) -> EndpointListResponse - client.endpoints.delete(endpointID) -> void +- client.endpoints.listAvzones() -> EndpointListAvzonesResponse # Hardware @@ -241,27 +253,29 @@ Types: - BatchCreateResponse - BatchRetrieveResponse - BatchListResponse +- BatchCancelResponse Methods: - client.batches.create({ ...params }) -> BatchCreateResponse - client.batches.retrieve(id) -> BatchRetrieveResponse - client.batches.list() -> BatchListResponse +- client.batches.cancel(id) -> BatchCancelResponse # Evals Types: -- EvaluationJudgeModelConfig -- EvaluationModelRequest -- EvalRetrieveResponse +- EvaluationJob +- EvalCreateResponse +- EvalUpdateResponse - EvalListResponse -- EvalGetAllowedModelsResponse -- EvalGetStatusResponse +- EvalStatusResponse Methods: -- client.evals.retrieve(id) -> EvalRetrieveResponse -- client.evals.list({ ...params }) -> EvalListResponse -- client.evals.getAllowedModels() -> EvalGetAllowedModelsResponse -- client.evals.getStatus(id) -> EvalGetStatusResponse +- client.evals.create({ ...params }) -> EvalCreateResponse +- client.evals.retrieve(id) -> EvaluationJob +- client.evals.update(id, { ...params }) -> EvalUpdateResponse +- client.evals.list({ ...params }) -> EvalListResponse +- client.evals.status(id) -> EvalStatusResponse diff --git a/package.json b/package.json index e469fb60..d6cbdca7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "together-ai", - "version": "0.30.0", + "version": "0.31.0", "description": "The official TypeScript library for the Together API", "author": "Together ", "types": "dist/index.d.ts", diff --git a/src/client.ts b/src/client.ts index e5a38db9..4765bf03 100644 --- a/src/client.ts +++ b/src/client.ts @@ -19,6 +19,7 @@ import * as TopLevelAPI from './resources/top-level'; import { RerankParams, RerankResponse } from './resources/top-level'; import { APIPromise } from './core/api-promise'; import { + BatchCancelResponse, BatchCreateParams, BatchCreateResponse, BatchListResponse, @@ -39,24 +40,24 @@ import { import { Embedding, EmbeddingCreateParams, Embeddings } from './resources/embeddings'; import { Autoscaling, + DedicatedEndpoint, EndpointCreateParams, - EndpointCreateResponse, + EndpointListAvzonesResponse, EndpointListParams, EndpointListResponse, - EndpointRetrieveResponse, EndpointUpdateParams, - EndpointUpdateResponse, Endpoints, } from './resources/endpoints'; import { - EvalGetAllowedModelsResponse, - EvalGetStatusResponse, + EvalCreateParams, + EvalCreateResponse, EvalListParams, EvalListResponse, - EvalRetrieveResponse, + EvalStatusResponse, + EvalUpdateParams, + EvalUpdateResponse, Evals, - EvaluationJudgeModelConfig, - EvaluationModelRequest, + EvaluationJob, } from './resources/evals'; import { FileDeleteResponse, @@ -72,23 +73,25 @@ import { import { CosineLrSchedulerArgs, FineTune, - FineTuneCancelResponse, - FineTuneCreateParams, - FineTuneCreateResponse, - FineTuneDownloadParams, - FineTuneDownloadResponse, FineTuneEvent, - FineTuneListEventsResponse, - FineTuneListResponse, - FineTuneResource, - FineTuneRetrieveCheckpointsResponse, + FineTuning, + FineTuningCancelResponse, + FineTuningCreateParams, + FineTuningCreateResponse, + FineTuningDeleteParams, + FineTuningDeleteResponse, + FineTuningDownloadParams, + FineTuningDownloadResponse, + FineTuningListCheckpointsResponse, + FineTuningListEventsResponse, + FineTuningListResponse, FullTrainingType, LinearLrSchedulerArgs, LoRaTrainingType, LrScheduler, TrainingMethodDpo, TrainingMethodSft, -} from './resources/fine-tune'; +} from './resources/fine-tuning'; import { Hardware, HardwareListParams, HardwareListResponse } from './resources/hardware'; import { ImageCreateParams, ImageDataB64, ImageDataURL, ImageFile, Images } from './resources/images'; import { JobListResponse, JobRetrieveResponse, Jobs } from './resources/jobs'; @@ -831,7 +834,7 @@ export class Together { completions: API.Completions = new API.Completions(this); embeddings: API.Embeddings = new API.Embeddings(this); files: API.Files = new API.Files(this); - fineTune: API.FineTuneResource = new API.FineTuneResource(this); + fineTuning: API.FineTuning = new API.FineTuning(this); codeInterpreter: API.CodeInterpreter = new API.CodeInterpreter(this); images: API.Images = new API.Images(this); videos: API.Videos = new API.Videos(this); @@ -848,7 +851,7 @@ Together.Chat = Chat; Together.Completions = Completions; Together.Embeddings = Embeddings; Together.Files = Files; -Together.FineTuneResource = FineTuneResource; +Together.FineTuning = FineTuning; Together.CodeInterpreter = CodeInterpreter; Together.Images = Images; Together.Videos = Videos; @@ -898,7 +901,7 @@ export declare namespace Together { }; export { - FineTuneResource as FineTuneResource, + FineTuning as FineTuning, type CosineLrSchedulerArgs as CosineLrSchedulerArgs, type FineTune as FineTune, type FineTuneEvent as FineTuneEvent, @@ -908,14 +911,16 @@ export declare namespace Together { type LrScheduler as LrScheduler, type TrainingMethodDpo as TrainingMethodDpo, type TrainingMethodSft as TrainingMethodSft, - type FineTuneCreateResponse as FineTuneCreateResponse, - type FineTuneListResponse as FineTuneListResponse, - type FineTuneCancelResponse as FineTuneCancelResponse, - type FineTuneDownloadResponse as FineTuneDownloadResponse, - type FineTuneListEventsResponse as FineTuneListEventsResponse, - type FineTuneRetrieveCheckpointsResponse as FineTuneRetrieveCheckpointsResponse, - type FineTuneCreateParams as FineTuneCreateParams, - type FineTuneDownloadParams as FineTuneDownloadParams, + type FineTuningCreateResponse as FineTuningCreateResponse, + type FineTuningListResponse as FineTuningListResponse, + type FineTuningDeleteResponse as FineTuningDeleteResponse, + type FineTuningCancelResponse as FineTuningCancelResponse, + type FineTuningDownloadResponse as FineTuningDownloadResponse, + type FineTuningListCheckpointsResponse as FineTuningListCheckpointsResponse, + type FineTuningListEventsResponse as FineTuningListEventsResponse, + type FineTuningCreateParams as FineTuningCreateParams, + type FineTuningDeleteParams as FineTuningDeleteParams, + type FineTuningDownloadParams as FineTuningDownloadParams, }; export { @@ -964,10 +969,9 @@ export declare namespace Together { export { Endpoints as Endpoints, type Autoscaling as Autoscaling, - type EndpointCreateResponse as EndpointCreateResponse, - type EndpointRetrieveResponse as EndpointRetrieveResponse, - type EndpointUpdateResponse as EndpointUpdateResponse, + type DedicatedEndpoint as DedicatedEndpoint, type EndpointListResponse as EndpointListResponse, + type EndpointListAvzonesResponse as EndpointListAvzonesResponse, type EndpointCreateParams as EndpointCreateParams, type EndpointUpdateParams as EndpointUpdateParams, type EndpointListParams as EndpointListParams, @@ -984,17 +988,19 @@ export declare namespace Together { type BatchCreateResponse as BatchCreateResponse, type BatchRetrieveResponse as BatchRetrieveResponse, type BatchListResponse as BatchListResponse, + type BatchCancelResponse as BatchCancelResponse, type BatchCreateParams as BatchCreateParams, }; export { Evals as Evals, - type EvaluationJudgeModelConfig as EvaluationJudgeModelConfig, - type EvaluationModelRequest as EvaluationModelRequest, - type EvalRetrieveResponse as EvalRetrieveResponse, + type EvaluationJob as EvaluationJob, + type EvalCreateResponse as EvalCreateResponse, + type EvalUpdateResponse as EvalUpdateResponse, type EvalListResponse as EvalListResponse, - type EvalGetAllowedModelsResponse as EvalGetAllowedModelsResponse, - type EvalGetStatusResponse as EvalGetStatusResponse, + type EvalStatusResponse as EvalStatusResponse, + type EvalCreateParams as EvalCreateParams, + type EvalUpdateParams as EvalUpdateParams, type EvalListParams as EvalListParams, }; } diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts index 1f8b177f..2e788f1d 100644 --- a/src/resources/audio/audio.ts +++ b/src/resources/audio/audio.ts @@ -6,12 +6,15 @@ import * as TranscriptionsAPI from './transcriptions'; import { TranscriptionCreateParams, TranscriptionCreateResponse, Transcriptions } from './transcriptions'; import * as TranslationsAPI from './translations'; import { TranslationCreateParams, TranslationCreateResponse, Translations } from './translations'; +import * as VoicesAPI from './voices'; +import { VoiceListResponse, Voices } from './voices'; import { APIPromise } from '../../core/api-promise'; import { Stream } from '../../core/streaming'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; export class Audio extends APIResource { + voices: VoicesAPI.Voices = new VoicesAPI.Voices(this._client); transcriptions: TranscriptionsAPI.Transcriptions = new TranscriptionsAPI.Transcriptions(this._client); translations: TranslationsAPI.Translations = new TranslationsAPI.Translations(this._client); @@ -175,6 +178,7 @@ export interface AudioCreateParamsStreaming extends AudioCreateParamsBase { stream: true; } +Audio.Voices = Voices; Audio.Transcriptions = Transcriptions; Audio.Translations = Translations; @@ -187,6 +191,8 @@ export declare namespace Audio { type AudioCreateParamsStreaming as AudioCreateParamsStreaming, }; + export { Voices as Voices, type VoiceListResponse as VoiceListResponse }; + export { Transcriptions as Transcriptions, type TranscriptionCreateResponse as TranscriptionCreateResponse, diff --git a/src/resources/audio/index.ts b/src/resources/audio/index.ts index 6eae9f63..f8d2ab9b 100644 --- a/src/resources/audio/index.ts +++ b/src/resources/audio/index.ts @@ -14,3 +14,4 @@ export { type TranscriptionCreateParams, } from './transcriptions'; export { Translations, type TranslationCreateResponse, type TranslationCreateParams } from './translations'; +export { Voices, type VoiceListResponse } from './voices'; diff --git a/src/resources/audio/voices.ts b/src/resources/audio/voices.ts new file mode 100644 index 00000000..805a33e9 --- /dev/null +++ b/src/resources/audio/voices.ts @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import { APIPromise } from '../../core/api-promise'; +import { RequestOptions } from '../../internal/request-options'; + +export class Voices extends APIResource { + /** + * Fetch available voices for each model + * + * @example + * ```ts + * const voices = await client.audio.voices.list(); + * ``` + */ + list(options?: RequestOptions): APIPromise { + return this._client.get('/voices', options); + } +} + +/** + * Response containing a list of models and their available voices. + */ +export interface VoiceListResponse { + data: Array; +} + +export namespace VoiceListResponse { + /** + * Represents a model with its available voices. + */ + export interface Data { + model: string; + + voices: Array; + } + + export namespace Data { + export interface Voice { + id: string; + + name: string; + } + } +} + +export declare namespace Voices { + export { type VoiceListResponse as VoiceListResponse }; +} diff --git a/src/resources/batches.ts b/src/resources/batches.ts index ce42b0ad..d9247b98 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -46,6 +46,20 @@ export class Batches extends APIResource { list(options?: RequestOptions): APIPromise { return this._client.get('/batches', options); } + + /** + * Cancel a batch job by ID + * + * @example + * ```ts + * const response = await client.batches.cancel( + * 'batch_job_abc123def456', + * ); + * ``` + */ + cancel(id: string, options?: RequestOptions): APIPromise { + return this._client.post(path`/batches/${id}/cancel`, options); + } } export interface BatchCreateResponse { @@ -186,6 +200,48 @@ export namespace BatchListResponse { } } +export interface BatchCancelResponse { + id?: string; + + completed_at?: string; + + created_at?: string; + + endpoint?: string; + + error?: string; + + error_file_id?: string; + + /** + * Size of input file in bytes + */ + file_size_bytes?: number; + + input_file_id?: string; + + job_deadline?: string; + + /** + * Model used for processing requests + */ + model_id?: string; + + output_file_id?: string; + + /** + * Completion progress (0.0 to 100) + */ + progress?: number; + + /** + * Current status of the batch job + */ + status?: 'VALIDATING' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED' | 'EXPIRED' | 'CANCELLED'; + + user_id?: string; +} + export interface BatchCreateParams { /** * The endpoint to use for batch processing @@ -218,6 +274,7 @@ export declare namespace Batches { type BatchCreateResponse as BatchCreateResponse, type BatchRetrieveResponse as BatchRetrieveResponse, type BatchListResponse as BatchListResponse, + type BatchCancelResponse as BatchCancelResponse, type BatchCreateParams as BatchCreateParams, }; } diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index d1169abc..320b669d 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -149,6 +149,8 @@ export namespace ChatCompletionChunk { */ function_call?: Delta.FunctionCall | null; + reasoning?: string | null; + token_id?: number; tool_calls?: Array; diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 4ff37d6c..01038f62 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -121,6 +121,8 @@ export namespace CompletionChunk { */ function_call?: Delta.FunctionCall | null; + reasoning?: string | null; + token_id?: number; tool_calls?: Array; diff --git a/src/resources/endpoints.ts b/src/resources/endpoints.ts index 7ac18658..ee340b97 100644 --- a/src/resources/endpoints.ts +++ b/src/resources/endpoints.ts @@ -14,14 +14,14 @@ export class Endpoints extends APIResource { * * @example * ```ts - * const endpoint = await client.endpoints.create({ + * const dedicatedEndpoint = await client.endpoints.create({ * autoscaling: { max_replicas: 5, min_replicas: 2 }, * hardware: '1x_nvidia_a100_80gb_sxm', * model: 'meta-llama/Llama-3-8b-chat-hf', * }); * ``` */ - create(body: EndpointCreateParams, options?: RequestOptions): APIPromise { + create(body: EndpointCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/endpoints', { body, ...options }); } @@ -31,12 +31,12 @@ export class Endpoints extends APIResource { * * @example * ```ts - * const endpoint = await client.endpoints.retrieve( + * const dedicatedEndpoint = await client.endpoints.retrieve( * 'endpoint-d23901de-ef8f-44bf-b3e7-de9c1ca8f2d7', * ); * ``` */ - retrieve(endpointID: string, options?: RequestOptions): APIPromise { + retrieve(endpointID: string, options?: RequestOptions): APIPromise { return this._client.get(path`/endpoints/${endpointID}`, options); } @@ -46,7 +46,7 @@ export class Endpoints extends APIResource { * * @example * ```ts - * const endpoint = await client.endpoints.update( + * const dedicatedEndpoint = await client.endpoints.update( * 'endpoint-d23901de-ef8f-44bf-b3e7-de9c1ca8f2d7', * ); * ``` @@ -55,7 +55,7 @@ export class Endpoints extends APIResource { endpointID: string, body: EndpointUpdateParams, options?: RequestOptions, - ): APIPromise { + ): APIPromise { return this._client.patch(path`/endpoints/${endpointID}`, { body, ...options }); } @@ -91,6 +91,18 @@ export class Endpoints extends APIResource { headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } + + /** + * List all available availability zones. + * + * @example + * ```ts + * const response = await client.endpoints.listAvzones(); + * ``` + */ + listAvzones(options?: RequestOptions): APIPromise { + return this._client.get('/clusters/availability-zones', options); + } } /** @@ -111,127 +123,7 @@ export interface Autoscaling { /** * Details about a dedicated endpoint deployment */ -export interface EndpointCreateResponse { - /** - * Unique identifier for the endpoint - */ - id: string; - - /** - * Configuration for automatic scaling of the endpoint - */ - autoscaling: Autoscaling; - - /** - * Timestamp when the endpoint was created - */ - created_at: string; - - /** - * Human-readable name for the endpoint - */ - display_name: string; - - /** - * The hardware configuration used for this endpoint - */ - hardware: string; - - /** - * The model deployed on this endpoint - */ - model: string; - - /** - * System name for the endpoint - */ - name: string; - - /** - * The type of object - */ - object: 'endpoint'; - - /** - * The owner of this endpoint - */ - owner: string; - - /** - * Current state of the endpoint - */ - state: 'PENDING' | 'STARTING' | 'STARTED' | 'STOPPING' | 'STOPPED' | 'ERROR'; - - /** - * The type of endpoint - */ - type: 'dedicated'; -} - -/** - * Details about a dedicated endpoint deployment - */ -export interface EndpointRetrieveResponse { - /** - * Unique identifier for the endpoint - */ - id: string; - - /** - * Configuration for automatic scaling of the endpoint - */ - autoscaling: Autoscaling; - - /** - * Timestamp when the endpoint was created - */ - created_at: string; - - /** - * Human-readable name for the endpoint - */ - display_name: string; - - /** - * The hardware configuration used for this endpoint - */ - hardware: string; - - /** - * The model deployed on this endpoint - */ - model: string; - - /** - * System name for the endpoint - */ - name: string; - - /** - * The type of object - */ - object: 'endpoint'; - - /** - * The owner of this endpoint - */ - owner: string; - - /** - * Current state of the endpoint - */ - state: 'PENDING' | 'STARTING' | 'STARTED' | 'STOPPING' | 'STOPPED' | 'ERROR'; - - /** - * The type of endpoint - */ - type: 'dedicated'; -} - -/** - * Details about a dedicated endpoint deployment - */ -export interface EndpointUpdateResponse { +export interface DedicatedEndpoint { /** * Unique identifier for the endpoint */ @@ -341,6 +233,13 @@ export namespace EndpointListResponse { } } +/** + * List of unique availability zones + */ +export interface EndpointListAvzonesResponse { + avzones: Array; +} + export interface EndpointCreateParams { /** * Configuration for automatic scaling of the endpoint @@ -409,19 +308,28 @@ export interface EndpointUpdateParams { } export interface EndpointListParams { + /** + * If true, return only endpoints owned by the caller + */ + mine?: boolean; + /** * Filter endpoints by type */ type?: 'dedicated' | 'serverless'; + + /** + * Filter endpoints by usage type + */ + usage_type?: 'on-demand' | 'reserved'; } export declare namespace Endpoints { export { type Autoscaling as Autoscaling, - type EndpointCreateResponse as EndpointCreateResponse, - type EndpointRetrieveResponse as EndpointRetrieveResponse, - type EndpointUpdateResponse as EndpointUpdateResponse, + type DedicatedEndpoint as DedicatedEndpoint, type EndpointListResponse as EndpointListResponse, + type EndpointListAvzonesResponse as EndpointListAvzonesResponse, type EndpointCreateParams as EndpointCreateParams, type EndpointUpdateParams as EndpointUpdateParams, type EndpointListParams as EndpointListParams, diff --git a/src/resources/evals.ts b/src/resources/evals.ts index eecb07e8..00f700ec 100644 --- a/src/resources/evals.ts +++ b/src/resources/evals.ts @@ -7,77 +7,83 @@ import { path } from '../internal/utils/path'; export class Evals extends APIResource { /** - * Get details of a specific evaluation job + * Create an evaluation job + * + * @example + * ```ts + * const _eval = await client.evals.create({ + * parameters: { + * input_data_file_path: 'file-1234-aefd', + * judge: { + * model: 'meta-llama/Llama-3-70B-Instruct-Turbo', + * model_source: 'serverless', + * system_template: + * 'Imagine you are a helpful assistant', + * }, + * labels: ['yes', 'no'], + * pass_labels: ['yes'], + * }, + * type: 'classify', + * }); + * ``` */ - retrieve(id: string, options?: RequestOptions): APIPromise { - return this._client.get(path`/evaluation/${id}`, options); + create(body: EvalCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/evaluation', { body, ...options }); } /** - * Get a list of evaluation jobs with optional filtering + * Get evaluation job details + * + * @example + * ```ts + * const evaluationJob = await client.evals.retrieve('id'); + * ``` */ - list( - query: EvalListParams | null | undefined = {}, - options?: RequestOptions, - ): APIPromise { - return this._client.get('/evaluations', { query, ...options }); + retrieve(id: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/evaluation/${id}`, options); } /** - * Get the list of models that are allowed for evaluation + * Update evaluation job status and results + * + * @example + * ```ts + * const _eval = await client.evals.update('id'); + * ``` */ - getAllowedModels(options?: RequestOptions): APIPromise { - return this._client.get('/evaluations/model-list', options); + update(id: string, body: EvalUpdateParams, options?: RequestOptions): APIPromise { + return this._client.post(path`/evaluation/${id}/update`, { body, ...options }); } /** - * Get the status and results of a specific evaluation job + * Get all evaluation jobs + * + * @example + * ```ts + * const evaluationJobs = await client.evals.list(); + * ``` */ - getStatus(id: string, options?: RequestOptions): APIPromise { - return this._client.get(path`/evaluation/${id}/status`, options); + list( + query: EvalListParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + return this._client.get('/evaluation', { query, ...options }); } -} - -export interface EvaluationJudgeModelConfig { - /** - * Name of the judge model - */ - model_name: string; - - /** - * System prompt template for the judge - */ - system_template: string; -} - -export interface EvaluationModelRequest { - /** - * Input prompt template - */ - input_template: string; - - /** - * Maximum number of tokens to generate - */ - max_tokens: number; /** - * Name of the model to evaluate + * Get evaluation job status and results + * + * @example + * ```ts + * const response = await client.evals.status('id'); + * ``` */ - model_name: string; - - /** - * System prompt template - */ - system_template: string; - - /** - * Sampling temperature - */ - temperature: number; + status(id: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/evaluation/${id}/status`, options); + } } -export interface EvalRetrieveResponse { +export interface EvaluationJob { /** * When the job was created */ @@ -97,10 +103,10 @@ export interface EvalRetrieveResponse { * Results of the evaluation (when completed) */ results?: - | EvalRetrieveResponse.EvaluationClassifyResults - | EvalRetrieveResponse.EvaluationScoreResults - | EvalRetrieveResponse.EvaluationCompareResults - | EvalRetrieveResponse.Error + | EvaluationJob.EvaluationClassifyResults + | EvaluationJob.EvaluationScoreResults + | EvaluationJob.EvaluationCompareResults + | EvaluationJob.Error | null; /** @@ -111,7 +117,7 @@ export interface EvalRetrieveResponse { /** * History of status updates (admin only) */ - status_updates?: Array; + status_updates?: Array; /** * The type of evaluation @@ -129,7 +135,7 @@ export interface EvalRetrieveResponse { workflow_id?: string; } -export namespace EvalRetrieveResponse { +export namespace EvaluationJob { export interface EvaluationClassifyResults { /** * Number of failed generations. @@ -260,342 +266,531 @@ export namespace EvalRetrieveResponse { } } -export type EvalListResponse = Array; +export interface EvalCreateResponse { + /** + * Initial status of the job + */ + status?: 'pending'; + + /** + * The ID of the created evaluation job + */ + workflow_id?: string; +} + +export interface EvalUpdateResponse { + status?: string; + + workflow_id?: string; +} + +export type EvalListResponse = Array; + +export interface EvalStatusResponse { + /** + * The results of the evaluation job + */ + results?: + | EvalStatusResponse.EvaluationClassifyResults + | EvalStatusResponse.EvaluationScoreResults + | EvalStatusResponse.EvaluationCompareResults; + + /** + * The status of the evaluation job + */ + status?: 'completed' | 'error' | 'user_error' | 'running' | 'queued' | 'pending'; +} + +export namespace EvalStatusResponse { + export interface EvaluationClassifyResults { + /** + * Number of failed generations. + */ + generation_fail_count?: number | null; + + /** + * Number of invalid labels + */ + invalid_label_count?: number | null; + + /** + * Number of failed judge generations + */ + judge_fail_count?: number | null; + + /** + * JSON string representing label counts + */ + label_counts?: string; + + /** + * Pecentage of pass labels. + */ + pass_percentage?: number | null; + + /** + * Data File ID + */ + result_file_id?: string; + } + + export interface EvaluationScoreResults { + aggregated_scores?: EvaluationScoreResults.AggregatedScores; + + /** + * number of failed samples generated from model + */ + failed_samples?: number; + + /** + * Number of failed generations. + */ + generation_fail_count?: number | null; + + /** + * number of invalid scores generated from model + */ + invalid_score_count?: number; + + /** + * Number of failed judge generations + */ + judge_fail_count?: number | null; + + /** + * Data File ID + */ + result_file_id?: string; + } + + export namespace EvaluationScoreResults { + export interface AggregatedScores { + mean_score?: number; + + pass_percentage?: number; + + std_score?: number; + } + } + + export interface EvaluationCompareResults { + /** + * Number of times model A won + */ + A_wins?: number; + + /** + * Number of times model B won + */ + B_wins?: number; -export namespace EvalListResponse { - export interface EvalListResponseItem { /** - * When the job was created + * Number of failed generations. */ - created_at?: string; + generation_fail_count?: number | null; /** - * ID of the job owner (admin only) + * Number of failed judge generations */ - owner_id?: string; + judge_fail_count?: number | null; /** - * The parameters used for this evaluation + * Total number of samples compared */ - parameters?: { [key: string]: unknown }; + num_samples?: number; /** - * Results of the evaluation (when completed) + * Data File ID */ - results?: - | EvalListResponseItem.EvaluationClassifyResults - | EvalListResponseItem.EvaluationScoreResults - | EvalListResponseItem.EvaluationCompareResults - | EvalListResponseItem.Error - | null; + result_file_id?: string; /** - * Current status of the job + * Number of ties */ - status?: 'pending' | 'queued' | 'running' | 'completed' | 'error' | 'user_error'; + Ties?: number; + } +} +export interface EvalCreateParams { + /** + * Type-specific parameters for the evaluation + */ + parameters: + | EvalCreateParams.EvaluationClassifyParameters + | EvalCreateParams.EvaluationScoreParameters + | EvalCreateParams.EvaluationCompareParameters; + + /** + * The type of evaluation to perform + */ + type: 'classify' | 'score' | 'compare'; +} + +export namespace EvalCreateParams { + export interface EvaluationClassifyParameters { /** - * History of status updates (admin only) + * Data file ID */ - status_updates?: Array; + input_data_file_path: string; + + judge: EvaluationClassifyParameters.Judge; /** - * The type of evaluation + * List of possible classification labels */ - type?: 'classify' | 'score' | 'compare'; + labels: Array; /** - * When the job was last updated + * List of labels that are considered passing */ - updated_at?: string; + pass_labels: Array; /** - * The evaluation job ID + * Field name in the input data */ - workflow_id?: string; + model_to_evaluate?: string | EvaluationClassifyParameters.EvaluationModelRequest; } - export namespace EvalListResponseItem { - export interface EvaluationClassifyResults { + export namespace EvaluationClassifyParameters { + export interface Judge { /** - * Number of failed generations. + * Name of the judge model */ - generation_fail_count?: number | null; + model: string; /** - * Number of invalid labels + * Source of the judge model. */ - invalid_label_count?: number | null; + model_source: 'serverless' | 'dedicated' | 'external'; /** - * Number of failed judge generations + * System prompt template for the judge */ - judge_fail_count?: number | null; + system_template: string; /** - * JSON string representing label counts + * Bearer/API token for external judge models. */ - label_counts?: string; + external_api_token?: string; /** - * Pecentage of pass labels. + * Base URL for external judge models. Must be OpenAI-compatible base URL. */ - pass_percentage?: number | null; + external_base_url?: string; + } + export interface EvaluationModelRequest { /** - * Data File ID + * Input prompt template */ - result_file_id?: string; - } + input_template: string; - export interface EvaluationScoreResults { - aggregated_scores?: EvaluationScoreResults.AggregatedScores; + /** + * Maximum number of tokens to generate + */ + max_tokens: number; /** - * number of failed samples generated from model + * Name of the model to evaluate */ - failed_samples?: number; + model: string; /** - * Number of failed generations. + * Source of the model. */ - generation_fail_count?: number | null; + model_source: 'serverless' | 'dedicated' | 'external'; /** - * number of invalid scores generated from model + * System prompt template */ - invalid_score_count?: number; + system_template: string; /** - * Number of failed judge generations + * Sampling temperature */ - judge_fail_count?: number | null; + temperature: number; /** - * Data File ID + * Bearer/API token for external models. */ - result_file_id?: string; + external_api_token?: string; + + /** + * Base URL for external models. Must be OpenAI-compatible base URL + */ + external_base_url?: string; } + } - export namespace EvaluationScoreResults { - export interface AggregatedScores { - mean_score?: number; + export interface EvaluationScoreParameters { + /** + * Data file ID + */ + input_data_file_path: string; - pass_percentage?: number; + judge: EvaluationScoreParameters.Judge; - std_score?: number; - } - } + /** + * Maximum possible score + */ + max_score: number; - export interface EvaluationCompareResults { + /** + * Minimum possible score + */ + min_score: number; + + /** + * Score threshold for passing + */ + pass_threshold: number; + + /** + * Field name in the input data + */ + model_to_evaluate?: string | EvaluationScoreParameters.EvaluationModelRequest; + } + + export namespace EvaluationScoreParameters { + export interface Judge { /** - * Number of times model A won + * Name of the judge model */ - A_wins?: number; + model: string; /** - * Number of times model B won + * Source of the judge model. */ - B_wins?: number; + model_source: 'serverless' | 'dedicated' | 'external'; /** - * Number of failed generations. + * System prompt template for the judge */ - generation_fail_count?: number | null; + system_template: string; /** - * Number of failed judge generations + * Bearer/API token for external judge models. */ - judge_fail_count?: number | null; + external_api_token?: string; /** - * Total number of samples compared + * Base URL for external judge models. Must be OpenAI-compatible base URL. */ - num_samples?: number; + external_base_url?: string; + } + export interface EvaluationModelRequest { /** - * Data File ID + * Input prompt template */ - result_file_id?: string; + input_template: string; /** - * Number of ties + * Maximum number of tokens to generate */ - Ties?: number; - } - - export interface Error { - error?: string; - } + max_tokens: number; - export interface StatusUpdate { /** - * Additional message for this update + * Name of the model to evaluate */ - message?: string; + model: string; /** - * The status at this update + * Source of the model. */ - status?: string; + model_source: 'serverless' | 'dedicated' | 'external'; /** - * When this update occurred + * System prompt template */ - timestamp?: string; - } - } -} + system_template: string; -export interface EvalGetAllowedModelsResponse { - model_list?: Array; -} + /** + * Sampling temperature + */ + temperature: number; -export interface EvalGetStatusResponse { - results?: - | EvalGetStatusResponse.EvaluationClassifyResults - | EvalGetStatusResponse.EvaluationScoreResults - | EvalGetStatusResponse.EvaluationCompareResults - | EvalGetStatusResponse.Error - | null; + /** + * Bearer/API token for external models. + */ + external_api_token?: string; - status?: 'pending' | 'queued' | 'running' | 'completed' | 'error' | 'user_error'; -} + /** + * Base URL for external models. Must be OpenAI-compatible base URL + */ + external_base_url?: string; + } + } -export namespace EvalGetStatusResponse { - export interface EvaluationClassifyResults { + export interface EvaluationCompareParameters { /** - * Number of failed generations. + * Data file name */ - generation_fail_count?: number | null; + input_data_file_path: string; - /** - * Number of invalid labels - */ - invalid_label_count?: number | null; + judge: EvaluationCompareParameters.Judge; /** - * Number of failed judge generations + * Field name in the input data */ - judge_fail_count?: number | null; + model_a?: string | EvaluationCompareParameters.EvaluationModelRequest; /** - * JSON string representing label counts + * Field name in the input data */ - label_counts?: string; + model_b?: string | EvaluationCompareParameters.EvaluationModelRequest; + } - /** - * Pecentage of pass labels. - */ - pass_percentage?: number | null; + export namespace EvaluationCompareParameters { + export interface Judge { + /** + * Name of the judge model + */ + model: string; - /** - * Data File ID - */ - result_file_id?: string; - } + /** + * Source of the judge model. + */ + model_source: 'serverless' | 'dedicated' | 'external'; - export interface EvaluationScoreResults { - aggregated_scores?: EvaluationScoreResults.AggregatedScores; + /** + * System prompt template for the judge + */ + system_template: string; - /** - * number of failed samples generated from model - */ - failed_samples?: number; + /** + * Bearer/API token for external judge models. + */ + external_api_token?: string; - /** - * Number of failed generations. - */ - generation_fail_count?: number | null; + /** + * Base URL for external judge models. Must be OpenAI-compatible base URL. + */ + external_base_url?: string; + } - /** - * number of invalid scores generated from model - */ - invalid_score_count?: number; + export interface EvaluationModelRequest { + /** + * Input prompt template + */ + input_template: string; - /** - * Number of failed judge generations - */ - judge_fail_count?: number | null; + /** + * Maximum number of tokens to generate + */ + max_tokens: number; - /** - * Data File ID - */ - result_file_id?: string; - } + /** + * Name of the model to evaluate + */ + model: string; - export namespace EvaluationScoreResults { - export interface AggregatedScores { - mean_score?: number; + /** + * Source of the model. + */ + model_source: 'serverless' | 'dedicated' | 'external'; - pass_percentage?: number; + /** + * System prompt template + */ + system_template: string; - std_score?: number; + /** + * Sampling temperature + */ + temperature: number; + + /** + * Bearer/API token for external models. + */ + external_api_token?: string; + + /** + * Base URL for external models. Must be OpenAI-compatible base URL + */ + external_base_url?: string; } - } - export interface EvaluationCompareResults { - /** - * Number of times model A won - */ - A_wins?: number; + export interface EvaluationModelRequest { + /** + * Input prompt template + */ + input_template: string; - /** - * Number of times model B won - */ - B_wins?: number; + /** + * Maximum number of tokens to generate + */ + max_tokens: number; - /** - * Number of failed generations. - */ - generation_fail_count?: number | null; + /** + * Name of the model to evaluate + */ + model: string; - /** - * Number of failed judge generations - */ - judge_fail_count?: number | null; + /** + * Source of the model. + */ + model_source: 'serverless' | 'dedicated' | 'external'; - /** - * Total number of samples compared - */ - num_samples?: number; + /** + * System prompt template + */ + system_template: string; - /** - * Data File ID - */ - result_file_id?: string; + /** + * Sampling temperature + */ + temperature: number; - /** - * Number of ties - */ - Ties?: number; - } + /** + * Bearer/API token for external models. + */ + external_api_token?: string; - export interface Error { - error?: string; + /** + * Base URL for external models. Must be OpenAI-compatible base URL + */ + external_base_url?: string; + } } } -export interface EvalListParams { +export interface EvalUpdateParams { /** - * Maximum number of results to return (max 100) + * Error message when status is 'error' or 'user_error' */ + error?: string; + + /** + * The results of the evaluation job. The concrete structure depends on the type of + * evaluation job + */ + results?: unknown; + + status?: 'completed' | 'error' | 'user_error' | 'running' | 'queued' | 'pending'; +} + +export interface EvalListParams { limit?: number; + status?: string; + /** - * Filter by job status + * Admin users can specify a user ID to filter jobs. Pass empty string to get all + * jobs. */ - status?: 'pending' | 'queued' | 'running' | 'completed' | 'error' | 'user_error'; + userId?: string; } export declare namespace Evals { export { - type EvaluationJudgeModelConfig as EvaluationJudgeModelConfig, - type EvaluationModelRequest as EvaluationModelRequest, - type EvalRetrieveResponse as EvalRetrieveResponse, + type EvaluationJob as EvaluationJob, + type EvalCreateResponse as EvalCreateResponse, + type EvalUpdateResponse as EvalUpdateResponse, type EvalListResponse as EvalListResponse, - type EvalGetAllowedModelsResponse as EvalGetAllowedModelsResponse, - type EvalGetStatusResponse as EvalGetStatusResponse, + type EvalStatusResponse as EvalStatusResponse, + type EvalCreateParams as EvalCreateParams, + type EvalUpdateParams as EvalUpdateParams, type EvalListParams as EvalListParams, }; } diff --git a/src/resources/fine-tune.ts b/src/resources/fine-tuning.ts similarity index 85% rename from src/resources/fine-tune.ts rename to src/resources/fine-tuning.ts index f03d1975..61f840b8 100644 --- a/src/resources/fine-tune.ts +++ b/src/resources/fine-tuning.ts @@ -1,24 +1,24 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; -import * as FineTuneAPI from './fine-tune'; +import * as FineTuningAPI from './fine-tuning'; import { APIPromise } from '../core/api-promise'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; -export class FineTuneResource extends APIResource { +export class FineTuning extends APIResource { /** * Create a fine-tuning job with the provided model and training data. * * @example * ```ts - * const fineTune = await client.fineTune.create({ + * const fineTuning = await client.fineTuning.create({ * model: 'model', * training_file: 'training_file', * }); * ``` */ - create(body: FineTuneCreateParams, options?: RequestOptions): APIPromise { + create(body: FineTuningCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/fine-tunes', { body, ...options }); } @@ -27,7 +27,7 @@ export class FineTuneResource extends APIResource { * * @example * ```ts - * const fineTune = await client.fineTune.retrieve('id'); + * const fineTune = await client.fineTuning.retrieve('id'); * ``` */ retrieve(id: string, options?: RequestOptions): APIPromise { @@ -40,23 +40,42 @@ export class FineTuneResource extends APIResource { * * @example * ```ts - * const fineTunes = await client.fineTune.list(); + * const fineTunings = await client.fineTuning.list(); * ``` */ - list(options?: RequestOptions): APIPromise { + list(options?: RequestOptions): APIPromise { return this._client.get('/fine-tunes', options); } + /** + * Delete a fine-tuning job. + * + * @example + * ```ts + * const fineTuning = await client.fineTuning.delete('id', { + * force: true, + * }); + * ``` + */ + delete( + id: string, + params: FineTuningDeleteParams, + options?: RequestOptions, + ): APIPromise { + const { force } = params; + return this._client.delete(path`/fine-tunes/${id}`, { query: { force }, ...options }); + } + /** * Cancel a currently running fine-tuning job. Returns a FinetuneResponseTruncated * object. * * @example * ```ts - * const response = await client.fineTune.cancel('id'); + * const response = await client.fineTuning.cancel('id'); * ``` */ - cancel(id: string, options?: RequestOptions): APIPromise { + cancel(id: string, options?: RequestOptions): APIPromise { return this._client.post(path`/fine-tunes/${id}/cancel`, options); } @@ -65,39 +84,42 @@ export class FineTuneResource extends APIResource { * * @example * ```ts - * const response = await client.fineTune.download({ + * const response = await client.fineTuning.download({ * ft_id: 'ft_id', * }); * ``` */ - download(query: FineTuneDownloadParams, options?: RequestOptions): APIPromise { + download( + query: FineTuningDownloadParams, + options?: RequestOptions, + ): APIPromise { return this._client.get('/finetune/download', { query, ...options }); } /** - * List the events for a single fine-tuning job. + * List the checkpoints for a single fine-tuning job. * * @example * ```ts - * const response = await client.fineTune.listEvents('id'); + * const response = await client.fineTuning.listCheckpoints( + * 'id', + * ); * ``` */ - listEvents(id: string, options?: RequestOptions): APIPromise { - return this._client.get(path`/fine-tunes/${id}/events`, options); + listCheckpoints(id: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/fine-tunes/${id}/checkpoints`, options); } /** - * List the checkpoints for a single fine-tuning job. + * List the events for a single fine-tuning job. * * @example * ```ts - * const response = await client.fineTune.retrieveCheckpoints( - * 'id', - * ); + * const response = await client.fineTuning.listEvents('id'); * ``` */ - retrieveCheckpoints(id: string, options?: RequestOptions): APIPromise { - return this._client.get(path`/fine-tunes/${id}/checkpoints`, options); + listEvents(id: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/fine-tunes/${id}/events`, options); } } @@ -308,7 +330,7 @@ export interface TrainingMethodSft { * A truncated version of the fine-tune response, used for POST /fine-tunes, GET * /fine-tunes and POST /fine-tunes/{id}/cancel endpoints */ -export interface FineTuneCreateResponse { +export interface FineTuningCreateResponse { /** * Unique identifier for the fine-tune job */ @@ -463,11 +485,11 @@ export interface FineTuneCreateResponse { weight_decay?: number; } -export interface FineTuneListResponse { - data: Array; +export interface FineTuningListResponse { + data: Array; } -export namespace FineTuneListResponse { +export namespace FineTuningListResponse { /** * A truncated version of the fine-tune response, used for POST /fine-tunes, GET * /fine-tunes and POST /fine-tunes/{id}/cancel endpoints @@ -507,7 +529,7 @@ export namespace FineTuneListResponse { /** * Events related to this fine-tune job */ - events?: Array; + events?: Array; /** * Checkpoint used to continue training @@ -532,7 +554,7 @@ export namespace FineTuneListResponse { /** * Learning rate scheduler configuration */ - lr_scheduler?: FineTuneAPI.LrScheduler; + lr_scheduler?: FineTuningAPI.LrScheduler; /** * Maximum gradient norm for clipping @@ -589,12 +611,12 @@ export namespace FineTuneListResponse { /** * Method of training used */ - training_method?: FineTuneAPI.TrainingMethodSft | FineTuneAPI.TrainingMethodDpo; + training_method?: FineTuningAPI.TrainingMethodSft | FineTuningAPI.TrainingMethodDpo; /** * Type of training used (full or LoRA) */ - training_type?: FineTuneAPI.FullTrainingType | FineTuneAPI.LoRaTrainingType; + training_type?: FineTuningAPI.FullTrainingType | FineTuningAPI.LoRaTrainingType; /** * Identifier for the user who created the job @@ -628,11 +650,18 @@ export namespace FineTuneListResponse { } } +export interface FineTuningDeleteResponse { + /** + * Message indicating the result of the deletion + */ + message?: string; +} + /** * A truncated version of the fine-tune response, used for POST /fine-tunes, GET * /fine-tunes and POST /fine-tunes/{id}/cancel endpoints */ -export interface FineTuneCancelResponse { +export interface FineTuningCancelResponse { /** * Unique identifier for the fine-tune job */ @@ -787,7 +816,7 @@ export interface FineTuneCancelResponse { weight_decay?: number; } -export interface FineTuneDownloadResponse { +export interface FineTuningDownloadResponse { id?: string; checkpoint_step?: number; @@ -799,15 +828,11 @@ export interface FineTuneDownloadResponse { size?: number; } -export interface FineTuneListEventsResponse { - data: Array; -} - -export interface FineTuneRetrieveCheckpointsResponse { - data: Array; +export interface FineTuningListCheckpointsResponse { + data: Array; } -export namespace FineTuneRetrieveCheckpointsResponse { +export namespace FineTuningListCheckpointsResponse { export interface Data { checkpoint_type: string; @@ -819,7 +844,11 @@ export namespace FineTuneRetrieveCheckpointsResponse { } } -export interface FineTuneCreateParams { +export interface FineTuningListEventsResponse { + data: Array; +} + +export interface FineTuningCreateParams { /** * Name of the base model to run fine-tune job on */ @@ -959,7 +988,11 @@ export interface FineTuneCreateParams { weight_decay?: number; } -export interface FineTuneDownloadParams { +export interface FineTuningDeleteParams { + force: boolean; +} + +export interface FineTuningDownloadParams { /** * Fine-tune ID to download. A string that starts with `ft-`. */ @@ -984,7 +1017,7 @@ export interface FineTuneDownloadParams { output?: string; } -export declare namespace FineTuneResource { +export declare namespace FineTuning { export { type CosineLrSchedulerArgs as CosineLrSchedulerArgs, type FineTune as FineTune, @@ -995,13 +1028,15 @@ export declare namespace FineTuneResource { type LrScheduler as LrScheduler, type TrainingMethodDpo as TrainingMethodDpo, type TrainingMethodSft as TrainingMethodSft, - type FineTuneCreateResponse as FineTuneCreateResponse, - type FineTuneListResponse as FineTuneListResponse, - type FineTuneCancelResponse as FineTuneCancelResponse, - type FineTuneDownloadResponse as FineTuneDownloadResponse, - type FineTuneListEventsResponse as FineTuneListEventsResponse, - type FineTuneRetrieveCheckpointsResponse as FineTuneRetrieveCheckpointsResponse, - type FineTuneCreateParams as FineTuneCreateParams, - type FineTuneDownloadParams as FineTuneDownloadParams, + type FineTuningCreateResponse as FineTuningCreateResponse, + type FineTuningListResponse as FineTuningListResponse, + type FineTuningDeleteResponse as FineTuningDeleteResponse, + type FineTuningCancelResponse as FineTuningCancelResponse, + type FineTuningDownloadResponse as FineTuningDownloadResponse, + type FineTuningListCheckpointsResponse as FineTuningListCheckpointsResponse, + type FineTuningListEventsResponse as FineTuningListEventsResponse, + type FineTuningCreateParams as FineTuningCreateParams, + type FineTuningDeleteParams as FineTuningDeleteParams, + type FineTuningDownloadParams as FineTuningDownloadParams, }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 6374b824..228ea885 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -13,6 +13,7 @@ export { type BatchCreateResponse, type BatchRetrieveResponse, type BatchListResponse, + type BatchCancelResponse, type BatchCreateParams, } from './batches'; export { Chat } from './chat/chat'; @@ -36,22 +37,22 @@ export { Embeddings, type Embedding, type EmbeddingCreateParams } from './embedd export { Endpoints, type Autoscaling, - type EndpointCreateResponse, - type EndpointRetrieveResponse, - type EndpointUpdateResponse, + type DedicatedEndpoint, type EndpointListResponse, + type EndpointListAvzonesResponse, type EndpointCreateParams, type EndpointUpdateParams, type EndpointListParams, } from './endpoints'; export { Evals, - type EvaluationJudgeModelConfig, - type EvaluationModelRequest, - type EvalRetrieveResponse, + type EvaluationJob, + type EvalCreateResponse, + type EvalUpdateResponse, type EvalListResponse, - type EvalGetAllowedModelsResponse, - type EvalGetStatusResponse, + type EvalStatusResponse, + type EvalCreateParams, + type EvalUpdateParams, type EvalListParams, } from './evals'; export { @@ -66,7 +67,7 @@ export { type FileUploadParams, } from './files'; export { - FineTuneResource, + FineTuning, type CosineLrSchedulerArgs, type FineTune, type FineTuneEvent, @@ -76,15 +77,17 @@ export { type LrScheduler, type TrainingMethodDpo, type TrainingMethodSft, - type FineTuneCreateResponse, - type FineTuneListResponse, - type FineTuneCancelResponse, - type FineTuneDownloadResponse, - type FineTuneListEventsResponse, - type FineTuneRetrieveCheckpointsResponse, - type FineTuneCreateParams, - type FineTuneDownloadParams, -} from './fine-tune'; + type FineTuningCreateResponse, + type FineTuningListResponse, + type FineTuningDeleteResponse, + type FineTuningCancelResponse, + type FineTuningDownloadResponse, + type FineTuningListCheckpointsResponse, + type FineTuningListEventsResponse, + type FineTuningCreateParams, + type FineTuningDeleteParams, + type FineTuningDownloadParams, +} from './fine-tuning'; export { Hardware, type HardwareListResponse, type HardwareListParams } from './hardware'; export { Images, diff --git a/src/version.ts b/src/version.ts index 91a9bb6d..b6314c28 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.30.0'; // x-release-please-version +export const VERSION = '0.31.0'; // x-release-please-version diff --git a/tests/api-resources/audio/voices.test.ts b/tests/api-resources/audio/voices.test.ts new file mode 100644 index 00000000..ad67f84d --- /dev/null +++ b/tests/api-resources/audio/voices.test.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Together from 'together-ai'; + +const client = new Together({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource voices', () => { + test('list', async () => { + const responsePromise = client.audio.voices.list(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); +}); diff --git a/tests/api-resources/batches.test.ts b/tests/api-resources/batches.test.ts index 6142347c..03de8736 100644 --- a/tests/api-resources/batches.test.ts +++ b/tests/api-resources/batches.test.ts @@ -53,4 +53,15 @@ describe('resource batches', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); + + test('cancel', async () => { + const responsePromise = client.batches.cancel('batch_job_abc123def456'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); }); diff --git a/tests/api-resources/endpoints.test.ts b/tests/api-resources/endpoints.test.ts index bba11b21..538250f0 100644 --- a/tests/api-resources/endpoints.test.ts +++ b/tests/api-resources/endpoints.test.ts @@ -72,7 +72,10 @@ describe('resource endpoints', () => { test('list: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( - client.endpoints.list({ type: 'dedicated' }, { path: '/_stainless_unknown_path' }), + client.endpoints.list( + { mine: true, type: 'dedicated', usage_type: 'on-demand' }, + { path: '/_stainless_unknown_path' }, + ), ).rejects.toThrow(Together.NotFoundError); }); @@ -86,4 +89,15 @@ describe('resource endpoints', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); + + test('listAvzones', async () => { + const responsePromise = client.endpoints.listAvzones(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); }); diff --git a/tests/api-resources/evals.test.ts b/tests/api-resources/evals.test.ts index 45c9be34..978514a8 100644 --- a/tests/api-resources/evals.test.ts +++ b/tests/api-resources/evals.test.ts @@ -8,8 +8,20 @@ const client = new Together({ }); describe('resource evals', () => { - test('retrieve', async () => { - const responsePromise = client.evals.retrieve('id'); + test('create: only required params', async () => { + const responsePromise = client.evals.create({ + parameters: { + input_data_file_path: 'file-1234-aefd', + judge: { + model: 'meta-llama/Llama-3-70B-Instruct-Turbo', + model_source: 'serverless', + system_template: 'Imagine you are a helpful assistant', + }, + labels: ['yes', 'no'], + pass_labels: ['yes'], + }, + type: 'classify', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -19,8 +31,27 @@ describe('resource evals', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list', async () => { - const responsePromise = client.evals.list(); + test('create: required and optional params', async () => { + const response = await client.evals.create({ + parameters: { + input_data_file_path: 'file-1234-aefd', + judge: { + model: 'meta-llama/Llama-3-70B-Instruct-Turbo', + model_source: 'serverless', + system_template: 'Imagine you are a helpful assistant', + external_api_token: 'external_api_token', + external_base_url: 'external_base_url', + }, + labels: ['yes', 'no'], + pass_labels: ['yes'], + model_to_evaluate: 'string', + }, + type: 'classify', + }); + }); + + test('retrieve', async () => { + const responsePromise = client.evals.retrieve('id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -30,15 +61,19 @@ describe('resource evals', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.evals.list({ limit: 1, status: 'pending' }, { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Together.NotFoundError); + test('update', async () => { + const responsePromise = client.evals.update('id', {}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); }); - test('getAllowedModels', async () => { - const responsePromise = client.evals.getAllowedModels(); + test('list', async () => { + const responsePromise = client.evals.list(); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -48,8 +83,18 @@ describe('resource evals', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('getStatus', async () => { - const responsePromise = client.evals.getStatus('id'); + test('list: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.evals.list( + { limit: 0, status: 'status', userId: 'userId' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Together.NotFoundError); + }); + + test('status', async () => { + const responsePromise = client.evals.status('id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; diff --git a/tests/api-resources/fine-tune.test.ts b/tests/api-resources/fine-tuning.test.ts similarity index 76% rename from tests/api-resources/fine-tune.test.ts rename to tests/api-resources/fine-tuning.test.ts index 9dc83e09..d18694e7 100644 --- a/tests/api-resources/fine-tune.test.ts +++ b/tests/api-resources/fine-tuning.test.ts @@ -7,9 +7,9 @@ const client = new Together({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); -describe('resource fineTune', () => { +describe('resource fineTuning', () => { test('create: only required params', async () => { - const responsePromise = client.fineTune.create({ model: 'model', training_file: 'training_file' }); + const responsePromise = client.fineTuning.create({ model: 'model', training_file: 'training_file' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -20,7 +20,7 @@ describe('resource fineTune', () => { }); test('create: required and optional params', async () => { - const response = await client.fineTune.create({ + const response = await client.fineTuning.create({ model: 'model', training_file: 'training_file', batch_size: 0, @@ -50,7 +50,7 @@ describe('resource fineTune', () => { }); test('retrieve', async () => { - const responsePromise = client.fineTune.retrieve('id'); + const responsePromise = client.fineTuning.retrieve('id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -61,7 +61,7 @@ describe('resource fineTune', () => { }); test('list', async () => { - const responsePromise = client.fineTune.list(); + const responsePromise = client.fineTuning.list(); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -71,8 +71,23 @@ describe('resource fineTune', () => { expect(dataAndResponse.response).toBe(rawResponse); }); + test('delete: only required params', async () => { + const responsePromise = client.fineTuning.delete('id', { force: true }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.fineTuning.delete('id', { force: true }); + }); + test('cancel', async () => { - const responsePromise = client.fineTune.cancel('id'); + const responsePromise = client.fineTuning.cancel('id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -83,7 +98,7 @@ describe('resource fineTune', () => { }); test('download: only required params', async () => { - const responsePromise = client.fineTune.download({ ft_id: 'ft_id' }); + const responsePromise = client.fineTuning.download({ ft_id: 'ft_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -94,7 +109,7 @@ describe('resource fineTune', () => { }); test('download: required and optional params', async () => { - const response = await client.fineTune.download({ + const response = await client.fineTuning.download({ ft_id: 'ft_id', checkpoint: 'merged', checkpoint_step: 0, @@ -102,8 +117,8 @@ describe('resource fineTune', () => { }); }); - test('listEvents', async () => { - const responsePromise = client.fineTune.listEvents('id'); + test('listCheckpoints', async () => { + const responsePromise = client.fineTuning.listCheckpoints('id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -113,8 +128,8 @@ describe('resource fineTune', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieveCheckpoints', async () => { - const responsePromise = client.fineTune.retrieveCheckpoints('id'); + test('listEvents', async () => { + const responsePromise = client.fineTuning.listEvents('id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise;