From 2c0f25189bc19c4fde3d5f428d9a73598da3ed7c Mon Sep 17 00:00:00 2001 From: narawat Date: Tue, 4 Aug 2026 22:17:58 +0700 Subject: [PATCH] update --- src/type.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/type.jl b/src/type.jl index 63193e6..72cb728 100644 --- a/src/type.jl +++ b/src/type.jl @@ -375,7 +375,9 @@ mutable struct yiemAgent <: agent # High-level agent wrapper preprocessContext ::Union{Function, Nothing} # Convert preprocessContext()'s new Vector{agentMessage} to LLM message format - formatMsgForLLM::Function + formatMsgForLLM::Function + + llmCall::Function # Actually invoke the LLM to get a completion response # Callback invoked before executing a tool call (ask for user permission/confirmation/abort, etc..) beforeToolCall::Union{Function, Nothing} @@ -402,6 +404,7 @@ on `inputChannel` and `followUpChannel` channels concurrently. - `tools::Vector{agentTool}`: Available tools (default: empty) - `messages::Vector{agentMessage}`: Initial conversation messages (default: empty) - `formatMsgForLLM::Function`: Convert agent messages to LLM message format (default: `defaultformatMsgForLLM`) +- `llmCall::Function`: Function to invoke the LLM (required) - `preprocessContext::Union{Function, Nothing}`: Preprocess/transform messages before sending to LLM (default: `nothing`) - `beforeToolCall::Union{Function, Nothing}`: Callback invoked before executing a tool call (default: `nothing`) - `afterToolCall::Union{Function, Nothing}`: Callback invoked after executing a tool call (default: `nothing`) @@ -427,6 +430,7 @@ function yiemAgent( messages::Vector{agentMessage}=agentMessage[], preprocessContext::Union{Function, Nothing}=nothing, formatMsgForLLM::Function=defaultformatMsgForLLM, + llmCall::Function, beforeToolCall::Union{Function, Nothing}=nothing, afterToolCall::Union{Function, Nothing}=nothing, prepareNextTurn::Union{Function, Nothing}=nothing, @@ -449,6 +453,7 @@ function yiemAgent( nothing, # placeholder — replaced below preprocessContext, formatMsgForLLM, + llmCall, beforeToolCall, afterToolCall, prepareNextTurn,