This commit is contained in:
2026-08-07 08:46:48 +07:00
parent d0bacbb538
commit 0a6af36b34
9 changed files with 18 additions and 892 deletions
+3 -1
View File
@@ -184,8 +184,10 @@ function _process_message(agent::yiemAgent)::assistantMessage
# Call llmCall() (blocking — the task waits here)
response = agent.llmCall(formatted_messages)
error(5555555)
# Check if LLM used tool calls (inspect content for tool_call blocks)
#WORKING Check if LLM used tool calls (inspect content for tool_call blocks)
has_tool_calls = false
tool_call_list = agentToolCall[]
+2 -2
View File
@@ -245,7 +245,7 @@ mutable struct agentState # Mutable runtime state of an agen
model::llmModel # LLM model to use
tools::Vector{agentTool} # Available tools
# messages history includes userMessage, assistantMessage, toolResultMessage
# messages history includes userMessage, assistantMessage, toolResultMessage. NO system prompt
messages::Vector{agentMessage}
pendingToolCalls::Vector{String} # Tool call IDs waiting for results
@@ -568,7 +568,7 @@ yiemAgent(agentState(...), Channel(...), Channel(...), Channel(...), ..., ...)
```
"""
function yiemAgent(
; systemPrompt::String="",
; systemPrompt::String="You are helpful assistant.",
model=nothing,
tools::Vector{agentTool}=agentTool[],
messages::Vector{agentMessage}=agentMessage[],
+13 -5
View File
@@ -103,13 +103,21 @@ prepareContext(state) == deepcopy(state.messages)
# return msgs
# end
```
"""
function prepareContext(state::agentState)::Vector{agentMessage}
messages = deepcopy(state.messages) # messages that will be send to LLM
""" #WORKING
function prepareContext(state::agentState)::agentContext
#TODO adjust/modify and inject additional context into messages
#TODO filter tools from state.tools based on user intend in user message and tool description
filteredTools = state.tools
return messages
#TODO add tools to current system prompt
preparedSystemPrompt = state.systemPrompt
#TODO add system prompt, adjust/modify and inject additional context into messages
preparedMessages = deepcopy(state.messages) # messages that will be send to LLM
agentCtx = agentContext(preparedSystemPrompt, preparedMessages, filteredTools)
return agentCtx
end