Jlama is a modern LLM inference engine for Java
Model Support:
Implements:
Jlama requires Java 20 or later and it built with the following backends:
Add LLM Inference directly to your Java application. To learn more read the DeepWiki docs.
Jlama includes a command line tool that makes it easy to use.
The CLI can be run with jbang.
#Install jbang (or https://www.jbang.dev/download/)
curl -Ls https://sh.jbang.dev | bash -s - app setup
#Install Jlama CLI (will ask if you trust the source)
jbang app install --force jlama@tjakeNow that you have jlama installed you can download a model from huggingface and chat with it. Note I have pre-quantized models available at https://hf.co/tjake
# Run the openai chat api and UI on a model
jlama restapi tjake/Llama-3.2-1B-Instruct-JQ4 --auto-downloadopen browser to http://localhost:8080/
…The main purpose of Jlama is to provide a simple way to use large language models in Java.
The simplest way to embed Jlama in your app is with the Langchain4j Integration.
If you would like to embed Jlama without langchain4j, add the following maven dependencies to your project:
com.github.tjake
jlama-core
${jlama.version}
com.github.tjake
jlama-native
${os.detected.name}-${os.detected.arch}
${jlama.version}
jlama uses Java 21 preview features. You can enable the features globally with:
export JDK_JAVA_OPTIONS="--add-modules jdk.incubator.vector --enable-preview"or enable the preview features by configuring maven compiler and failsafe plugins.
Then you can use the Model classes to run models:
…Or you can use a Builder API:
…You can simplify promptSupport using:
…See DEVELOPER_GUIDE.md for more information.
If you like or are using this project to build your own, please give us a star. It's a free way to show your support.
The code is available under Apache License.
If you find this project helpful in your research, please cite this work at
@misc{jlama2024,
title = {Jlama: A modern Java inference engine for large language models},
url = {https://github.com/tjake/jlama},
author = {T Jake Luciani},
month = {January},
year = {2024}
}No open issues yet, or sync has not completed.