update
This commit is contained in:
@@ -645,12 +645,25 @@ function work(a::agentReflex, usermsg::String)
|
||||
respond = split(respond, "<|im_end|>")[1]
|
||||
@show respond
|
||||
#WORKING extract Act/ActInput
|
||||
headerToDetect = ["Question:", "Plan:", "Thought:", "Act:", "ActInput:", "Obs:", "...", "Answer:",
|
||||
"Conclusion:", "Summary:"]
|
||||
headers = detectCharacters(respond, headerToDetect)
|
||||
@show headers
|
||||
chunkedtext = chunktext(respond, headers)
|
||||
@show chunkedtext
|
||||
toolname = toolNameBeingCalled(chunkedtext["Act:"], a.tools)
|
||||
@show toolname
|
||||
toolinput = chunkedtext["ActInput:"]
|
||||
|
||||
@show toolinput
|
||||
error("work done 1")
|
||||
else # finish all steps
|
||||
else #TODO finish all steps
|
||||
|
||||
|
||||
|
||||
|
||||
error("work done 2")
|
||||
break
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -663,6 +676,12 @@ function work(a::agentReflex, usermsg::String)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function actor(a::agentReflex, usermsg::String)
|
||||
|
||||
end
|
||||
|
||||
|
||||
"""
|
||||
make a conversation summary.
|
||||
```jldoctest
|
||||
@@ -724,7 +743,7 @@ function conversationSummary(a::T) where {T<:agent}
|
||||
summary = summary[2:end]
|
||||
end
|
||||
end
|
||||
|
||||
println("conversation summary: $summary")
|
||||
return summary
|
||||
end
|
||||
|
||||
@@ -1109,21 +1128,39 @@ end
|
||||
```
|
||||
"""
|
||||
function chunktext(text::T, headers) where {T<:AbstractString}
|
||||
result = []
|
||||
result = Dict()
|
||||
|
||||
for (i, v) in enumerate(headers)
|
||||
if i < length(headers)
|
||||
nextheader = headers[i+1]
|
||||
body = text[v[:stop]+1: nextheader[:start]-1]
|
||||
push!(result, (header=v[:char], body=body))
|
||||
# push!(result, (header=v[:char], body=body))
|
||||
result[v[:char]] = body
|
||||
else
|
||||
body = text[v[:stop]+1: end]
|
||||
push!(result, (header=v[:char], body=body))
|
||||
# push!(result, (header=v[:char], body=body))
|
||||
result[v[:char]] = body
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
# function chunktext(text::T, headers) where {T<:AbstractString}
|
||||
# result = []
|
||||
|
||||
# for (i, v) in enumerate(headers)
|
||||
# if i < length(headers)
|
||||
# nextheader = headers[i+1]
|
||||
# body = text[v[:stop]+1: nextheader[:start]-1]
|
||||
# push!(result, (header=v[:char], body=body))
|
||||
# else
|
||||
# body = text[v[:stop]+1: end]
|
||||
# push!(result, (header=v[:char], body=body))
|
||||
# end
|
||||
# end
|
||||
|
||||
# return result
|
||||
# end
|
||||
|
||||
|
||||
function extractStepFromPlan(a::agent, plan::T, step::Int) where {T<:AbstractString}
|
||||
|
||||
Reference in New Issue
Block a user