Package-level declarations

Types

Link copied to clipboard
class LangChain4jChatModel(model: ChatModel, streamingModel: StreamingChatModel? = null) : ChatModel

A ChatModel that calls any LangChain4j chat model, so an agent built with toolAgent or toolLoop works with every provider LangChain4j supports.

Functions

Link copied to clipboard
fun <State> chatMessagesNode(model: ChatModel, messages: suspend (State) -> List<ChatMessage>, update: suspend (State, ChatResponse) -> State): NodeAction<State>

Creates a NodeAction that sends a whole conversation (system, user, AI and tool messages) built from the current state to model. The node gets the full ChatResponse, so it can handle tool execution requests.

Link copied to clipboard
fun <State> chatNode(model: ChatModel, prompt: suspend (State) -> String, update: suspend (State, String) -> State): NodeAction<State>

Creates a NodeAction that sends a prompt built from the current state to model and merges the text reply back into the state.

Link copied to clipboard
suspend fun ChatModel.chatSuspending(message: String): String

Sends a single user message to this ChatModel and returns the model's text reply.

suspend fun ChatModel.chatSuspending(messages: List<ChatMessage>): ChatResponse

Sends a conversation to this ChatModel and returns the full ChatResponse (AI message, tool execution requests, token usage). Like the single-message overload, it runs on Dispatchers.IO.