This commit is contained in:
2024-01-13 12:44:41 +00:00
parent 6567523ac6
commit ee4da59867
2 changed files with 43 additions and 33 deletions

View File

@@ -502,6 +502,15 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
@show iskey_Thought = haskey(chunkedtext, "Thought $latestTask:")
@show iskey_Act = haskey(chunkedtext, "Act $latestTask:")
@show iskey_Actinput = haskey(chunkedtext, "Actinput $latestTask:")
# check whether the act has valid json
isJsonReadable = false
try
act = GeneralUtils.getStringBetweenCharacters(response, '{', '}', endCharLocation="end")
act = Dict(JSON3.read(act))
isJsonReadable = true
catch
end
if iskey_Thought && iskey_Act && iskey_Actinput
istoolnameValid = false
@@ -513,8 +522,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
end
if length(chunkedtext["Thought $latestTask:"]) > 5 && istoolnameValid &&
length(chunkedtext["Actinput $latestTask:"]) > 5 &&
occursin('{', response) && occursin('}', response)
length(chunkedtext["Actinput $latestTask:"]) > 5 && isJsonReadable
break
end
end
@@ -547,6 +555,8 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
chunkedtext["Act $latestTask:"] = toolname
chunkedtext["Actinput $latestTask:"] = act[Symbol(toolname)]
toolinput = chunkedtext["Actinput $latestTask:"]
@show toolinput
println(typeof(toolinput))
return toolname, toolinput, chunkedtext
end