Skip to content

Instantly share code, notes, and snippets.

@up1
Last active September 23, 2026 08:53
Show Gist options
  • Select an option

  • Save up1/0b1a72f37f27d73adbedbbb47266dc0f to your computer and use it in GitHub Desktop.

Select an option

Save up1/0b1a72f37f27d73adbedbbb47266dc0f to your computer and use it in GitHub Desktop.
Hello laya-goish
# Request
curl http://localhost:8080/v1/decide \
-H 'Content-Type: application/json' \
-d '{
"model": "laya",
"state": "I was charged twice. Please refund the duplicate payment.",
"questions": {
"refund": {
"type": "noul",
"instructions": "Does the customer ask for money back?"
}
}
}'
# Response
{
"model": "laya",
"answers": {
"refund": {
"type": "noul",
"noul": 0.8911915421485901,
"confidence": 0.8911915421485901,
"probabilities": {
"false": 0.1088084876537323,
"true": 0.8911915421485901
},
"action": {
"act_probability": 1
}
}
},
"usage": {
"input_tokens": 45,
"output_tokens": 0,
"latency_ms": 904
}
}
# Step 0 :: install gihub cli
$brew install gh
# Step 1 :: Download binary file ของ laya-goish
./scripts/docker/fetch-release.sh v0.1.0
# Step 2 :: Download gguf file ของ Laya
$docker compose --profile tools run --rm download-models f16
$ls -lah models/laya_english_f16.gguf
... 807M Sep 23 12:19 models/laya_english_f16.gguf
# Step 3 :: Build และ Start
$docker compose up -d --build
$docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
laya-goish-laya-1 laya-goish:0.1.0 "/app/laya serve /mo…" laya 24 minutes ago Up 21 minutes (healthy) 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp
services:
laya:
build:
context: .
dockerfile: Dockerfile
image: laya-goish:0.1.0
platform: linux/amd64
ports:
- "8080:8080"
environment:
LAYA_API_KEY: ${LAYA_API_KEY:-}
volumes:
- ./models:/models:ro
command:
[
"serve",
"/models/laya_english_f16.gguf",
"--host",
"0.0.0.0",
"--port",
"8080",
"--threads",
"4",
]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
restart: unless-stopped
# One-off helper to fetch GGUF model weights into ./models before `laya`
# starts. Reuses the laya image (it already has bash + curl) but runs the
# repo's own download script instead of the server.
# docker compose --profile tools run --rm download-models f16
download-models:
build:
context: .
dockerfile: Dockerfile
image: laya-goish:0.1.0
platform: linux/amd64
profiles: ["tools"]
entrypoint: ["bash", "/repo/scripts/download-models.sh"]
command: ["f16"]
working_dir: /repo
volumes:
- ./scripts:/repo/scripts:ro
- ./models:/repo/models
FROM --platform=linux/amd64 debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY dist/laya /app/laya
RUN chmod +x /app/laya
EXPOSE 8080
ENTRYPOINT ["/app/laya"]
CMD ["serve", "/models/laya_english_f16.gguf", "--host", "0.0.0.0", "--port", "8080", "--threads", "4"]
#!/usr/bin/env bash
# Stages the `laya` executable from a GitHub release into dist/laya so the
# Dockerfile can COPY it. Requires `gh` authenticated against the private
# cogentica-ai/laya-goish repository.
set -euo pipefail
cd "$(dirname "$0")/../.."
version="${1:-v0.1.0}"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
gh release download "$version" --repo cogentica-ai/laya-goish \
--pattern "laya-goish-${version}-linux-x86_64.tar.gz" --pattern SHA256SUMS \
--dir "$tmp"
(cd "$tmp" && sha256sum -c SHA256SUMS)
tar -xzf "$tmp/laya-goish-${version}-linux-x86_64.tar.gz" -C "$tmp"
mkdir -p dist
cp "$tmp/laya-goish-${version}-linux-x86_64/laya" dist/laya
chmod +x dist/laya
echo "Staged dist/laya from release ${version}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment