V0.8.0 #49

Closed
ton wants to merge 121 commits from v0.8.0 into main
3 changed files with 6 additions and 6 deletions
Showing only changes of commit 1f3526b996 - Show all commits
+3 -3
View File
@@ -267,7 +267,7 @@ function _agentLoop(agent::yiemAgent)
agent.eventSink("_agentLoop 1 agent._state.messages length $(length(agent._state.messages))"; publish=false, log=true) agent.eventSink("_agentLoop 1 agent._state.messages length $(length(agent._state.messages))"; publish=false, log=true)
# agent process new user msg immediately after the current tool call finished. # agent process new user msg immediately after the current tool call finished.
newUserMsg = take!(agent.inputChannel) newUserMsg = take!(agent.inputChannel)
agent.eventSink("new user msg"; publish=false, log=true) agent.eventSink("new user msg\n$newUserMsg"; publish=false, log=true)
else else
# check followUp message after _processMessage() is done # check followUp message after _processMessage() is done
if typeof(processingTask) == Task && istaskdone(processingTask) == true if typeof(processingTask) == Task && istaskdone(processingTask) == true
@@ -1524,13 +1524,13 @@ OpenAiToUserMessage(msg)
# => userMessage("user", [textContent("Hello")], DateTime(...)) # => userMessage("user", [textContent("Hello")], DateTime(...))
``` ```
""" """
function OpenAiToUserMessage(msg::Dict)::userMessage function OpenAiToUserMessage(msg::AbstractDict)::userMessage
content_blocks = Vector{messageContent}() content_blocks = Vector{messageContent}()
raw_content = get(msg, "content", Any[]) raw_content = get(msg, "content", Any[])
if raw_content isa Vector if raw_content isa Vector
for block in raw_content for block in raw_content
if block isa Dict if typeof(block) <: AbstractDict
block_type = get(block, "type", "") block_type = get(block, "type", "")
if block_type == "text" if block_type == "text"
text = get(block, "text", "") text = get(block, "text", "")
+1 -1
View File
@@ -33,7 +33,7 @@ julia> promptAgent(agent, Dict("role" => "user", "content" => "Hello!"))
yiemAgent(...) yiemAgent(...)
``` ```
""" """
function promptAgent(agent::yiemAgent, msg::AbstractDict{String, Any}) function promptAgent(agent::yiemAgent, msg::Dict{String, Any})
put!(agent.inputChannel, msg) put!(agent.inputChannel, msg)
return agent return agent
end end
+2 -2
View File
@@ -2,8 +2,8 @@ module utils
export clearhistory, availableWineToText, prepareContext, formatMsgForLLM, validateRequiredArgs, export clearhistory, availableWineToText, prepareContext, formatMsgForLLM, validateRequiredArgs,
validateToolArguments, _userMessageToOpenAI, validateToolArguments, _userMessageToOpenAI,
_assistantMessageToOpenAI, _toolResultMessageToOpenAI, _messageContentToBlocks, _toolsToOpenAI, _assistantMessageToOpenAI, _toolResultMessageToOpenAI, _messageContentToBlocks,
beforeToolCall, afterToolCall _toolsToOpenAI, beforeToolCall, afterToolCall
using UUIDs, Dates, DataStructures, HTTP, JSON, NATS using UUIDs, Dates, DataStructures, HTTP, JSON, NATS
using GeneralUtils using GeneralUtils