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 docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const yaml = buildKitfile({
model: {
name: 'sentiment-classifier',
path: './model/weights.pt',
format: 'pytorch',
framework: 'pytorch',
},
datasets: [
{ name: 'training-set', path: './data/train.csv', license: 'CC-BY-4.0' },
Expand Down
101 changes: 70 additions & 31 deletions docs/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,31 +427,49 @@ type Package = {

---

### `LayerCommons`

Base interface extended by all Kitfile layer types. Provides the common `path` and `description` fields.

```typescript
interface LayerCommons {
path: string;
description?: string;
}
```

| Property | Type | Description |
|---|---|---|
| `path` | `string` | Path to the artifact file or directory. |
| `description` | `string` | Human-readable description. |

---

### `Model`

Model artifact definition in a Kitfile.
Model artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase).

```typescript
interface Model {
interface Model extends LayerCommons {
name?: string;
path?: string;
parts?: ModelPart[];
framework?: string;
version?: string;
license?: string;
description?: string;
format?: string;
parameters?: Record<string, string | number>;
parts?: ModelPart[];
parameters?: unknown;
}
```

| Property | Type | Description |
|---|---|---|
| `path` | `string` | Path to the model file or directory. *(from `LayerCommons`)* |
| `description` | `string` | Human-readable description. *(from `LayerCommons`)* |
| `name` | `string` | Display name for the model. |
| `path` | `string` | Path to the model file or directory. |
| `parts` | [`ModelPart[]`](#modelpart) | Sub-parts of a composite model (e.g. split weight files). |
| `framework` | `string` | ML framework (e.g. `'pytorch'`, `'tensorflow'`). |
| `version` | `string` | Model version. |
| `license` | `string` | SPDX license identifier. |
| `description` | `string` | Human-readable description. |
| `format` | `string` | Model format (e.g. `'gguf'`, `'safetensors'`). |
| `parameters` | `Record<string, string \| number>` | Arbitrary model parameters (e.g. context length, quantization). |
| `parts` | [`ModelPart[]`](#modelpart) | Sub-parts of a composite model (e.g. split weight files). |
| `parameters` | `unknown` | Arbitrary model parameters. |
Comment thread
javisperez marked this conversation as resolved.

---

Expand All @@ -461,67 +479,88 @@ A sub-part of a composite model.

```typescript
interface ModelPart {
name?: string;
path?: string;
type?: string;
license?: string;
}
```

| Property | Type | Description |
|---|---|---|
| `name` | `string` | Display name for this part. |
| `path` | `string` | Path to the part file. |
| `type` | `string` | Part type identifier. |

---

### `Dataset`

Dataset artifact definition in a Kitfile.
Dataset artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase).

```typescript
interface Dataset {
interface Dataset extends LayerCommons {
name?: string;
path?: string;
description?: string;
license?: string;
parameters?: unknown;
}
```

| Property | Type | Description |
|---|---|---|
| `path` | `string` | Path to the dataset file or directory. *(from `LayerCommons`)* |
| `description` | `string` | Human-readable description. *(from `LayerCommons`)* |
| `name` | `string` | Display name for the dataset. |
| `license` | `string` | SPDX license identifier. |
| `parameters` | `unknown` | Arbitrary dataset parameters. |

---

### `Code`

Source code artifact definition in a Kitfile.
Source code artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase).

```typescript
interface Code {
path: string;
description: string;
interface Code extends LayerCommons {
license?: string;
}
```

| Property | Type | Description |
|---|---|---|
| `path` | `string` | Path to the source code file or directory. *(from `LayerCommons`)* |
| `description` | `string` | Human-readable description. *(from `LayerCommons`)* |
| `license` | `string` | SPDX license identifier. |

---

### `Doc`

Documentation artifact definition in a Kitfile.
Documentation artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase).

```typescript
interface Doc {
path: string;
description: string;
}
interface Doc extends LayerCommons {}
```

| Property | Type | Description |
|---|---|---|
| `path` | `string` | Path to the documentation file or directory. *(from `LayerCommons`)* |
| `description` | `string` | Human-readable description. *(from `LayerCommons`)* |

---

### `Prompt`

Prompt artifact definition in a Kitfile.
Prompt artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase).

```typescript
interface Prompt {
path?: string;
description?: string;
}
interface Prompt extends LayerCommons {}
```

| Property | Type | Description |
|---|---|---|
| `path` | `string` | Path to the prompt file or directory. *(from `LayerCommons`)* |
| `description` | `string` | Human-readable description. *(from `LayerCommons`)* |

---

## Manifest Types
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": "@kitops/kitops-ts",
"version": "0.0.3",
"version": "0.0.4",
"description": "TypeScript library for KitOps CLI",
"type": "module",
"main": "./dist/index.js",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export type {
export type {
Kitfile,
Package,
LayerCommons,
Model,
ModelPart,
Dataset,
Expand Down
58 changes: 27 additions & 31 deletions src/types/kitfile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Layer } from "./kitops.js";

export type Package = {
name?: string,
authors?: string[],
Expand All @@ -12,57 +10,55 @@ export type Package = {
* OCI layer identity fields populated after a pack or inspect operation.
* These are read-only from the registry; you don't set them when authoring a Kitfile.
*/
interface LayerInfo {
interface LayerIdentity {
digest?: string;
diffId?: string;
}

// Base interface for all layer types, which includes the common `path` and optional `description` fields.
export interface LayerCommons {
path: string;
description?: string;
}
Comment thread
javisperez marked this conversation as resolved.

export interface ModelPart {
name?: string,
path?: string,
type?: string,
license?: string;
type?: string
}

export interface Model {
export interface Model extends LayerCommons {
name?: string,
path?: string,
parts?: ModelPart[],
framework?: string;
version?: string;
license?: string,
description?: string,
format?: string,
parameters?: Record<string, string | number>
parts?: ModelPart[],
parameters?: unknown;
}

export interface Dataset {
export interface Dataset extends LayerCommons {
name?: string,
path?: string,
description?: string;
license?: string;
parameters?: unknown;
}

export interface Code {
path: string,
description: string
export interface Code extends LayerCommons {
license?: string;
}

export interface Doc {
path: string,
description: string
}
export interface Doc extends LayerCommons {}

export interface Prompt {
path?: string;
description?: string;
}
export interface Prompt extends LayerCommons {}

// Internal types for the kitfile definition, which include the OCI layer info fields
interface KitfileModelPart extends ModelPart, LayerInfo { }
interface KitfileModel extends Model, LayerInfo { }
interface KitfileDataset extends Dataset, LayerInfo { }
interface KitfileCode extends Code, LayerInfo { }
interface KitfileDoc extends Doc, LayerInfo { }
interface KitfilePrompt extends Prompt, LayerInfo { }
interface KitfileModelPart extends ModelPart, LayerIdentity { }
interface KitfileModel extends Model, LayerIdentity {
parts?: KitfileModelPart[];
}
interface KitfileDataset extends Dataset, LayerIdentity { }
interface KitfileCode extends Code, LayerIdentity { }
interface KitfileDoc extends Doc, LayerIdentity { }
interface KitfilePrompt extends Prompt, LayerIdentity { }

/**
* Typed representation of a Kitfile.
Expand Down
Loading