Package-level declarations

Types

Link copied to clipboard
class ChatSession(broker: LlmBroker, model: String, systemPrompt: String? = null, tools: List<LlmTool> = emptyList(), config: CompletionConfig = CompletionConfig())

Multi-turn chat coordinator on top of an LlmBroker.

Link copied to clipboard
data class CompletionConfig(val temperature: Double = DEFAULT_TEMPERATURE, val numCtx: Int = DEFAULT_NUM_CTX, val maxTokens: Int = DEFAULT_MAX_TOKENS, val numPredict: Int = DEFAULT_NUM_PREDICT, val reasoningEffort: ReasoningEffort? = null, val maxToolIterations: Int? = DEFAULT_MAX_TOOL_ITERATIONS, val responseFormat: ResponseFormat? = null)

Configuration for LLM completion requests.

Link copied to clipboard
data class CompletionEvidence(val finishReason: String? = null, val usage: JsonObject? = null, val providerModel: String? = null, val metadata: JsonObject? = null)

What the provider reported about how a streamed turn ended.

Link copied to clipboard
sealed interface CompletionStreamEvent

Event emitted by LlmBroker.generateStreamEvents for a single turn.

Link copied to clipboard

Vector embedding provider.

Link copied to clipboard
sealed interface GatewayStreamEvent

Low-level stream event emitted by com.mojentic.llm.gateway.LlmGateway.stream.

Link copied to clipboard
@Serializable
data class ImageContent(val data: String, val mimeType: String) : MessageContent

Base64-encoded image content. mimeType follows IANA naming, e.g. image/png, image/jpeg.

Link copied to clipboard
class LlmBroker(gateway: LlmGateway, tracer: Tracer = NullTracer, toolRunner: ToolRunner = SerialToolRunner(), json: Json = DEFAULT_JSON)

Coordinator above an LlmGateway that handles tool execution and provides a Kotlin-idiomatic chat surface.

Link copied to clipboard
interface LlmGateway

Provider-agnostic LLM gateway.

Link copied to clipboard
data class LlmGatewayResponse(val content: String? = null, val toolCalls: List<LlmToolCall> = emptyList(), val thinking: String? = null, val structuredJson: JsonElement? = null, val usage: JsonObject? = null, val providerModel: String? = null, val finishReason: String? = null, val metadata: JsonObject? = null)

A non-streaming response from an com.mojentic.llm.gateway.LlmGateway.

Link copied to clipboard
@Serializable
data class LlmMessage(val role: MessageRole = MessageRole.User, val content: String? = null, val contentParts: List<MessageContent>? = null, val toolCalls: List<LlmToolCall>? = null)

A message in an LLM conversation. Accumulates during a chat session.

Link copied to clipboard
@Serializable
data class LlmToolCall(val id: String? = null, val name: String, val arguments: JsonObject)

A single tool-call request emitted by the LLM.

Link copied to clipboard
@Serializable
sealed interface MessageContent

A typed content part of a message. LlmMessage carries either plain text via LlmMessage.content, or — when richer payloads are needed — a list of MessageContent parts via LlmMessage.contentParts.

Link copied to clipboard
@Serializable
enum MessageRole : Enum<MessageRole>

Role of a message in an LLM conversation.

Link copied to clipboard

Reasoning effort hint for models that support extended thinking.

Link copied to clipboard
sealed interface ResponseFormat

Output format requested from the provider through CompletionConfig.responseFormat.

Link copied to clipboard
sealed interface StreamErrorReason
Link copied to clipboard
sealed interface StreamEvent

Public stream event surfaced by com.mojentic.llm.Broker.LlmBroker.stream.

Link copied to clipboard

Optional gateway capability behind LlmBroker.generateStreamEvents.

Link copied to clipboard
@Serializable
data class TextContent(val text: String) : MessageContent
Link copied to clipboard

Pluggable tokenizer for cost-aware context-window management.

Functions

Link copied to clipboard

Plain message text for provider roles that accept text only.