/** * Repository backed by a HuggingFace organization. */ export interface HuggingFaceRepository { type: "hugging_face"; organization: string; } /** * Repository backed by a Narrative company. */ export interface NarrativeRepository { type: "narrative"; company_id: number; } /** * Discriminated union describing where a model's artifacts are stored. */ export type ModelRepository = HuggingFaceRepository | NarrativeRepository; /** * No companies are allowed to participate. */ export interface ModelParticipantsNone { type: "none"; } /** * All companies are allowed to participate. */ export interface ModelParticipantsAll { type: "all"; } /** * Anyone, including unauthenticated callers. `view` only. */ export interface ModelParticipantsAnonymous { type: "anonymous"; } /** * Only the listed companies are allowed to participate. `company_ids` must be non-empty. */ export interface ModelParticipantsInclusion { type: "inclusion"; company_ids: number[]; } /** * Every company except the listed ones. `company_ids` must be non-empty. */ export interface ModelParticipantsExclusion { type: "exclusion"; company_ids: number[]; } /** * Who may view a model. Adds the `anonymous` variant the other two lack — see * `ViewCollaborators` in `datashops-protocol`. */ export type ModelViewParticipants = ModelParticipantsAnonymous | ModelParticipantsAll | ModelParticipantsNone | ModelParticipantsInclusion | ModelParticipantsExclusion; /** * Who may train on, or deploy, a model — see `TrainCollaborators` / * `DeployCollaborators` in `datashops-protocol`. */ export type ModelParticipants = ModelParticipantsAll | ModelParticipantsNone | ModelParticipantsInclusion | ModelParticipantsExclusion; /** * Defines which companies may view, train on, and deploy a model. Maps to Scala * `ModelTrainingCollaborators`, which backs both `ModelResponse.collaborators` and * `TrainRequest.OutputModel.collaborators`. All three keys are required. */ export interface ModelCollaborators { view: ModelViewParticipants; train: ModelParticipants; deploy: ModelParticipants; } /** * Current status of a model. */ export type ModelStatus = "active" | "archived"; export interface Model { id: number; company_id: number; name: string; /** A human readable name for the model. Always emitted (Scala non-Option). */ display_name: string; license_id: string; repository: ModelRepository; collaborators: ModelCollaborators; description?: string; tags: string[]; base_model_id: number | null; created_at: string; updated_at: string | null; archived_at: string | null; version: number; status: ModelStatus; } export interface CreateModelRequest { name: string; license_id: string; repository: ModelRepository; collaborators: ModelCollaborators; description?: string; tags?: string[]; base_model_id?: number; display_name?: string; } export interface UpdateModelRequest { description?: string; tags?: string[]; license_id?: string; display_name?: string; } /** * Repository type values usable to filter models via `GET /models`. */ export type ModelRepositoryType = "hugging_face" | "narrative"; /** * Sort order values usable with `GET /models`. */ export type ModelOrderBy = "created_at_asc" | "created_at_desc"; /** * Query parameters accepted by `GET /models`. */ export interface GetModelsParams { page?: number; per_page?: number; repository_type?: ModelRepositoryType | ModelRepositoryType[]; order_by?: ModelOrderBy; }