diff --git a/src/agentCore.jl b/src/agentCore.jl index 4de1215..7031295 100644 --- a/src/agentCore.jl +++ b/src/agentCore.jl @@ -202,7 +202,6 @@ function _process_message(agent::yiemAgent)::assistantMessage push!(agent._state.messages, user_msg) end - # call agent.prepareContext() preparedContext = agent.prepareContext(agent._state) @@ -998,7 +997,7 @@ function executeToolCalls( hasSequential = false for tc in toolCalls for t in context.tools - if t.name == tc.name && get(t.executionMode, "parallel") == "sequential" + if t.name == tc.name && !t.parallelToolExecute hasSequential = true break end diff --git a/src/type.jl b/src/type.jl index f573e67..0da023f 100644 --- a/src/type.jl +++ b/src/type.jl @@ -13,6 +13,21 @@ struct Usage outputTokens::Int64 end +# ------------------------------------------------------------------------------------------------ # +# Message content types # +# ------------------------------------------------------------------------------------------------ # + +abstract type messageContent end # Base type for message content + +struct textContent <: messageContent # Plain text message content + text::String # The text content +end + +struct imageContent <: messageContent # Image message content + data::String # Base64-encoded image data + mimeType::String # MIME type (e.g., "image/png") +end + # ------------------------------------------------------------------------------------------------ # # Message types # @@ -128,22 +143,6 @@ function toolResultMessage(; role="tool", toolCallId="", toolName="", return toolResultMessage(role, toolCallId, toolName, content, details, usage, addedToolNames, isError, timestamp) end - -# ------------------------------------------------------------------------------------------------ # -# Message content types # -# ------------------------------------------------------------------------------------------------ # - -abstract type messageContent end # Base type for message content - -struct textContent <: messageContent # Plain text message content - text::String # The text content -end - -struct imageContent <: messageContent # Image message content - data::String # Base64-encoded image data - mimeType::String # MIME type (e.g., "image/png") -end - # ------------------------------------------------------------------------------------------------ # # Tool types # # ------------------------------------------------------------------------------------------------ # @@ -158,7 +157,7 @@ A tool available to the agent. - `parameters::TParameters`: Tool parameters schema (JSON schema) - `execute::Function`: Tool execution function - `prepareArguments::Union{Function, Nothing}`: Optional argument preparation callback -- `parallelExecute::Union{toolparallelExecute, Nothing}`: Override: run tool calls sequentially or in parallel +- `parallelToolExecute::Bool`: Override: run tool calls sequentially or in parallel # Returns - A new `agentTool` instance @@ -170,7 +169,7 @@ struct agentTool{TParameters, TDetails} # A tool available to the agent parameters::TParameters # Tool parameters schema (JSON schema) execute::Function # Tool execution function prepareArguments::Union{Function, Nothing} # Optional argument preparation callback - parallelExecute::Union{toolparallelExecute, Nothing} # Override: run tool calls sequentially or in parallel + parallelToolExecute::Bool # Override: run tool calls sequentially or in parallel end @@ -346,17 +345,6 @@ struct agentToolResult terminate::Bool end -""" -Function type for parallel execution override on a tool. - -# Arguments -- Context for parallel execution - -# Returns -- `agentToolCallBatch`: The result batch from parallel execution -""" -const toolparallelExecute = Function - """ Context passed to the `beforeToolCall` hook.