This commit is contained in:
2024-01-14 01:27:52 +00:00
parent ee4da59867
commit 745e9e85fc
2 changed files with 36 additions and 19 deletions

View File

@@ -220,7 +220,7 @@ function planner_mistral_openorca(a::agentReflex)
Plan:
"""
plan = sendReceivePrompt(a, assistant_plan_prompt, max_tokens=256, temperature=0.1, stopword=["<|", "</"])
plan = sendReceivePrompt(a, assistant_plan_prompt, max_tokens=1024, temperature=0.1, stopword=["<|user|>", "</"])
plan = split(plan, "<|")[1]
# plan = split(plan, "\n\n")[1]
@@ -272,7 +272,7 @@ function updatePlan(a::agentReflex)
Updated plan:
"""
result = sendReceivePrompt(a, prompt, max_tokens=256, temperature=0.1)
result = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.1)
@show updatedPlan = result
a.memory[:shortterm]["Plan 1:"] = result
@@ -323,7 +323,7 @@ function selfAwareness(a::agentReflex)
<|assistant|>
What I know:
"""
response = sendReceivePrompt(a, prompt, max_tokens=256, temperature=0.4, timeout=180,
response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.4, timeout=180,
stopword=["/n/n", "END", "End", "Obs", "<|", "</"])
@show response
@@ -460,7 +460,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
while true # while Thought or Act is empty, run actor again
tempcounter += 0.2
@show tempcounter
response = sendReceivePrompt(a, prompt, max_tokens=256, temperature=tempcounter, timeout=180,
response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=tempcounter, timeout=180,
stopword=["Obs:", "<|system|>", "</s>"])
response = splittext(response, ["/n/n", "END", "End", "Obs", "<|im_end|>"])
@@ -507,7 +507,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
isJsonReadable = false
try
act = GeneralUtils.getStringBetweenCharacters(response, '{', '}', endCharLocation="end")
act = Dict(JSON3.read(act))
act = JSON3.read(act)
isJsonReadable = true
catch
end
@@ -550,13 +550,12 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
act = GeneralUtils.getStringBetweenCharacters(response, '{', '}', endCharLocation="end")
println("")
@show actor_response_1 = act
act = Dict(JSON3.read(act))
act = copy(JSON3.read(act))
chunkedtext["Act $latestTask:"] = toolname
chunkedtext["Actinput $latestTask:"] = act[Symbol(toolname)]
toolinput = chunkedtext["Actinput $latestTask:"]
@show toolinput
println(typeof(toolinput))
toolinput = act[Symbol(toolname)]
return toolname, toolinput, chunkedtext
end
@@ -788,6 +787,7 @@ function actor(a::agentReflex)
println("")
@show toolname
@show toolinput
println(typeof(toolinput))
println("")
addShortMem!(a.memory[:shortterm], chunkedtext)
@@ -984,7 +984,7 @@ function analyze(a)
"""
response = sendReceivePrompt(a, prompt, max_tokens=256, timeout=180)
response = sendReceivePrompt(a, prompt, max_tokens=1024, timeout=180)
return response
end
@@ -1039,7 +1039,7 @@ function selfReflext(a, analysis::T) where {T<:AbstractString}
<|im_end|>
"""
response = sendReceivePrompt(a, prompt, max_tokens=256)
response = sendReceivePrompt(a, prompt, max_tokens=1024)
return response
end
@@ -1258,7 +1258,7 @@ function checkTaskCompletion(a)
"""
response = nothing
_response = nothing
_response = sendReceivePrompt(a, prompt, max_tokens=256)
_response = sendReceivePrompt(a, prompt, max_tokens=1024)
@show checkTaskCompletion_raw = _response
_response = split(_response, "</")[1]
_response = split(_response, "\n\n")[1]
@@ -1354,7 +1354,7 @@ function recap(a)
Extracted info:
"""
aware = "Self-awareness: map the info from the recap to the plan's tasks then state your mapping."
response = sendReceivePrompt(a, prompt, max_tokens=256, temperature=0.0)
response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.0)
response = split(response, "</")[1]
response = split(response, "<|")[1]
response = split(response, "\n\n")[1]