diff --git a/src/interface.jl b/src/interface.jl
index 452efe0..37ac30b 100755
--- a/src/interface.jl
+++ b/src/interface.jl
@@ -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|>", ""])
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]
diff --git a/src/llmfunction.jl b/src/llmfunction.jl
index cd7075f..4304fe5 100644
--- a/src/llmfunction.jl
+++ b/src/llmfunction.jl
@@ -114,7 +114,8 @@ end
julia> score = grading(agent, guideline, shorttermMemory)
```
"""
-function winestock(a::agentReflex, query::T) where {T<:AbstractString}
+function winestock(a::agentReflex, query::Dict)
+ query = JSON3.write(query)
@show query
prompt =
"""
@@ -150,18 +151,21 @@ function winestock(a::agentReflex, query::T) where {T<:AbstractString}
acidity = 5, high acidity
- Write SQL command using data from query.
+ Write a SQL command using data from a JSON-format query.
- query: "{\"wine type\": \"white\", \"wine characteristics\": \"full-bodied | off-dry | low acidity | medium tannin\", \"price\": {\"max\": \"50\"}}"
+ query: {\"wine type\": \"white\", \"wine characteristics\": \"full-bodied | off-dry | low acidity | medium tannin\", \"price\": {\"max\": \"50\"}}
assistant: SELECT * FROM White WHERE intensity = 5 AND sweetness = 2 AND acidity = 1 AND tannin = 3 AND price <= 50;
+
+ query: {\"wine characteristics\":\"low-bodied | semi-sweet | low tannin\",\"price\":\"22 USD\",\"occasion\":\"anniversary\",\"wine type\":\"Rose\",\"food\":\"American dishes\"}
+ assistant: SELECT * FROM Rose WHERE intensity = 1 AND sweetness = 3 AND tannin = 1 AND price <= 22;
+
<|query|>
- query: $query
+ $query
<|assistant|>
-
"""
println("")
@show db_prompt = prompt
@@ -169,6 +173,19 @@ function winestock(a::agentReflex, query::T) where {T<:AbstractString}
stopword=["/n/n", "END", "End", "Obs", "<|", ""])
println("")
@show db_response = response
+
+ # remove any blank character in front of a string
+ newresponse = nothing
+ for i in eachindex(response)
+ if response[i] != ' '
+ newresponse = response[i:end]
+ break
+ end
+ end
+ response = newresponse
+
+ error("winestock done")
+
body =
"""
INSERT INTO $tablename
@@ -179,7 +196,7 @@ function winestock(a::agentReflex, query::T) where {T<:AbstractString}
println("")
@show r.body
- error("winestockDB done")
+
return result
end