Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.37.0"
".": "0.37.1"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -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
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-af83378ff78b22014ab7358ae8aa060cc25e4b818e798f2e09d6deb1226e0ba6.yml
openapi_spec_hash: 113f84b407b43bd991ee6d1afb6efb49
config_hash: 67b76d1064bef2e591cadf50de08ad19
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.37.1 (2026-02-11)

Full Changelog: [v0.37.0...v0.37.1](https://github.com/togethercomputer/together-typescript/compare/v0.37.0...v0.37.1)

### Bug Fixes

* **client:** avoid removing abort listener too early ([1376258](https://github.com/togethercomputer/together-typescript/commit/137625849136205dc82f3b2493c96709365933ba))


### Chores

* **internal:** avoid type checking errors with ts-reset ([70ad44b](https://github.com/togethercomputer/together-typescript/commit/70ad44b46220b19de3a0def616593e2382bda8dd))
* Update descriptions for jig queue methods and properties ([7fdfcca](https://github.com/togethercomputer/together-typescript/commit/7fdfcca72618b3ea51d38ac01f91e6a08ad0863e))

## 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)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "together-ai",
"version": "0.37.0",
"version": "0.37.1",
"description": "The official TypeScript library for the Together API",
"author": "Together <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,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(
Expand Down Expand Up @@ -599,7 +599,6 @@ export class Together {
return await this.fetch.call(undefined, url, fetchOptions);
} finally {
clearTimeout(timeout);
if (signal) signal.removeEventListener('abort', abort);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
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);
Expand Down Expand Up @@ -121,7 +121,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
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) {
Expand Down
129 changes: 111 additions & 18 deletions src/resources/beta/jig/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,107 +6,188 @@ 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<QueueRetrieveResponse> {
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<QueueCancelResponse> {
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<QueueMetricsResponse> {
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<QueueSubmitResponse> {
return this._client.post('/queue/submit', { body, ...options });
}
}

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<string>;
}

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;
}

Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.37.0'; // x-release-please-version
export const VERSION = '0.37.1'; // x-release-please-version