From f2e2be2e5557cd7436ac1faeb0702dc74ed88085 Mon Sep 17 00:00:00 2001 From: tonaerospace Date: Tue, 6 Feb 2024 01:45:38 +0000 Subject: [PATCH] update --- src/interface.jl | 16 +++++++++------- src/llmfunction.jl | 16 ++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 80b8cd9..482dc91 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -805,8 +805,6 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing) winestocksearchresult = "\n" end - #WORKING I need a llm json read function - # prompt = # """ # <|system|> @@ -864,7 +862,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing) Use the following format: - Thought: considering what you know about the user and your plan thoroughly then you should think about what to do next by prioritize what you don't know first. (PS. 1. let's think a single step. 2. pay attention to correct numeral calculation and commonsense.) + Thought: considering what you know about the user and your plan thoroughly then you should think about what to do next by prioritize what you don't know (null means don't know) first. (PS. 1. let's think a single step. 2. pay attention to correct numeral calculation and commonsense.) Act: based on your thought what action to choose?, must be one of [{toolnames}]. Actinput: your input to the action (pay attention to the tool's input) Obs: observed result of the action @@ -1024,15 +1022,19 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing) # because tools has JSON input but sometime LLM output is not JSON, we need to check. - if occursin("{", toolinput) + if occursin("{", toolinput) #WORKING act = GeneralUtils.getStringBetweenCharacters(response, '{', '}', endCharLocation="end") - act = copy(JSON3.read(act)) - chunkedtext["Actinput $latestTask:"] = JSON3.write(act[Symbol(toolname)]) - toolinput = act[Symbol(toolname)] + println("") + @show act + act = GeneralUtils.JSON3read_stringKey(act) #copy(JSON3.read(act)) + chunkedtext["Actinput $latestTask:"] = JSON3.write(act[toolname]) + toolinput = act[toolname] end chunkedtext["Act $latestTask:"] = toolname + + return (toolname=toolname, toolinput=toolinput, chunkedtext=chunkedtext, selfaware=selfaware) end diff --git a/src/llmfunction.jl b/src/llmfunction.jl index f3307f6..314b94c 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -86,8 +86,8 @@ end julia> score = grading(agent, guideline, shorttermMemory) ``` """ -function winestock(a::agentReflex, actorResult::NamedTuple) - query = JSON3.write(actorResult[:toolinput]) +function winestock(a::agentReflex, input::NamedTuple) + query = JSON3.write(input[:toolinput]) @show query prompt = """ @@ -105,9 +105,9 @@ function winestock(a::agentReflex, actorResult::NamedTuple) Fortified = table for wine type "fortified" Intensity level: intensity = 1, light bodied - intensity = 2, light-medium bodied + intensity = 2, semi-light bodied intensity = 3, medium bodied - intensity = 4, medium-full bodied + intensity = 4, semi-full bodied intensity = 5, full bodied Sweetness level: sweetness = 1, dry @@ -117,15 +117,15 @@ function winestock(a::agentReflex, actorResult::NamedTuple) sweetness = 5, very sweet Tannin level: tannin = 1, low tannin - tannin = 2, low-medium tannin + tannin = 2, semi-low tannin tannin = 3, medium tannin - tannin = 4, medium-high tannin + tannin = 4, semi-high tannin tannin = 5, high tannin Acidity level: acidity = 1, low acidity - acidity = 2, low-medium acidity + acidity = 2, semi-low acidity acidity = 3, medium acidity - acidity = 4, medium-high acidity + acidity = 4, semi-high acidity acidity = 5, high acidity