Skip to content

Commit d5c05ab

Browse files
apscotclaude
andcommitted
README: Gradle (Kotlin, Groovy) and Maven snippets for every artifact; untrack RELEASING.md
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent a1541c4 commit d5c05ab

3 files changed

Lines changed: 206 additions & 77 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ build/
55

66
# Local-only notes
77
TESTING.md
8+
RELEASING.md

‎README.md‎

Lines changed: 205 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -90,55 +90,35 @@ Seven artifacts, all on Maven Central under `io.github.apscot`, all at version *
9090

9191
> **Needs:** JDK 17+ (that's it). About 2.5 GB of free memory for the English model. Internet on first run to fetch the weights.
9292
93-
### 📦 Get the versions right (once)
93+
### 📦 Install snippets, and the BOM
9494

95-
<details open>
96-
<summary><b>Gradle (Kotlin DSL)</b></summary>
95+
Every artifact section below shows **Gradle (Kotlin and Groovy) and Maven** snippets with the version written out, so each one works on its own.
9796

98-
```kotlin
99-
dependencies {
100-
implementation(platform("io.github.apscot:laya-bom:0.1.0"))
101-
// …then add any artifact below without a version
102-
}
103-
```
104-
</details>
105-
106-
<details>
107-
<summary><b>Gradle (Groovy)</b></summary>
108-
109-
```groovy
110-
dependencies {
111-
implementation platform('io.github.apscot:laya-bom:0.1.0')
112-
}
113-
```
114-
</details>
115-
116-
<details>
117-
<summary><b>Maven</b></summary>
118-
119-
```xml
120-
<dependencyManagement>
121-
<dependencies>
122-
<dependency>
123-
<groupId>io.github.apscot</groupId>
124-
<artifactId>laya-bom</artifactId>
125-
<version>0.1.0</version>
126-
<type>pom</type>
127-
<scope>import</scope>
128-
</dependency>
129-
</dependencies>
130-
</dependencyManagement>
131-
```
132-
</details>
97+
Using several Laya artifacts? Import the BOM once and drop the versions: see [laya-bom](#-laya-bom--version-alignment).
13398

13499
---
135100

136101
## 🔬 laya-core — the engine
137102

138103
The heart of the project: tokenizer, ModernBERT encoder, decision heads, calibration. No dependencies at all.
139104

105+
**Gradle (Kotlin DSL)**
140106
```kotlin
141-
implementation("io.github.apscot:laya-core")
107+
implementation("io.github.apscot:laya-core:0.1.0")
108+
```
109+
110+
**Gradle (Groovy DSL)**
111+
```groovy
112+
implementation 'io.github.apscot:laya-core:0.1.0'
113+
```
114+
115+
**Maven**
116+
```xml
117+
<dependency>
118+
<groupId>io.github.apscot</groupId>
119+
<artifactId>laya-core</artifactId>
120+
<version>0.1.0</version>
121+
</dependency>
142122
```
143123

144124
```java
@@ -198,8 +178,24 @@ Weights are cached in `~/.cache/laya` (set `LAYA_CACHE` to move it). Load the `A
198178

199179
Drop-in speed-up on macOS. It calls Apple's built-in Accelerate library (`cblas_sgemm`) through JNA; no native code to build.
200180

181+
**Gradle (Kotlin DSL)**
201182
```kotlin
202-
runtimeOnly("io.github.apscot:laya-accelerate")
183+
runtimeOnly("io.github.apscot:laya-accelerate:0.1.0")
184+
```
185+
186+
**Gradle (Groovy DSL)**
187+
```groovy
188+
runtimeOnly 'io.github.apscot:laya-accelerate:0.1.0'
189+
```
190+
191+
**Maven**
192+
```xml
193+
<dependency>
194+
<groupId>io.github.apscot</groupId>
195+
<artifactId>laya-accelerate</artifactId>
196+
<version>0.1.0</version>
197+
<scope>runtime</scope>
198+
</dependency>
203199
```
204200

205201
That is the whole setup. `laya-core` finds it automatically. On Linux and Windows it quietly steps aside.
@@ -217,10 +213,27 @@ Switch it off for comparison: `LAYA_BACKEND=portable`. Seeing `WARNING … jna
217213

218214
Add the starter and your Spring Boot 3 app serves the model. Nothing else to write.
219215

216+
**Gradle (Kotlin DSL)**
220217
```kotlin
221-
implementation("io.github.apscot:laya-spring-boot-starter")
218+
implementation("io.github.apscot:laya-spring-boot-starter:0.1.0")
219+
```
220+
221+
**Gradle (Groovy DSL)**
222+
```groovy
223+
implementation 'io.github.apscot:laya-spring-boot-starter:0.1.0'
224+
```
225+
226+
**Maven**
227+
```xml
228+
<dependency>
229+
<groupId>io.github.apscot</groupId>
230+
<artifactId>laya-spring-boot-starter</artifactId>
231+
<version>0.1.0</version>
232+
</dependency>
222233
```
223234

235+
The starter targets **Spring Boot 3.x** (tested with 3.4) and already brings in `spring-boot-starter-web` and, at runtime, `laya-accelerate`.
236+
224237
```properties
225238
# application.properties (all optional)
226239
laya.preload=true # load the model at startup instead of on first request
@@ -248,7 +261,23 @@ Run your app and you get:
248261
| `laya.endpoint.base-path` | Prefix for the paths | empty |
249262
</details>
250263

251-
**Run with** `--add-modules=jdk.incubator.vector -Xmx3g` for speed and headroom (Gradle `bootRun { jvmArgs(...) }`, or `JAVA_TOOL_OPTIONS="--add-modules=jdk.incubator.vector"`; note the `=`).
264+
**JVM flags** (`--add-modules=jdk.incubator.vector -Xmx3g`) give you speed and headroom:
265+
266+
```kotlin
267+
// Gradle
268+
tasks.bootRun { jvmArgs("--add-modules=jdk.incubator.vector", "-Xmx3g") }
269+
```
270+
```xml
271+
<!-- Maven -->
272+
<plugin>
273+
<groupId>org.springframework.boot</groupId>
274+
<artifactId>spring-boot-maven-plugin</artifactId>
275+
<configuration>
276+
<jvmArguments>--add-modules=jdk.incubator.vector -Xmx3g</jvmArguments>
277+
</configuration>
278+
</plugin>
279+
```
280+
For a packaged jar: `java --add-modules=jdk.incubator.vector -Xmx3g -jar app.jar` (or `JAVA_TOOL_OPTIONS="--add-modules=jdk.incubator.vector"`; note the `=`).
252281

253282
**🤔 "Why is there a `model` field? Laya *is* the model."** Correct! OpenAI's and Jev's request formats require the field, so we accept it. Use `english`, `multilingual` or `typed-decisions` to pick a checkpoint. Any other value (`laya`, `gpt-6-luna`, `banana`) means *"you choose"*: the server routes by the language of the text.
254283

@@ -260,11 +289,35 @@ Run your app and you get:
260289

261290
The brains behind the endpoints, with **no Spring dependency**. Use it to run a standalone server, or to bolt Laya onto any other framework (Quarkus, Micronaut, Javalin, Vert.x…).
262291

292+
**Gradle (Kotlin DSL)**
263293
```kotlin
264-
implementation("io.github.apscot:laya-api")
265-
runtimeOnly("io.github.apscot:laya-accelerate") // optional
294+
implementation("io.github.apscot:laya-api:0.1.0")
295+
runtimeOnly("io.github.apscot:laya-accelerate:0.1.0")
296+
```
297+
298+
**Gradle (Groovy DSL)**
299+
```groovy
300+
implementation 'io.github.apscot:laya-api:0.1.0'
301+
runtimeOnly 'io.github.apscot:laya-accelerate:0.1.0'
302+
```
303+
304+
**Maven**
305+
```xml
306+
<dependency>
307+
<groupId>io.github.apscot</groupId>
308+
<artifactId>laya-api</artifactId>
309+
<version>0.1.0</version>
310+
</dependency>
311+
<dependency>
312+
<groupId>io.github.apscot</groupId>
313+
<artifactId>laya-accelerate</artifactId>
314+
<version>0.1.0</version>
315+
<scope>runtime</scope>
316+
</dependency>
266317
```
267318

319+
(`laya-accelerate` is optional.)
320+
268321
**A standalone server in six lines**
269322

270323
```java
@@ -306,8 +359,23 @@ Limits (same as the upstream server): 64 questions, 50,000 characters of state,
306359

307360
Zero dependencies beyond the JDK. Talks to laya-java, the upstream Python `laya-serve`, or any Jev-compatible endpoint.
308361

362+
**Gradle (Kotlin DSL)**
309363
```kotlin
310-
implementation("io.github.apscot:laya-client")
364+
implementation("io.github.apscot:laya-client:0.1.0")
365+
```
366+
367+
**Gradle (Groovy DSL)**
368+
```groovy
369+
implementation 'io.github.apscot:laya-client:0.1.0'
370+
```
371+
372+
**Maven**
373+
```xml
374+
<dependency>
375+
<groupId>io.github.apscot</groupId>
376+
<artifactId>laya-client</artifactId>
377+
<version>0.1.0</version>
378+
</dependency>
311379
```
312380

313381
```java
@@ -330,8 +398,23 @@ Also: `client.decisions(Map)` for the OpenAI format, `client.models()`, and `Lay
330398

331399
Start a real Laya server for local development and integration tests, then shut it down.
332400

401+
The plugin is published to Maven Central, so tell Gradle to look there. In `settings.gradle.kts`:
402+
333403
```kotlin
334-
plugins { id("io.github.apscot.laya") version "0.1.0" }
404+
pluginManagement {
405+
repositories {
406+
mavenCentral()
407+
gradlePluginPortal()
408+
}
409+
}
410+
```
411+
412+
**Gradle (Kotlin DSL)** — `build.gradle.kts`
413+
```kotlin
414+
plugins {
415+
java
416+
id("io.github.apscot.laya") version "0.1.0"
417+
}
335418

336419
laya {
337420
model.set("aac6fef/laya-mlx") // Hugging Face id or local folder
@@ -340,6 +423,38 @@ laya {
340423
}
341424
```
342425

426+
**Gradle (Groovy DSL)** — `build.gradle` (and in `settings.gradle`: `pluginManagement { repositories { mavenCentral(); gradlePluginPortal() } }`)
427+
```groovy
428+
plugins {
429+
id 'java'
430+
id 'io.github.apscot.laya' version '0.1.0'
431+
}
432+
433+
laya {
434+
model = 'aac6fef/laya-mlx'
435+
port = 8002
436+
testIntegration = true
437+
}
438+
```
439+
440+
**Maven:** this is a Gradle plugin, so there is no Maven plugin. In a Maven build, start the server from your tests with `laya-api` (test scope):
441+
```xml
442+
<dependency>
443+
<groupId>io.github.apscot</groupId>
444+
<artifactId>laya-api</artifactId>
445+
<version>0.1.0</version>
446+
<scope>test</scope>
447+
</dependency>
448+
```
449+
```java
450+
@BeforeAll static void start() throws Exception {
451+
server = new LayaHttpServer(ModelRegistry.defaults(), "127.0.0.1", 8002, null);
452+
server.start();
453+
}
454+
@AfterAll static void stop() { server.close(); }
455+
```
456+
Run the tests with `--add-modules=jdk.incubator.vector` in the Surefire `argLine` for speed.
457+
343458
```bash
344459
./gradlew layaServe # starts it in the background and waits until healthy
345460
curl localhost:8002/health
@@ -360,10 +475,50 @@ Server logs land in `build/laya/server.log`. Other knobs: `apiKey`, `maxHeap` (d
360475

361476
A Bill of Materials so every Laya artifact stays on the same version.
362477

478+
Import it once, then add any Laya artifact **without a version**.
479+
480+
**Gradle (Kotlin DSL)**
363481
```kotlin
364-
implementation(platform("io.github.apscot:laya-bom:0.1.0"))
365-
implementation("io.github.apscot:laya-core") // no version needed
366-
implementation("io.github.apscot:laya-client")
482+
dependencies {
483+
implementation(platform("io.github.apscot:laya-bom:0.1.0"))
484+
implementation("io.github.apscot:laya-core") // no version needed
485+
implementation("io.github.apscot:laya-client")
486+
}
487+
```
488+
489+
**Gradle (Groovy DSL)**
490+
```groovy
491+
dependencies {
492+
implementation platform('io.github.apscot:laya-bom:0.1.0')
493+
implementation 'io.github.apscot:laya-core'
494+
implementation 'io.github.apscot:laya-client'
495+
}
496+
```
497+
498+
**Maven**
499+
```xml
500+
<dependencyManagement>
501+
<dependencies>
502+
<dependency>
503+
<groupId>io.github.apscot</groupId>
504+
<artifactId>laya-bom</artifactId>
505+
<version>0.1.0</version>
506+
<type>pom</type>
507+
<scope>import</scope>
508+
</dependency>
509+
</dependencies>
510+
</dependencyManagement>
511+
512+
<dependencies>
513+
<dependency>
514+
<groupId>io.github.apscot</groupId>
515+
<artifactId>laya-core</artifactId>
516+
</dependency>
517+
<dependency>
518+
<groupId>io.github.apscot</groupId>
519+
<artifactId>laya-client</artifactId>
520+
</dependency>
521+
</dependencies>
367522
```
368523

369524
---
@@ -499,7 +654,7 @@ cd laya-java
499654
gradle build
500655
```
501656

502-
Tests that need model checkpoints are skipped unless `LAYA_MODEL_DIR`, `LAYA_MODEL_DIR_MULTILINGUAL` and `LAYA_MODEL_DIR_TYPED` point at local checkpoints. A Python script in `tools/` regenerates test fixtures from the reference implementation; it is a development tool and is not part of any published artifact. Maintainers: see [RELEASING.md](RELEASING.md).
657+
Tests that need model checkpoints are skipped unless `LAYA_MODEL_DIR`, `LAYA_MODEL_DIR_MULTILINGUAL` and `LAYA_MODEL_DIR_TYPED` point at local checkpoints. A Python script in `tools/` regenerates test fixtures from the reference implementation; it is a development tool and is not part of any published artifact.
503658

504659
Issues and pull requests are welcome.
505660

‎RELEASING.md‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)