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=["<|", "", " 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", "<|", "", ""]) 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, " 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", "<|", "