/langchain4j-kotlin-examples

Port of langchain4j-examples to learn kotlin language

Primary LanguageKotlinApache License 2.0Apache-2.0

langchain4j examples written using Kotlin

This is a port of https://github.com/langchain4j/langchain4j-examples to Kotlin.

The primary reason of this port is to learn Kotlin language and langchain4j library.

Setup

The repository uses devcontainer to setup the development environment.

So far I have used vscode with devcontainer extension to setup the development environment and the experience has not been optimal w.r.t kotlin extension support.

The repository uses gradle and has multiple subprojects.

Most examples are using OPENAI_API_KEY. Make sure it is present in your environment variable.

Running the examples

./gradlew :<project_name>:run -PmainClass=<name_of_main_class>

# example
./gradlew :tutorials:run -PmainClass=_00_HelloWorld
./gradlew --console plain :rag-examples:run -PmainClass=_2_QueryCompression
# for examples that require arguments
./gradlew :<project_name>:run -PmainClass=<name_of_main_class> --args="<arguments>"
# example
./gradlew :tutorials:run -PmainClass=_03_PromptTemplate --args="simple"

About Examples

Tutorials

RAG Examples