update
This commit is contained in:
+35
-12
@@ -1,6 +1,29 @@
|
|||||||
module type
|
module type
|
||||||
export agentContext, yiemAgent,
|
export Timestamp,
|
||||||
run_agent, take_response, follow_up, stop_agent
|
# Abstract types
|
||||||
|
messageContent, agentMessage, agent,
|
||||||
|
# Model types
|
||||||
|
modelCost, llmModel, llmUsage,
|
||||||
|
# Message content types
|
||||||
|
textContent, imageContent,
|
||||||
|
# Message types
|
||||||
|
userMessage, assistantMessage, toolResultMessage,
|
||||||
|
# Tool types
|
||||||
|
agentTool,
|
||||||
|
# Context types
|
||||||
|
agentContext, agentState, agentToolCall, prepareNextTurnContext,
|
||||||
|
# Loop & execution types
|
||||||
|
agentLoopConfig, abortSignal, agentToolResult,
|
||||||
|
assistantMsgCtx, afterCtx,
|
||||||
|
# Event types
|
||||||
|
toolExecStartEvent, toolExecUpdateEvent, toolExecEndEvent,
|
||||||
|
# Agent
|
||||||
|
yiemAgent,
|
||||||
|
# Tool call lifecycle types
|
||||||
|
preparedToolCall, immediateOutcome, executedOutcome, finalizedOutcome,
|
||||||
|
agentToolCallBatch,
|
||||||
|
# Functions (defined elsewhere)
|
||||||
|
run_agent, take_response, follow_up, stop_agent
|
||||||
|
|
||||||
|
|
||||||
using Dates, UUIDs, DataStructures, JSON, NATS, Base.Threads
|
using Dates, UUIDs, DataStructures, JSON, NATS, Base.Threads
|
||||||
@@ -597,7 +620,7 @@ carrying the full context through the call chain.
|
|||||||
struct preparedToolCall
|
struct preparedToolCall
|
||||||
tool::agentTool # The resolved tool definition from the context
|
tool::agentTool # The resolved tool definition from the context
|
||||||
toolCall::agentToolCall # The original tool call from the assistant
|
toolCall::agentToolCall # The original tool call from the assistant
|
||||||
args::any # Validated (and coerced) argument values
|
args::Any # Validated (and coerced) argument values
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -615,7 +638,7 @@ corrected arguments after a validation failure.
|
|||||||
|
|
||||||
# Fields
|
# Fields
|
||||||
- `result::agentToolResult`: The pre-computed tool result
|
- `result::agentToolResult`: The pre-computed tool result
|
||||||
- `isError::bool`: Whether this outcome represents an error
|
- `isError::Bool`: Whether this outcome represents an error
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
```julia
|
```julia
|
||||||
@@ -634,7 +657,7 @@ immediateOutcome(
|
|||||||
"""
|
"""
|
||||||
struct immediateOutcome
|
struct immediateOutcome
|
||||||
result::agentToolResult # The pre-computed tool result
|
result::agentToolResult # The pre-computed tool result
|
||||||
isError::bool # Whether this outcome represents an error
|
isError::Bool # Whether this outcome represents an error
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -649,7 +672,7 @@ whether to transform it or replace it entirely.
|
|||||||
|
|
||||||
# Fields
|
# Fields
|
||||||
- `result::agentToolResult`: The tool's execution result
|
- `result::agentToolResult`: The tool's execution result
|
||||||
- `isError::bool`: Whether execution raised an error
|
- `isError::Bool`: Whether execution raised an error
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
```julia
|
```julia
|
||||||
@@ -668,7 +691,7 @@ executedOutcome(
|
|||||||
"""
|
"""
|
||||||
struct executedOutcome
|
struct executedOutcome
|
||||||
result::agentToolResult # The tool's execution result
|
result::agentToolResult # The tool's execution result
|
||||||
isError::bool # Whether execution raised an error
|
isError::Bool # Whether execution raised an error
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -689,7 +712,7 @@ and swappable.
|
|||||||
# Fields
|
# Fields
|
||||||
- `toolCall::agentToolCall`: The original tool call reference
|
- `toolCall::agentToolCall`: The original tool call reference
|
||||||
- `result::agentToolResult`: The final tool result (post-afterToolCall)
|
- `result::agentToolResult`: The final tool result (post-afterToolCall)
|
||||||
- `isError::bool`: Whether the call failed or was blocked
|
- `isError::Bool`: Whether the call failed or was blocked
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
```julia
|
```julia
|
||||||
@@ -703,7 +726,7 @@ finalizedOutcome(tc, agentToolResult(content, details, usage, true), false)
|
|||||||
struct finalizedOutcome
|
struct finalizedOutcome
|
||||||
toolCall::agentToolCall # The original tool call reference
|
toolCall::agentToolCall # The original tool call reference
|
||||||
result::agentToolResult # The final tool result (post-afterToolCall)
|
result::agentToolResult # The final tool result (post-afterToolCall)
|
||||||
isError::bool # Whether the call failed or was blocked
|
isError::Bool # Whether the call failed or was blocked
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -749,8 +772,8 @@ agentToolCallBatch(toolResultMessage[], false)
|
|||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
struct agentToolCallBatch
|
struct agentToolCallBatch
|
||||||
messages::vector{toolResultMessage} # Tool result messages for this batch
|
messages::Vector{toolResultMessage} # Tool result messages for this batch
|
||||||
terminate::bool # Whether the batch should terminate the loop
|
terminate::Bool # Whether the batch should terminate the loop
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -29,10 +29,10 @@ julia> YiemAgent.clearhistory(agent)
|
|||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
function clearhistory(a::T) where {T<:agent}
|
function clearhistory(a::T) where {T<:agent}
|
||||||
empty!(a.chathistory)
|
# empty!(a.chathistory)
|
||||||
empty!(a.memory["shortmem"])
|
# empty!(a.memory["shortmem"])
|
||||||
empty!(a.memory["events"])
|
# empty!(a.memory["events"])
|
||||||
a.memory["chatbox"] = ""
|
# a.memory["chatbox"] = ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user