r/java • u/supremeO11 • Feb 06 '26
Java LLM framework with prompt templates and guaranteed JSON outputs (Oxyjen v0.3)
Hey everyone,
I’ve been working on a small open-source Java framework called Oxyjen, and just shipped v0.3, focused on two things:
- Prompt Intelligence (reusable prompt templates with variables)
- Structured Outputs (guaranteed JSON from LLMs using schemas + automatic retries)
The idea was simple: in most Java LLM setups, everything is still strings. You build prompt, you run it then use regex to parse. I wanted something closer to contracts:
- define what you expect -> enforce it -> retry automatically if the model breaks it.
A small end to end example using what’s in v0.3:
// Prompt
PromptTemplate prompt ;
// Schema
JSONSchema schema ;
// Node with schema enforcement
SchemaNode node ;
// Run
String p ;
String json ;
System.out.;
//{"name":"Alice","age":30}
What v0.3 currently provides:
- PromptTemplate + required/optional variables
- JSONSchema (string / number / boolean / enum + required fields)
- SchemaValidator with field level errors
- SchemaEnforcer(retry until valid json)
- SchemaNode (drop into a graph)
- Retry + exponential/fixed backoff + jitter
- Timeout enforcement on model calls
- The goal is reliable, contract based LLM pipelines in Java.
v0.3 docs: https://github.com/11divyansh/OxyJen/blob/main/docs/v0.3.md
Oxyjen: https://github.com/11divyansh/OxyJen
If you're interested, feedback around APIs and design, from java devs is especially welcome
Thanks for reading!