diff --git a/src/interface.jl b/src/interface.jl
index f2e4eda..989538a 100755
--- a/src/interface.jl
+++ b/src/interface.jl
@@ -220,7 +220,8 @@ function planner_mistral_openorca(a::agentReflex)
Plan:
"""
- plan = sendReceivePrompt(a, assistant_plan_prompt, max_tokens=1024, temperature=0.1, stopword=["<|user|>", ""])
+ plan = sendReceivePrompt(a, assistant_plan_prompt, max_tokens=1024, temperature=0.1,
+ timeout=180, stopword=["<|user|>", ""])
plan = split(plan, "<|")[1]
# plan = split(plan, "\n\n")[1]
@@ -520,7 +521,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
# headers = detectCharacters(response, headerToDetect)
- println("")
+
headerToDetect = ["Plan $(a.attempt):",
@@ -538,14 +539,17 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
check_2 = haskey(chunkedtext, "Act $latestTask:")
check_3 = haskey(chunkedtext, "Actinput $latestTask:")
- # check whether the act has valid json
- # check_4 = false
- # try
- # act = GeneralUtils.getStringBetweenCharacters(response, '{', '}', endCharLocation="end")
- # act = JSON3.read(act)
- # check_4 = true
- # catch
- # end
+ #check whether the act has valid json
+ check_7 = true
+ if occursin('{', response)
+ try
+ act = GeneralUtils.getStringBetweenCharacters(response, '{', '}', endCharLocation="end")
+ act = JSON3.read(act)
+ check_7 = true
+ catch
+ check_7 = false
+ end
+ end
# check for a valid toolname
check_4 = false
@@ -562,12 +566,15 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
check_6 = length(chunkedtext["Actinput $latestTask:"]) > 5
# print all check_1 to check_6
- println("check_1: $check_1, check_2: $check_2, check_3: $check_3, check_4: $check_4, check_5: $check_5, check_6: $check_6")
+ println("check_1: $check_1, check_2: $check_2, check_3: $check_3, check_4: $check_4,
+ check_5: $check_5, check_6: $check_6, check_7: $check_7")
- if check_1 && check_2 && check_3 && check_4 && check_5 && check_6
+ if check_1 && check_2 && check_3 && check_4 && check_5 && check_6 && check_7
+
#WORKING paraphrase selfaware
break
end
+ @show response
end
toolname = toolNameBeingCalled(chunkedtext["Act $latestTask:"], a.tools)
@@ -920,7 +927,7 @@ function work(a::agentReflex)
latestTask = shortMemLatestTask(a.memory[:shortterm])
if haskey(a.memory[:shortterm], "Act $latestTask:")
if occursin("askbox", a.memory[:shortterm]["Act $latestTask:"])
- a.memory[:shortterm]["Obs $latestTask:"] = a.messages[end][:content]
+ a.memory[:shortterm]["Obs $latestTask:"] = "(user response) " * a.messages[end][:content]
end
end
end
@@ -1202,7 +1209,7 @@ function grading(a, guideline::T, text::T) where {T<:AbstractString}
prompt_grading = prompt
@show prompt_grading
println("")
- response = sendReceivePrompt(a, prompt)
+ response = sendReceivePrompt(a, prompt, timeout=180)
response = "{" * split(response, "}")[1] * "}"
@show response
@show jsonresponse = JSON3.read(response)
diff --git a/src/llmfunction.jl b/src/llmfunction.jl
index 8f7e03a..dc4028a 100644
--- a/src/llmfunction.jl
+++ b/src/llmfunction.jl
@@ -152,7 +152,7 @@ function winestock(a::agentReflex, query::Dict)
Consult the conversion table then write a specific SQL command using only available info from a JSON-format query.
- List of keywords not allowed in SQL: ["BETWEEN", "--", "WHEN]
+ List of keywords not allowed in SQL: ["BETWEEN", "--", "WHEN", "IN"]
query: {\"wine type\": \"white\", \"wine characteristics\": \"full-bodied | off-dry | low acidity | medium tannin\", \"price\": {\"max\": \"50\"}}
@@ -177,13 +177,14 @@ function winestock(a::agentReflex, query::Dict)
# check for valid SQL command
check_1 = occursin("BETWEEN", _sql)
check_2 = occursin("--", _sql)
+ check_3 = occursin("IN", _sql)
- if check_1 == false && check_2 == false
+ if check_1 == false && check_2 == false && check_3 == false
break
end
end
println("")
- @show db_sql = replace(_sql, '\n'=>'')
+ @show db_sql = replace(_sql, '\n'=>"")
# remove any blank character in front of a string
newsql = nothing