Skip to content
Merged
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 .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 156
configured_endpoints: 157
1 change: 1 addition & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ client.example.list(undefined, { headers: { ... } });
- `client.models.list()`
- `client.endpoints.list()`
- `client.endpoints.listHardware()`
- `client.projects.list()`
- `client.evals.list()`

</details>
Expand Down
10 changes: 10 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,16 @@ Methods:
- <code title="post /endpoints/{endpointId}/adapters">client.endpoints.adapters.<a href="./src/resources/endpoints/adapters.ts">add</a>(endpointID, { ...params }) -> AdapterAddResponse</code>
- <code title="delete /endpoints/{endpointId}/adapters">client.endpoints.adapters.<a href="./src/resources/endpoints/adapters.ts">remove</a>(endpointID, { ...params }) -> AdapterRemoveResponse</code>

# Projects

Types:

- <code><a href="./src/resources/projects.ts">Project</a></code>

Methods:

- <code title="get /projects">client.projects.<a href="./src/resources/projects.ts">list</a>({ ...params }) -> ProjectsCursorPagination</code>

# Rerank

Types:
Expand Down
2 changes: 1 addition & 1 deletion scripts/mock

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import {
FinetuneResponse,
} from './resources/fine-tuning';
import { ImageDataB64, ImageDataURL, ImageFile, ImageGenerateParams, Images } from './resources/images';
import { Project, ProjectListParams, Projects, ProjectsCursorPagination } from './resources/projects';
import { Rerank, RerankCreateParams, RerankCreateResponse } from './resources/rerank';
import { VideoCreateParams, VideoJob, Videos } from './resources/videos';
import { Audio, AudioFile, AudioSpeechStreamChunk } from './resources/audio/audio';
Expand Down Expand Up @@ -894,6 +895,7 @@ export class Together {
audio: API.Audio = new API.Audio(this);
models: API.Models = new API.Models(this);
endpoints: API.Endpoints = new API.Endpoints(this);
projects: API.Projects = new API.Projects(this);
rerank: API.Rerank = new API.Rerank(this);
batches: API.Batches = new API.Batches(this);
evals: API.Evals = new API.Evals(this);
Expand All @@ -912,6 +914,7 @@ Together.Videos = Videos;
Together.Audio = Audio;
Together.Models = Models;
Together.Endpoints = Endpoints;
Together.Projects = Projects;
Together.Rerank = Rerank;
Together.Batches = Batches;
Together.Evals = Evals;
Expand Down Expand Up @@ -1039,6 +1042,13 @@ export declare namespace Together {
type EndpointListHardwareParams as EndpointListHardwareParams,
};

export {
Projects as Projects,
type Project as Project,
type ProjectsCursorPagination as ProjectsCursorPagination,
type ProjectListParams as ProjectListParams,
};

export {
Rerank as Rerank,
type RerankCreateResponse as RerankCreateResponse,
Expand Down
12 changes: 12 additions & 0 deletions src/resources/beta/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,12 @@ export interface SupportedModelDeploymentProfile {
*/
quantization: string;

/**
* Adapter serving mode for deployments created from this profile; omitted when no
* certified config is pinned.
*/
adapterMode?: 'ADAPTER_MODE_FIXED' | 'ADAPTER_MODE_DYNAMIC' | 'ADAPTER_MODE_DISABLED';

/**
* @deprecated Deprecated. Use `parallelism`. Legacy tensor-parallel shard count
* for the profile.
Expand Down Expand Up @@ -899,6 +905,12 @@ export interface ModelListRevisionsParams {
}

export interface ModelListSupportedParams extends CursorPaginationParams {
/**
* Filter models to those with a deployment profile in the selected adapter serving
* mode.
*/
adapterMode?: 'ADAPTER_MODE_FIXED' | 'ADAPTER_MODE_DYNAMIC' | 'ADAPTER_MODE_DISABLED';

/**
* Filter models by input modality.
*/
Expand Down
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export {
type ModelListParams,
type ModelUploadParams,
} from './models/models';
export { Projects, type Project, type ProjectListParams, type ProjectsCursorPagination } from './projects';
export { Rerank, type RerankCreateResponse, type RerankCreateParams } from './rerank';
export { Videos, type VideoJob, type VideoCreateParams } from './videos';
export { type WhoamiResponse } from './top-level';
59 changes: 59 additions & 0 deletions src/resources/projects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../core/resource';
import { CursorPagination, type CursorPaginationParams, PagePromise } from '../core/pagination';
import { RequestOptions } from '../internal/request-options';

export class Projects extends APIResource {
/**
* Retrieve a list of accessible projects.
*/
list(
query: ProjectListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<ProjectsCursorPagination, Project> {
return this._client.getAPIList('/projects', CursorPagination<Project>, { query, ...options });
}
}

export type ProjectsCursorPagination = CursorPagination<Project>;

/**
* A project the authenticated caller can access.
*/
export interface Project {
/**
* Unique project identifier.
*/
id: string;

/**
* Display name of the project.
*/
name: string;

/**
* ID of the organization that owns the project.
*/
organization_id: string;

/**
* Display name of the organization that owns the project.
*/
organization_name: string;

/**
* Customer-facing project slug.
*/
slug: string;
}

export interface ProjectListParams extends CursorPaginationParams {}

export declare namespace Projects {
export {
type Project as Project,
type ProjectsCursorPagination as ProjectsCursorPagination,
type ProjectListParams as ProjectListParams,
};
}
1 change: 1 addition & 0 deletions tests/api-resources/beta/models/models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ describe('resource models', () => {
await expect(
client.beta.models.listSupported(
{
adapterMode: 'ADAPTER_MODE_FIXED',
after: 'after',
limit: 0,
modality: 'MODALITY_TEXT',
Expand Down
28 changes: 28 additions & 0 deletions tests/api-resources/projects.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// 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 projects', () => {
test('list', async () => {
const responsePromise = client.projects.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);
});

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.projects.list({ after: 'after', limit: 0 }, { path: '/_stainless_unknown_path' }),
).rejects.toThrow(Together.NotFoundError);
});
});
Loading