diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 05b60243..bc86e4a2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.37.0" + ".": "0.38.0" } diff --git a/.stats.yml b/.stats.yml index 691324ee..7fabd7f5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 75 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-dc45695614158674dec4da8ae843a7564905f24d2ce577e8e6e5246b4a7b0f61.yml -openapi_spec_hash: 46a91a84c8c270792676ee863b33ab99 -config_hash: 67b76d1064bef2e591cadf50de08ad19 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-da5b9df3bfe0d31a76c91444c9eba060ad607d7d5a4e7483c5cc3fe2cac0f25e.yml +openapi_spec_hash: 7efd2ae2111f3a9bf190485828a13252 +config_hash: b66198d27b4d5c152688ff6cccfdeab5 diff --git a/CHANGELOG.md b/CHANGELOG.md index 41021d73..1173122e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## 0.38.0 (2026-02-21) + +Full Changelog: [v0.37.0...v0.38.0](https://github.com/togethercomputer/together-typescript/compare/v0.37.0...v0.38.0) + +### Features + +* Update descriptions for endpoints ([e7a8aaf](https://github.com/togethercomputer/together-typescript/commit/e7a8aafed811633b2a1c2c19df41fb43fd48ae89)) + + +### Bug Fixes + +* **client:** avoid removing abort listener too early ([1376258](https://github.com/togethercomputer/together-typescript/commit/137625849136205dc82f3b2493c96709365933ba)) +* **internal:** skip tests that depend on mock server ([be7e0e7](https://github.com/togethercomputer/together-typescript/commit/be7e0e717e129fcdca13570d5967d61d8107240f)) + + +### Chores + +* configure new SDK language ([b6f30b6](https://github.com/togethercomputer/together-typescript/commit/b6f30b6587c51483d7aace93a19350d4acb22061)) +* Fix various docstrings ([af4c47f](https://github.com/togethercomputer/together-typescript/commit/af4c47fab26f6ad7599866d2facd2075dfb7f7d7)) +* **internal/client:** fix form-urlencoded requests ([d73f69f](https://github.com/togethercomputer/together-typescript/commit/d73f69fb0a280ad9d2c1f15da25d3695ff9c55c7)) +* **internal:** avoid type checking errors with ts-reset ([70ad44b](https://github.com/togethercomputer/together-typescript/commit/70ad44b46220b19de3a0def616593e2382bda8dd)) +* Remove broken field LineCount from FileResponse ([a0c187e](https://github.com/togethercomputer/together-typescript/commit/a0c187e9ae89232655f4e29e82ed08778fa70294)) +* Revert adding mcp code. Code additions were unexpected. ([bb39360](https://github.com/togethercomputer/together-typescript/commit/bb39360b1f1815afa03cd59aec365c76f6fa6bf0)) +* Update descriptions for jig queue methods and properties ([7fdfcca](https://github.com/togethercomputer/together-typescript/commit/7fdfcca72618b3ea51d38ac01f91e6a08ad0863e)) +* update mock server docs ([ac14bf7](https://github.com/togethercomputer/together-typescript/commit/ac14bf741e8980c297b657f886d8ea0a88c15dcc)) + ## 0.37.0 (2026-02-04) Full Changelog: [v0.36.1...v0.37.0](https://github.com/togethercomputer/together-typescript/compare/v0.36.1...v0.37.0) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e188875..46e7bc28 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,7 +68,7 @@ $ pnpm link -—global together-ai Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. ```sh -$ npx prism mock path/to/your/openapi.yml +$ ./scripts/mock ``` ```sh diff --git a/api.md b/api.md index 28330cda..89e7dded 100644 --- a/api.md +++ b/api.md @@ -154,7 +154,6 @@ Methods: Types: - FileList -- FileObject - FilePurpose - FileResponse - FileType diff --git a/package.json b/package.json index 7cfc1611..c9befbc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "together-ai", - "version": "0.37.0", + "version": "0.38.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 071e0f1c..56866792 100644 --- a/src/client.ts +++ b/src/client.ts @@ -56,15 +56,7 @@ import { Evals, EvaluationJob, } from './resources/evals'; -import { - FileDeleteResponse, - FileList, - FileObject, - FilePurpose, - FileResponse, - FileType, - Files, -} from './resources/files'; +import { FileDeleteResponse, FileList, FilePurpose, FileResponse, FileType, Files } from './resources/files'; import { FineTuning, FineTuningCancelResponse, @@ -532,7 +524,7 @@ export class Together { loggerFor(this).info(`${responseInfo} - ${retryMessage}`); const errText = await response.text().catch((err: any) => castToError(err).message); - const errJSON = safeJSON(errText); + const errJSON = safeJSON(errText) as any; const errMessage = errJSON ? undefined : errText; loggerFor(this).debug( @@ -599,7 +591,6 @@ export class Together { return await this.fetch.call(undefined, url, fetchOptions); } finally { clearTimeout(timeout); - if (signal) signal.removeEventListener('abort', abort); } } @@ -783,6 +774,14 @@ export class Together { (Symbol.iterator in body && 'next' in body && typeof body.next === 'function')) ) { return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable) }; + } else if ( + typeof body === 'object' && + headers.values.get('content-type') === 'application/x-www-form-urlencoded' + ) { + return { + bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' }, + body: this.stringifyQuery(body as Record), + }; } else { return this.#encoder({ body, headers }); } @@ -868,7 +867,6 @@ export declare namespace Together { export { Files as Files, type FileList as FileList, - type FileObject as FileObject, type FilePurpose as FilePurpose, type FileResponse as FileResponse, type FileType as FileType, diff --git a/src/core/streaming.ts b/src/core/streaming.ts index 5045e993..577f95bf 100644 --- a/src/core/streaming.ts +++ b/src/core/streaming.ts @@ -58,7 +58,7 @@ export class Stream implements AsyncIterable { let data; try { - data = JSON.parse(sse.data); + data = JSON.parse(sse.data) as any; } catch (e) { logger.error(`Could not parse message into JSON:`, sse.data); logger.error(`From chunk:`, sse.raw); @@ -121,7 +121,7 @@ export class Stream implements AsyncIterable { try { for await (const line of iterLines()) { if (done) continue; - if (line) yield JSON.parse(line); + if (line) yield JSON.parse(line) as Item; } done = true; } catch (e) { diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts index 2c8ab28c..2fc69e55 100644 --- a/src/resources/audio/audio.ts +++ b/src/resources/audio/audio.ts @@ -43,6 +43,9 @@ export interface AudioSpeechStreamChunk { model: string; + /** + * The object type, which is always `audio.tts.chunk`. + */ object: 'audio.tts.chunk'; } diff --git a/src/resources/audio/voices.ts b/src/resources/audio/voices.ts index 805a33e9..7026f342 100644 --- a/src/resources/audio/voices.ts +++ b/src/resources/audio/voices.ts @@ -30,8 +30,14 @@ export namespace VoiceListResponse { * Represents a model with its available voices. */ export interface Data { + /** + * Model name. + */ model: string; + /** + * List of available voices for the model. + */ voices: Array; } @@ -39,6 +45,9 @@ export namespace VoiceListResponse { export interface Voice { id: string; + /** + * Voice name to be used for audio inference. + */ name: string; } } diff --git a/src/resources/beta/clusters/clusters.ts b/src/resources/beta/clusters/clusters.ts index 5b5e9d2e..b17c8571 100644 --- a/src/resources/beta/clusters/clusters.ts +++ b/src/resources/beta/clusters/clusters.ts @@ -69,6 +69,9 @@ export interface Cluster { cluster_name: string; + /** + * Type of cluster. + */ cluster_type: 'KUBERNETES' | 'SLURM'; control_plane_nodes: Array; @@ -166,17 +169,29 @@ export interface ClusterListRegionsResponse { export namespace ClusterListRegionsResponse { export interface Region { - id: string; - - availability_zones: Array; - + /** + * List of supported identifiable driver versions available in the region. + */ driver_versions: Array; + /** + * Identifiable name of the region. + */ name: string; + + /** + * List of supported identifiable gpus available in the region. + */ + supported_instance_types?: Array; } } export interface ClusterCreateParams { + /** + * RESERVED billing types allow you to specify the duration of the cluster + * reservation via the duration_days field. ON_DEMAND billing types will give you + * ownership of the cluster until you delete it. + */ billing_type: 'RESERVED' | 'ON_DEMAND'; /** @@ -201,11 +216,14 @@ export interface ClusterCreateParams { num_gpus: number; /** - * Region to create the GPU cluster in. Valid values are us-central-8 and - * us-central-4. + * Region to create the GPU cluster in. Usable regions can be found from + * `client.clusters.list_regions()` */ - region: 'us-central-8' | 'us-central-4'; + region: string; + /** + * Type of cluster to create. + */ cluster_type?: 'KUBERNETES' | 'SLURM'; /** @@ -213,12 +231,21 @@ export interface ClusterCreateParams { */ duration_days?: number; + /** + * Inline configuration to create a shared volume with the cluster creation. + */ shared_volume?: ClusterCreateParams.SharedVolume; + /** + * ID of an existing volume to use with the cluster creation. + */ volume_id?: string; } export namespace ClusterCreateParams { + /** + * Inline configuration to create a shared volume with the cluster creation. + */ export interface SharedVolume { /** * Region name. Usable regions can be found from `client.clusters.list_regions()` @@ -230,13 +257,23 @@ export namespace ClusterCreateParams { */ size_tib: number; + /** + * Customizable name of the volume to create. + */ volume_name: string; } } export interface ClusterUpdateParams { + /** + * Type of cluster to update. + */ cluster_type?: 'KUBERNETES' | 'SLURM'; + /** + * Number of GPUs to allocate in the cluster. This must be multiple of 8. For + * example, 8, 16 or 24 + */ num_gpus?: number; } diff --git a/src/resources/beta/clusters/storage.ts b/src/resources/beta/clusters/storage.ts index 2612b9d5..972af5bf 100644 --- a/src/resources/beta/clusters/storage.ts +++ b/src/resources/beta/clusters/storage.ts @@ -48,12 +48,24 @@ export class Storage extends APIResource { } export interface ClusterStorage { + /** + * Size of the volume in whole tebibytes (TiB). + */ size_tib: number; + /** + * Deployment status of the volume. + */ status: 'available' | 'bound' | 'provisioning'; + /** + * ID of the volume. + */ volume_id: string; + /** + * Provided name of the volume. + */ volume_name: string; } @@ -76,12 +88,21 @@ export interface StorageCreateParams { */ size_tib: number; + /** + * Customizable name of the volume to create. + */ volume_name: string; } export interface StorageUpdateParams { + /** + * Size of the volume in whole tebibytes (TiB). + */ size_tib?: number; + /** + * ID of the volume to update. + */ volume_id?: string; } diff --git a/src/resources/beta/jig/jig.ts b/src/resources/beta/jig/jig.ts index 9c2735d1..40df96c6 100644 --- a/src/resources/beta/jig/jig.ts +++ b/src/resources/beta/jig/jig.ts @@ -177,9 +177,9 @@ export interface Deployment { name?: string; /** - * Object is the type identifier for this response (always "deployment") + * The object type, which is always `deployment`. */ - object?: string; + object?: 'deployment'; /** * Port is the container port that the deployment exposes @@ -319,9 +319,9 @@ export interface JigListResponse { data?: Array; /** - * Object is the type identifier for this response (always "list") + * The object type, which is always `list`. */ - object?: string; + object?: 'list'; } export type JigDestroyResponse = unknown; diff --git a/src/resources/beta/jig/queue.ts b/src/resources/beta/jig/queue.ts index e5379f2c..129d62c7 100644 --- a/src/resources/beta/jig/queue.ts +++ b/src/resources/beta/jig/queue.ts @@ -6,30 +6,34 @@ import { RequestOptions } from '../../../internal/request-options'; export class Queue extends APIResource { /** - * Check the status of a job using request_id and model query parameters. + * Poll the current status of a previously submitted job. Provide the request_id + * and model as query parameters. */ retrieve(query: QueueRetrieveParams, options?: RequestOptions): APIPromise { return this._client.get('/queue/status', { query, ...options }); } /** - * Cancel a pending or running job. Returns the job status after the cancellation - * attempt. + * Cancel a pending job. Only jobs in pending status can be canceled. Running jobs + * cannot be stopped. Returns the job status after the attempt. If the job is not + * pending, returns 409 with the current status unchanged. */ cancel(body: QueueCancelParams, options?: RequestOptions): APIPromise { return this._client.post('/queue/cancel', { body, ...options }); } /** - * Get the current queue statistics including pending and running job counts. + * Get the current queue statistics for a model, including pending and running job + * counts. */ metrics(query: QueueMetricsParams, options?: RequestOptions): APIPromise { return this._client.get('/queue/metrics', { query, ...options }); } /** - * Submit a new job to the queue. Returns a request ID that can be used to check - * status. + * Submit a new job to the queue for asynchronous processing. Jobs are processed in + * strict priority order (higher priority first, FIFO within the same priority). + * Returns a request ID that can be used to poll status or cancel the job. */ submit(body: QueueSubmitParams, options?: RequestOptions): APIPromise { return this._client.post('/queue/submit', { body, ...options }); @@ -37,76 +41,153 @@ export class Queue extends APIResource { } export interface QueueRetrieveResponse { + /** + * Model identifier the job was submitted to + */ + model: string; + + /** + * The request ID that was returned from the submit endpoint + */ + request_id: string; + + /** + * Current job status. Transitions: pending → running → done/failed. A pending job + * may also be canceled. + */ + status: 'pending' | 'running' | 'done' | 'failed' | 'canceled'; + + /** + * Timestamp when a worker claimed the job + */ claimed_at?: string; + /** + * Timestamp when the job was created + */ created_at?: string; + /** + * Timestamp when the job completed (done or failed) + */ done_at?: string; + /** + * Job metadata. Contains keys from the submit request, plus any modifications from + * the model or system (e.g. progress, retry history). + */ info?: { [key: string]: unknown }; + /** + * Freeform model input, as submitted + */ inputs?: { [key: string]: unknown }; - model?: string; - + /** + * Freeform model output, populated when the job reaches done status. Contents are + * model-specific. + */ outputs?: { [key: string]: unknown }; /** - * Additional fields for test compatibility + * Job priority. Higher values are processed first. */ priority?: number; - request_id?: string; - + /** + * Number of times this job has been retried. Workers set a claim timeout and must + * send periodic status updates to keep the job alive. If no update is received + * within the timeout, the job is returned to the queue and retried. After 3 + * retries the job is permanently failed. Jobs explicitly failed by the model are + * not retried. + */ retries?: number; /** - * this should be the enum, but isn't for backwards compatability + * Non-fatal messages about the request (e.g. deprecation notices) */ - status?: string; - warnings?: Array; } export interface QueueCancelResponse { - status?: string; + /** + * Job status after the cancel attempt. Only pending jobs can be canceled. If the + * job is already running, done, or failed, the status is returned unchanged. + */ + status: 'canceled' | 'running' | 'done' | 'failed'; } -export type QueueMetricsResponse = { [key: string]: unknown }; +export interface QueueMetricsResponse { + /** + * Number of jobs currently being processed + */ + messages_running: number; + + /** + * Number of jobs waiting to be claimed by a worker + */ + messages_waiting: number; + + /** + * Total number of active jobs (waiting + running) + */ + total_jobs: number; +} export interface QueueSubmitResponse { error?: QueueSubmitResponse.Error; + /** + * Unique identifier for the submitted job. Use this to poll status or cancel. + */ requestId?: string; } export namespace QueueSubmitResponse { export interface Error { + /** + * Machine-readable error code + */ code?: string; + /** + * Human-readable error message + */ message?: string; + /** + * The parameter that caused the error, if applicable + */ param?: string; + /** + * Error category (e.g. "invalid_request_error", "not_found_error") + */ type?: string; } } export interface QueueRetrieveParams { /** - * Model name + * Model name the job was submitted to */ model: string; /** - * Request ID + * Request ID returned from the submit endpoint */ request_id: string; } export interface QueueCancelParams { + /** + * Model identifier the job was submitted to + */ model: string; + /** + * The request ID returned from the submit endpoint + */ request_id: string; } @@ -123,10 +204,22 @@ export interface QueueSubmitParams { */ model: string; + /** + * Freeform model input. Passed unchanged to the model. Contents are + * model-specific. + */ payload: { [key: string]: unknown }; + /** + * Arbitrary JSON metadata stored with the job and returned in status responses. + * The model and system may add or update keys during processing. + */ info?: { [key: string]: unknown }; + /** + * Job priority. Higher values are processed first (strict priority ordering). Jobs + * with equal priority are processed in submission order (FIFO). + */ priority?: number; } diff --git a/src/resources/beta/jig/secrets.ts b/src/resources/beta/jig/secrets.ts index fedeaa82..d533a5c7 100644 --- a/src/resources/beta/jig/secrets.ts +++ b/src/resources/beta/jig/secrets.ts @@ -74,9 +74,9 @@ export interface Secret { name?: string; /** - * Object is the type identifier for this response (always "secret") + * The object type, which is always `secret`. */ - object?: string; + object?: 'secret'; /** * UpdatedAt is the ISO8601 timestamp when this secret was last updated @@ -91,9 +91,9 @@ export interface SecretListResponse { data?: Array; /** - * Object is the type identifier for this response (always "list") + * The object type, which is always `list`. */ - object?: string; + object?: 'list'; } export type SecretDeleteResponse = unknown; diff --git a/src/resources/beta/jig/volumes.ts b/src/resources/beta/jig/volumes.ts index 8fbbda83..98d0d346 100644 --- a/src/resources/beta/jig/volumes.ts +++ b/src/resources/beta/jig/volumes.ts @@ -64,9 +64,9 @@ export interface Volume { name?: string; /** - * Object is the type identifier for this response (always "volume") + * The object type, which is always `volume`. */ - object?: string; + object?: 'volume'; /** * Type is the volume type (e.g., "readOnly") @@ -105,9 +105,9 @@ export interface VolumeListResponse { data?: Array; /** - * Object is the type identifier for this response (always "list") + * The object type, which is always `list`. */ - object?: string; + object?: 'list'; } export type VolumeDeleteResponse = unknown; diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 7e53f849..6ed6136e 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -10,7 +10,8 @@ import { RequestOptions } from '../../internal/request-options'; export class Completions extends APIResource { /** - * Query a chat model. + * Generate a model response for a given chat conversation. Supports single queries + * and multi-turn conversations with system, user, and assistant messages. * * @example * ```ts @@ -53,6 +54,9 @@ export interface ChatCompletion { model: string; + /** + * The object type, which is always `chat.completion`. + */ object: 'chat.completion'; usage?: ChatCompletionUsage | null; @@ -116,6 +120,9 @@ export interface ChatCompletionChunk { model: string; + /** + * The object type, which is always `chat.completion.chunk`. + */ object: 'chat.completion.chunk'; system_fingerprint?: string; @@ -328,6 +335,9 @@ export interface CompletionCreateParamsBase { | 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo' | (string & {}); + /** + * Additional configuration to pass to model engine. + */ chat_template_kwargs?: unknown; compliance?: 'hipaa'; @@ -387,6 +397,10 @@ export interface CompletionCreateParamsBase { */ presence_penalty?: number; + /** + * For models that support toggling reasoning functionality, this object can be + * used to control that functionality. + */ reasoning?: CompletionCreateParams.Reasoning; /** @@ -601,11 +615,11 @@ export namespace CompletionCreateParams { name: string; } + /** + * For models that support toggling reasoning functionality, this object can be + * used to control that functionality. + */ export interface Reasoning { - /** - * For models that support toggling reasoning functionality, this object can be - * used to control that functionality. - */ enabled?: boolean; } diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 01038f62..89c2eb9a 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -9,7 +9,8 @@ import { RequestOptions } from '../internal/request-options'; export class Completions extends APIResource { /** - * Query a language, code, or image model. + * Generate text completions for a given prompt using a language, code, or image + * model. * * @example * ```ts @@ -48,6 +49,9 @@ export interface Completion { model: string; + /** + * The object type, which is always `text.completion`. + */ object: 'text.completion'; usage: ChatCompletionsAPI.ChatCompletionUsage | null; @@ -86,6 +90,9 @@ export interface CompletionChunk { created?: number; + /** + * The object type, which is always `completion.chunk`. + */ object?: 'completion.chunk'; seed?: number; diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index a21eb50d..ffd04356 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -6,7 +6,8 @@ import { RequestOptions } from '../internal/request-options'; export class Embeddings extends APIResource { /** - * Query an embedding model for a given string of text. + * Generate vector embeddings for one or more text inputs. Returns numerical arrays + * representing semantic meaning, useful for search, classification, and retrieval. * * @example * ```ts @@ -27,6 +28,9 @@ export interface Embedding { model: string; + /** + * The object type, which is always `list`. + */ object: 'list'; } @@ -36,6 +40,9 @@ export namespace Embedding { index: number; + /** + * The object type, which is always `embedding`. + */ object: 'embedding'; } } diff --git a/src/resources/endpoints.ts b/src/resources/endpoints.ts index d70c9d90..d62e232d 100644 --- a/src/resources/endpoints.ts +++ b/src/resources/endpoints.ts @@ -177,7 +177,7 @@ export interface DedicatedEndpoint { name: string; /** - * The type of object + * The object type, which is always `endpoint`. */ object: 'endpoint'; @@ -200,6 +200,9 @@ export interface DedicatedEndpoint { export interface EndpointListResponse { data: Array; + /** + * The object type, which is always `list`. + */ object: 'list'; } @@ -229,7 +232,7 @@ export namespace EndpointListResponse { name: string; /** - * The type of object + * The object type, which is always `endpoint`. */ object: 'endpoint'; @@ -260,6 +263,9 @@ export interface EndpointListAvzonesResponse { export interface EndpointListHardwareResponse { data: Array; + /** + * The object type, which is always `list`. + */ object: 'list'; } @@ -273,6 +279,9 @@ export namespace EndpointListHardwareResponse { */ id: string; + /** + * The object type, which is always `hardware`. + */ object: 'hardware'; /** diff --git a/src/resources/evals.ts b/src/resources/evals.ts index fb64af5c..409c1d66 100644 --- a/src/resources/evals.ts +++ b/src/resources/evals.ts @@ -738,15 +738,15 @@ export namespace EvalCreateParams { } export interface EvalListParams { + /** + * Limit the number of results + */ limit?: number; - status?: string; - /** - * Admin users can specify a user ID to filter jobs. Pass empty string to get all - * jobs. + * Filter evaluation jobs by status */ - userId?: string; + status?: string; } export declare namespace Evals { diff --git a/src/resources/files.ts b/src/resources/files.ts index 90dd03c2..905286bd 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -9,7 +9,7 @@ import { upload } from '../lib/upload'; export class Files extends APIResource { /** - * List the metadata for a single uploaded data file. + * Retrieve the metadata for a single uploaded data file. * * @example * ```ts @@ -76,16 +76,6 @@ export interface FileList { data: Array; } -export interface FileObject { - id?: string; - - filename?: string; - - object?: string; - - size?: number; -} - /** * The purpose of the file */ @@ -98,28 +88,47 @@ export type FilePurpose = | 'batch-generated' | 'batch-api'; +/** + * Structured information describing a file uploaded to Together. + */ export interface FileResponse { + /** + * ID of the file. + */ id: string; + /** + * The number of bytes in the file. + */ bytes: number; + /** + * The timestamp when the file was created. + */ created_at: number; + /** + * The name of the file as it was uploaded. + */ filename: string; /** - * The type of the file + * The type of the file such as `jsonl`, `csv`, or `parquet`. */ FileType: FileType; - LineCount: number; - - object: string; + /** + * The object type, which is always `file`. + */ + object: 'file'; + /** + * Whether the file has been parsed and analyzed for correctness for fine-tuning. + */ Processed: boolean; /** - * The purpose of the file + * The purpose of the file as it was uploaded. */ purpose: FilePurpose; } @@ -138,7 +147,6 @@ export interface FileDeleteResponse { export declare namespace Files { export { type FileList as FileList, - type FileObject as FileObject, type FilePurpose as FilePurpose, type FileResponse as FileResponse, type FileType as FileType, diff --git a/src/resources/fine-tuning.ts b/src/resources/fine-tuning.ts index a6c15c9c..b1d8c86b 100644 --- a/src/resources/fine-tuning.ts +++ b/src/resources/fine-tuning.ts @@ -157,6 +157,9 @@ export interface FinetuneEvent { model_path: string; + /** + * The object type, which is always `fine-tune-event`. + */ object: 'fine-tune-event'; param_count: number; @@ -1439,6 +1442,9 @@ export namespace FineTuningCreateParams { } export interface FineTuningDeleteParams { + /** + * Deprecated and unused parameter. + */ force?: boolean; } diff --git a/src/resources/images.ts b/src/resources/images.ts index cb96d0f9..22a168ff 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -51,6 +51,9 @@ export interface ImageFile { model: string; + /** + * The object type, which is always `list`. + */ object: 'list'; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 6eb4bb40..9c74dd40 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -51,7 +51,6 @@ export { export { Files, type FileList, - type FileObject, type FilePurpose, type FileResponse, type FileType, diff --git a/src/resources/models/models.ts b/src/resources/models/models.ts index 05611640..35be0498 100644 --- a/src/resources/models/models.ts +++ b/src/resources/models/models.ts @@ -45,7 +45,10 @@ export interface ModelObject { created: number; - object: string; + /** + * The object type, which is always `model`. + */ + object: 'model'; type: 'chat' | 'language' | 'code' | 'image' | 'embedding' | 'moderation' | 'rerank'; diff --git a/src/resources/rerank.ts b/src/resources/rerank.ts index d4291616..e7a397e1 100644 --- a/src/resources/rerank.ts +++ b/src/resources/rerank.ts @@ -7,7 +7,8 @@ import { RequestOptions } from '../internal/request-options'; export class Rerank extends APIResource { /** - * Query a reranker model + * Rerank a list of documents by relevance to a query. Returns a relevance score + * and ordering index for each document. * * @example * ```ts @@ -35,7 +36,7 @@ export interface RerankCreateResponse { model: string; /** - * Object type + * The object type, which is always `rerank`. */ object: 'rerank'; diff --git a/src/version.ts b/src/version.ts index 16bacf66..723001a9 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.37.0'; // x-release-please-version +export const VERSION = '0.38.0'; // x-release-please-version diff --git a/tests/api-resources/audio/speech.test.ts b/tests/api-resources/audio/speech.test.ts index b89d4bda..2257a6fe 100644 --- a/tests/api-resources/audio/speech.test.ts +++ b/tests/api-resources/audio/speech.test.ts @@ -8,7 +8,8 @@ const client = new Together({ }); describe('resource speech', () => { - test('create: required and optional params', async () => { + // Mock server doesn't support application/octet-stream responses + test.skip('create: required and optional params', async () => { const response = await client.audio.speech.create({ input: 'input', model: 'canopylabs/orpheus-3b-0.1-ft', diff --git a/tests/api-resources/beta/clusters/clusters.test.ts b/tests/api-resources/beta/clusters/clusters.test.ts index 055b7eee..0d036693 100644 --- a/tests/api-resources/beta/clusters/clusters.test.ts +++ b/tests/api-resources/beta/clusters/clusters.test.ts @@ -15,7 +15,7 @@ describe('resource clusters', () => { driver_version: 'CUDA_12_5_555', gpu_type: 'H100_SXM', num_gpus: 0, - region: 'us-central-8', + region: 'region', }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -33,7 +33,7 @@ describe('resource clusters', () => { driver_version: 'CUDA_12_5_555', gpu_type: 'H100_SXM', num_gpus: 0, - region: 'us-central-8', + region: 'region', cluster_type: 'KUBERNETES', duration_days: 0, shared_volume: { diff --git a/tests/api-resources/code-interpreter/code-interpreter.test.ts b/tests/api-resources/code-interpreter/code-interpreter.test.ts index ac78df53..35236dbe 100644 --- a/tests/api-resources/code-interpreter/code-interpreter.test.ts +++ b/tests/api-resources/code-interpreter/code-interpreter.test.ts @@ -8,7 +8,7 @@ const client = new Together({ }); describe('resource codeInterpreter', () => { - // Prism doesn't support callbacks yet + // Mock server doesn't support callbacks yet test.skip('execute: only required params', async () => { const responsePromise = client.codeInterpreter.execute({ code: "print('Hello, world!')", @@ -23,7 +23,7 @@ describe('resource codeInterpreter', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism doesn't support callbacks yet + // Mock server doesn't support callbacks yet test.skip('execute: required and optional params', async () => { const response = await client.codeInterpreter.execute({ code: "print('Hello, world!')", diff --git a/tests/api-resources/code-interpreter/sessions.test.ts b/tests/api-resources/code-interpreter/sessions.test.ts index 73140764..fceb79e0 100644 --- a/tests/api-resources/code-interpreter/sessions.test.ts +++ b/tests/api-resources/code-interpreter/sessions.test.ts @@ -8,7 +8,7 @@ const client = new Together({ }); describe('resource sessions', () => { - // Prism doesn't support callbacks yet + // Mock server doesn't support callbacks yet test.skip('list', async () => { const responsePromise = client.codeInterpreter.sessions.list(); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/endpoints.test.ts b/tests/api-resources/endpoints.test.ts index 49255fa0..98e821da 100644 --- a/tests/api-resources/endpoints.test.ts +++ b/tests/api-resources/endpoints.test.ts @@ -120,7 +120,10 @@ describe('resource endpoints', () => { test('listHardware: 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.listHardware({ model: 'model' }, { path: '/_stainless_unknown_path' }), + client.endpoints.listHardware( + { model: 'meta-llama/Llama-3-70b-chat-hf' }, + { path: '/_stainless_unknown_path' }, + ), ).rejects.toThrow(Together.NotFoundError); }); }); diff --git a/tests/api-resources/evals.test.ts b/tests/api-resources/evals.test.ts index 2be0b661..0728f8f0 100644 --- a/tests/api-resources/evals.test.ts +++ b/tests/api-resources/evals.test.ts @@ -75,14 +75,7 @@ describe('resource evals', () => { 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' }, - ), + client.evals.list({ limit: 0, status: 'status' }, { path: '/_stainless_unknown_path' }), ).rejects.toThrow(Together.NotFoundError); }); diff --git a/tests/api-resources/fine-tuning.test.ts b/tests/api-resources/fine-tuning.test.ts index a609cae7..bb9ce43f 100644 --- a/tests/api-resources/fine-tuning.test.ts +++ b/tests/api-resources/fine-tuning.test.ts @@ -104,7 +104,8 @@ describe('resource fineTuning', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('content: required and optional params', async () => { + // Mock server doesn't support application/octet-stream responses + test.skip('content: required and optional params', async () => { const response = await client.fineTuning.content({ ft_id: 'ft_id', checkpoint: 'merged',