A sample application that uses LangChain4J to interface with LLMs.
./gradlew assemble
You’ll need an API key for each LLM. So just follow the instructions linked below to obtain your API keys.
Save the keys to the app/src/main/resources/.env
file as the corresponding
..._API_KEY
environment variable. You can use
app/src/main/resources/.env.template
as a guide to structure your .env
file.
To run against OpenAI's ChatGPT:
./gradlew run --args="--model openai"
To run against Anthropic's Claude:
./gradlew run --args="--model anthropic"
To run against Google's Gemini:
./gradlew run --args="--model google"
./gradlew check