JeevesAIEngine

AI engine that sends enriched prompts with tool definitions to OpenAI and parses the response into chat messages and/or action tool calls.

Supports a multi-turn tool loop for informational tools (like search_locations) that feed results back to the LLM before returning the final response. Action tools (like goto, teleport_to_marker) are returned to the caller for server-thread execution.

Types

Link copied to clipboard
data class AIResult(val message: String?, val actions: List<JeevesAIEngine.ToolAction>)

Result of an AI engine call. May contain a chat message, action tool calls, or both.

Link copied to clipboard
data class ToolAction(val name: String, val arguments: String)

A parsed tool call from the LLM response.

Functions

Link copied to clipboard
fun chat(client: OpenAIClient, model: String, systemPrompt: String, conversationContext: String, senderName: String, content: String, entity: JeevesEntity): JeevesAIEngine.AIResult?

Sends a chat message to the AI with world context and tool definitions.

Link copied to clipboard
fun parseIntArg(json: String, field: String): Int?

Parses tool call arguments JSON to extract an integer field.

Link copied to clipboard
fun parseStringArg(json: String, field: String): String?

Parses tool call arguments JSON to extract a string field.