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
110 changes: 110 additions & 0 deletions .github/workflows/service-llm-gateway-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: llm-gateway-service

on:
push:
branches: ["master"]
paths:
- "services/llm-gateway-service/**"
pull_request:
branches: ["master"]
paths:
- "services/llm-gateway-service/**"

defaults:
run:
working-directory: services/llm-gateway-service

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
cache-dependency-path: services/llm-gateway-service/package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint

test:
name: Test
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
cache-dependency-path: services/llm-gateway-service/package-lock.json
- name: Install dependencies
run: npm ci
- name: Type-check
run: npm run build
- name: Run tests
run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: services/llm-gateway-service/coverage/lcov.info
flags: llm-gateway-service
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
if: always()

generate-openapi:
name: Generate OpenAPI Spec
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
cache-dependency-path: services/llm-gateway-service/package-lock.json
- name: Install dependencies
run: npm ci
- name: Generate OpenAPI spec
run: npm run generate:openapi
- name: Upload OpenAPI spec
uses: actions/upload-artifact@v4
with:
name: openapi-spec-llm-gateway-service
path: services/llm-gateway-service/llm-gateway-service.openapi.json

build:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: generate-openapi
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/llm-gateway-service
tags: |
type=sha,prefix=sha-
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: services/llm-gateway-service
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@ test/results/
coverage/


.vscode
.vscode

# kilo
.kilo
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![jsonpath-mapper-service CI](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-jsonpath-mapper-service.yml/badge.svg)](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-jsonpath-mapper-service.yml)
[![sql-assessment-service CI](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-sql-assessment-service.yml/badge.svg)](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-sql-assessment-service.yml)
[![fermentaladin-service CI](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-fermentaladin-service.yml/badge.svg)](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-fermentaladin-service.yml)
[![llm-gateway-service CI](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-llm-gateway-service.yml/badge.svg)](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-llm-gateway-service.yml)

## Services

Expand All @@ -14,6 +15,7 @@
| [jsonpath-mapper-service](services/jsonpath-mapper-service/README.md) | TypeScript | [![CI](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-jsonpath-mapper-service.yml/badge.svg)](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-jsonpath-mapper-service.yml) | [![codecov](https://codecov.io/gh/HTW-ALADIN/ALADIN-Services/graph/badge.svg?flag=jsonpath-mapper-service)](https://codecov.io/gh/HTW-ALADIN/ALADIN-Services?flags[0]=jsonpath-mapper-service) | JSONPath Mapper — JSON-to-JSON transformation utility exposed as a Fastify HTTP API |
| [sql-assessment-service](services/sql-assessment-service/README.md) | TypeScript | [![CI](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-sql-assessment-service.yml/badge.svg)](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-sql-assessment-service.yml) | [![codecov](https://codecov.io/gh/HTW-ALADIN/ALADIN-Services/graph/badge.svg?flag=sql-assessment-service)](https://codecov.io/gh/HTW-ALADIN/ALADIN-Services?flags[0]=sql-assessment-service) | SQL Assessment — schema analysis, SQL task generation, and query grading |
| [fermentaladin-service](services/fermentaladin-service/README.md) | Python | [![CI](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-fermentaladin-service.yml/badge.svg)](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-fermentaladin-service.yml) | — | Bioreactor fermentation simulation — ODE-based multi-phase kinetic model exposed as a FastAPI HTTP service |
| [llm-gateway-service](services/llm-gateway-service/README.md) | TypeScript | [![CI](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-llm-gateway-service.yml/badge.svg)](https://github.com/HTW-ALADIN/ALADIN-Services/actions/workflows/service-llm-gateway-service.yml) | [![codecov](https://codecov.io/gh/HTW-ALADIN/ALADIN-Services/graph/badge.svg?flag=llm-gateway-service)](https://codecov.io/gh/HTW-ALADIN/ALADIN-Services?flags[0]=llm-gateway-service) | HTTP/CLI wrapper around a self-hosted LLM Gateway instance, using the Vercel AI SDK |

## For Developers:

Expand Down
11 changes: 11 additions & 0 deletions services/llm-gateway-service/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"reporter": ["text", "html", "lcov"],
"include": ["src/**/*.ts"],
"exclude": ["test/**", "scripts/**", "src/api/index.ts", "src/cli/index.ts"],
"all": true,
"check-coverage": true,
"lines": 75,
"functions": 75,
"branches": 60,
"statements": 75
}
9 changes: 9 additions & 0 deletions services/llm-gateway-service/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
dist
coverage
.nyc_output
.git
.DS_Store
.env
*.openapi.json
*.openapi.yaml
7 changes: 7 additions & 0 deletions services/llm-gateway-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/node_modules
/dist
/coverage
/.nyc_output
.env
*.openapi.json
*.openapi.yaml
5 changes: 5 additions & 0 deletions services/llm-gateway-service/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"node-option": ["import=tsx"],
"spec": "test/**/*.test.ts",
"timeout": 10000
}
5 changes: 5 additions & 0 deletions services/llm-gateway-service/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "es5",
"singleQuote": true,
"useTabs": true
}
39 changes: 39 additions & 0 deletions services/llm-gateway-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ── Stage 1: deps ────────────────────────────────────────────────────────────
# Installs all dependencies (dev deps needed to run tsx at runtime, since the
# service is served directly from TypeScript source, matching the repo's
# other Node/TypeScript services).
FROM node:22-slim AS deps

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci

# ── Stage 2: runtime ──────────────────────────────────────────────────────────
FROM node:22-slim

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules
COPY package.json ./
COPY tsconfig.json ./
COPY src/ ./src/

# ── Environment defaults ───────────────────────────────────────────────────────
# LLM_GATEWAY_BASE_URL / LLM_GATEWAY_API_KEY must be supplied at runtime and
# point at a self-hosted LLM Gateway instance's OpenAI-compatible API.
ENV NODE_ENV=production \
PORT=8002 \
HOST=0.0.0.0

# Run as the non-root `node` user baked into the base image rather than root.
RUN chown -R node:node /app
USER node

# ── Port ───────────────────────────────────────────────────────────────────────
EXPOSE 8002

# Default entrypoint runs the HTTP API. Override the command to invoke the
# CLI instead, e.g.:
# docker run --rm <image> node_modules/.bin/tsx src/cli/index.ts generate - < request.json
CMD ["node_modules/.bin/tsx", "src/api/index.ts"]
30 changes: 30 additions & 0 deletions services/llm-gateway-service/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
IMAGE_NAME := llm-gateway-service
OPENAPI_OUT := llm-gateway-service.openapi.json
PORT ?= 8002

.PHONY: prep build test lint start clean docker-build generate-openapi

prep:
npm ci

build:
npm run build

test:
npm run test:coverage

lint:
npm run lint
npx prettier --check .

start:
PORT=$(PORT) npm run start:api

clean:
rm -rf dist/ coverage/ node_modules/ $(OPENAPI_OUT)

docker-build:
docker build -t $(IMAGE_NAME) .

generate-openapi:
npm run generate:openapi
Loading
Loading