{"id":27294457,"url":"https://github.com/nerdalert/ilab-api-server","last_synced_at":"2025-04-11T22:53:11.481Z","repository":{"id":267229381,"uuid":"900604402","full_name":"nerdalert/ilab-api-server","owner":"nerdalert","description":"REST API serving Instructlab routes","archived":false,"fork":false,"pushed_at":"2025-01-20T05:17:37.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T22:53:11.224Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nerdalert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-09T06:02:19.000Z","updated_at":"2025-01-20T05:17:39.000Z","dependencies_parsed_at":"2024-12-09T07:19:49.748Z","dependency_job_id":"810d3b55-4e22-4152-ba11-14487466d4d7","html_url":"https://github.com/nerdalert/ilab-api-server","commit_stats":null,"previous_names":["nerdalert/ilab-api-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdalert%2Filab-api-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdalert%2Filab-api-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdalert%2Filab-api-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdalert%2Filab-api-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nerdalert","download_url":"https://codeload.github.com/nerdalert/ilab-api-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492951,"owners_count":21113162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-11T22:53:10.703Z","updated_at":"2025-04-11T22:53:11.471Z","avatar_url":"https://github.com/nerdalert.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ilab API Server\n\n## Overview\n\nThis is an Ilab API Server that is a temporary set of APIs for service developing apps against [InstructLab](https://github.com/instructlab/). It provides endpoints for model management, data generation, training, job tracking and job logging.\n\n## Quickstart\n\n### Prerequisites\n\n- Ensure that the required directories (`base-dir` and `taxonomy-path`) exist and are accessible and Go is installed in the $PATH.\n\n### Install Dependencies\n\nTo install the necessary dependencies, run:\n\n```bash\ngo mod download\n```\n\n### Run the Server\n\n#### For macOS with Metal (MPS):\n\n```bash\ngo run main.go --base-dir /path/to/base-dir --taxonomy-path /path/to/taxonomy --osx\n```\n\n#### For CUDA-enabled environments:\n\n```bash\ngo run main.go --base-dir /path/to/base-dir --taxonomy-path /path/to/taxonomy --cuda\n```\n\n#### For a RHEL AI machine:\n\n- If you're operating on a Red Hat Enterprise Linux AI (RHEL AI) machine, and the ilab binary is already available in your $PATH, you don't need to specify the --base-dir. Additionally, pass CUDA support with `--cuda`.\n\n```bash\ngo run main.go --taxonomy-path ~/.local/share/instructlab/taxonomy/ --rhelai --cuda\n```\n\nThe `--rhelai` flag indicates that the ilab binary is available in the system's $PATH and does not require a virtual environment.\nWhen using `--rhelai`, the `--base-dir` flag is not required since it will be in a known location at least for meow.\n\n### Example command with paths:\n\nHere's an example command for running the server on a macOS machine with Metal support:\n\n```bash\ngo run main.go --base-dir /Users/user/code/instructlab --taxonomy-path ~/.local/share/instructlab/taxonomy/ --osx\n```\n\n## API Doc\n\n### Models\n\n#### Get Models\n**Endpoint**: `GET /models`  \nFetches the list of available models.\n\n- **Response**:\n  ```json\n  [\n    {\n      \"name\": \"model-name\",\n      \"last_modified\": \"timestamp\",\n      \"size\": \"size-string\"\n    }\n  ]\n  ```\n\n### Data\n\n#### Get Data\n**Endpoint**: `GET /data`  \nFetches the list of datasets.\n\n- **Response**:\n  ```json\n  [\n    {\n      \"dataset\": \"dataset-name\",\n      \"created_at\": \"timestamp\",\n      \"file_size\": \"size-string\"\n    }\n  ]\n  ```\n\n#### Generate Data\n**Endpoint**: `POST /data/generate`  \nStarts a data generation job.\n\n- **Request**: None\n- **Response**:\n  ```json\n  {\n    \"job_id\": \"generated-job-id\"\n  }\n  ```\n\n### Jobs\n\n#### List Jobs\n**Endpoint**: `GET /jobs`  \nFetches the list of all jobs.\n\n- **Response**:\n  ```json\n  [\n    {\n      \"job_id\": \"job-id\",\n      \"status\": \"running/finished/failed\",\n      \"cmd\": \"command\",\n      \"branch\": \"branch-name\",\n      \"start_time\": \"timestamp\",\n      \"end_time\": \"timestamp\"\n    }\n  ]\n  ```\n\n#### Job Status\n**Endpoint**: `GET /jobs/{job_id}/status`  \nFetches the status of a specific job.\n\n- **Response**:\n  ```json\n  {\n    \"job_id\": \"job-id\",\n    \"status\": \"running/finished/failed\",\n    \"branch\": \"branch-name\",\n    \"command\": \"command\"\n  }\n  ```\n\n#### Job Logs\n**Endpoint**: `GET /jobs/{job_id}/logs`  \nFetches the logs of a specific job.\n\n- **Response**: Text logs of the job.\n\n### Training\n\n#### Start Training\n**Endpoint**: `POST /model/train`  \nStarts a training job.\n\n- **Request**:\n  ```json\n  {\n    \"modelName\": \"name-of-the-model\",\n    \"branchName\": \"name-of-the-branch\"\n  }\n  ```\n  \n  **Note**: The `modelName` can be provided **with or without** the `models/` prefix. Examples:\n  \n  - Without prefix: `\"granite-7b-lab-Q4_K_M.gguf\"`\n  - With prefix: `\"models/granite-7b-starter\"`\n  \n  The server will handle the prefix to construct the correct model path.\n\n- **Response**:\n  ```json\n  {\n    \"job_id\": \"training-job-id\"\n  }\n  ```\n\n### Pipeline\n\n#### Generate and Train Pipeline\n**Endpoint**: `POST /pipeline/generate-train`  \nCombines data generation and training into a single pipeline job.\n\n- **Request**:\n  ```json\n  {\n    \"modelName\": \"name-of-the-model\",\n    \"branchName\": \"name-of-the-branch\"\n  }\n  ```\n  \n  **Note**: Similar to the training endpoint, `modelName` can be with or without the `models/` prefix.\n\n- **Response**:\n  ```json\n  {\n    \"pipeline_job_id\": \"pipeline-job-id\"\n  }\n  ```\n\n### Model Serving\n\n#### Serve Latest Checkpoint\n**Endpoint**: `POST /model/serve-latest`  \nServes the latest model checkpoint on port `8001`.\n\n- **Response**:\n  ```json\n  {\n    \"status\": \"model process started\",\n    \"job_id\": \"serve-job-id\"\n  }\n  ```\n\n#### Serve Base Model\n**Endpoint**: `POST /model/serve-base`  \nServes the base model on port `8000`.\n\n- **Response**:\n  ```json\n  {\n    \"status\": \"model process started\",\n    \"job_id\": \"serve-job-id\"\n  }\n  ```\n\n## Handling Model Names with or without `models/` Prefix\n\nThe server is designed to handle `modelName` inputs **both with and without** the `models/` prefix to prevent path duplication. Here’s how it works:\n\n- **Without Prefix**:\n  - **Input**: `\"granite-7b-lab-Q4_K_M.gguf\"`\n  - **Constructed Path**: `~/.cache/instructlab/models/granite-7b-lab-Q4_K_M.gguf`\n\n- **With Prefix**:\n  - **Input**: `\"models/granite-7b-starter\"`\n  - **Constructed Path**: `~/.cache/instructlab/models/granite-7b-starter`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerdalert%2Filab-api-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnerdalert%2Filab-api-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerdalert%2Filab-api-server/lists"}