From 802d08020515ae7d9172fdb590817c2cf0d02837 Mon Sep 17 00:00:00 2001 From: "youremail@yourdomain.com" Date: Mon, 25 Dec 2023 06:40:24 +0000 Subject: [PATCH] update --- src/interface.jl | 33 +++++++++++++++++---------------- src/llmfunction.jl | 33 ++++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index dd734b7..3d53a55 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -295,6 +295,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="") " """ #BUG BIG output from winestock cause recap() to fail. + #BUG2 LLM repeat winestock search without recommending wine toolnames = "" toollines = "" for (toolname, v) in a.tools @@ -318,8 +319,8 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="") start = "Thought" aware = "" if taskrecap != "" - start = "Aware" - aware = "Aware: check recap against the plan about current situation" + start = "Self-awareness" + aware = "Self-awareness: based on the recap, check your progress against the plan and assess the current situation to identify tasks that you need to address." end winestockResult = "" @@ -349,7 +350,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="") Use the following format: $aware - Thought: based on the plan and the recap of the plan, what to do? (pay attention to correct numeral calculation, commonsense. ask the user one by one question.) + Thought: based on the plan and self-awareness, What to do? (P.S. ask the user one by one question, pay attention to correct numeral calculation and commonsense) Act: an action to take based on your thought, must be one of [{toolnames}] Actinput: your input to the action based on your thought (pay attention to the tool's input) Obs: observed result of the action @@ -379,10 +380,10 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="") if start == "Thought" response = "Thought $latestTask: " * response else - response = "Aware $latestTask: " * response + response = "Self-awareness $latestTask: " * response end - headerToDetect = ["Question:", "Plan:", "Aware:", "Thought:", + headerToDetect = ["Question:", "Plan:", "Self-awareness:", "Thought:", "Act:", "Actinput:", "Obs:", "...", "Answer:", "Conclusion:", "Summary:"] @@ -397,7 +398,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="") headerToDetect = ["Plan $(a.attempt):", - "Aware $latestTask:", + "Self-awareness $latestTask:", "Thought $latestTask:", "Act $latestTask:", "Actinput $latestTask:", @@ -422,7 +423,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="") toolinput = chunkedtext["Actinput $latestTask:"] # change trailing number to continue a.memory[:shortterm] - headerToDetect = ["Question:", "Plan:", "Aware:", "Thought:", + headerToDetect = ["Question:", "Plan:", "Self-awareness:", "Thought:", "Act:", "Actinput:", "Obs:", "...", "Answer:", "Conclusion:", "Summary:"] response = replaceHeaders(response, headerToDetect, latestTask) @@ -435,7 +436,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="") "Check $latestTask:",] headers = detectCharacters(response, headerToDetect) chunkedtext = chunktext(response, headers) - chunkedtext = delete!(chunkedtext, "Aware $latestTask") + chunkedtext = delete!(chunkedtext, "Self-awareness $latestTask") return toolname, toolinput, chunkedtext end @@ -673,14 +674,14 @@ function actor(a::agentReflex) f = a.tools[toolname][:func] toolresult = f(a, toolinput) @show toolresult - # if toolname == "winestock" - # a.winestockResult = toolresult - # a.memory[:shortterm]["Obs $latestTask:"] = "winestock search done" - # a.memory[:log]["Obs $latestTask:"] = "winestock search done" - # else - # a.memory[:shortterm]["Obs $latestTask:"] = toolresult - # a.memory[:log]["Obs $latestTask:"] = toolresult - # end + if toolname == "winestock" + a.winestockResult = toolresult + a.memory[:shortterm]["Obs $latestTask:"] = "winestock search done, refers to " + a.memory[:log]["Obs $latestTask:"] = "winestock search done" + else + a.memory[:shortterm]["Obs $latestTask:"] = toolresult + a.memory[:log]["Obs $latestTask:"] = toolresult + end end diff --git a/src/llmfunction.jl b/src/llmfunction.jl index bc3183e..2fa6349 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -75,17 +75,36 @@ function winestock(a::agentReflex, phrase::T) where {T<:AbstractString} # ) # ] + # result = + # """ + # 1. Name: Louis Latou - Corton-Charlamagne - Chardonnay, + # Description: Corton-Charlemagne 2018 is a powerful, complex wine. Its nose is intense, with notes of white stone fruits such as white peach, fresh hazelnut, vanilla, and almond paste. The wine is full-bodied for the palate, and the vanilla is complemented by aromas of fresh almond and lime blossom. The experience ends with a very fine aromatic aftertaste that has subtle saline notes., + # Price: 55 dollars, + # ID: ws-114 + # 2. Name: Chateau de Beaucastel Hommage Jacques Perrin Chateauneuf-du-Pape, + # Year: 2019, + # Description: The quintessence of Château de Beaucastel, Hommage à Jacques Perrin delights us every year, and the 2019 vintage is no exception. To the eye it offers a splendid deep red color, verging on black. Full of power and supremely elegant, the nose is of magnificent aromatic complexity with notes of black fruit and spices that offer all the characteristic expression of Mourvèdre. Perfectly balanced by an incredible freshness, the mouth is eminently elegant with intense and complex aromas of great subtlety, a full, refined texture, subtle tannins of great finesse, and infinite length. A great classic Hommage à Jacques Perrin., + # Price: 40, + # ID: ed-23 + # """ result = """ - 1. Name: Louis Latou - Corton-Charlamagne - Chardonnay, - Description: Corton-Charlemagne 2018 is a powerful, complex wine. Its nose is intense, with notes of white stone fruits such as white peach, fresh hazelnut, vanilla, and almond paste. The wine is full-bodied for the palate, and the vanilla is complemented by aromas of fresh almond and lime blossom. The experience ends with a very fine aromatic aftertaste that has subtle saline notes., - Price: 55 dollars, + { + 1: { + wine name: Louis Latou - Corton-Charlamagne, + variety: chardonnay, + year: 2014, + price: 55 USD, ID: ws-114 - 2. Name: Chateau de Beaucastel Hommage Jacques Perrin Chateauneuf-du-Pape, - Year: 2019, - Description: The quintessence of Château de Beaucastel, Hommage à Jacques Perrin delights us every year, and the 2019 vintage is no exception. To the eye it offers a splendid deep red color, verging on black. Full of power and supremely elegant, the nose is of magnificent aromatic complexity with notes of black fruit and spices that offer all the characteristic expression of Mourvèdre. Perfectly balanced by an incredible freshness, the mouth is eminently elegant with intense and complex aromas of great subtlety, a full, refined texture, subtle tannins of great finesse, and infinite length. A great classic Hommage à Jacques Perrin., - Price: 40, + }, + 2: { + wine name: Chateau de Beaucastel Hommage Jacques Perrin Chateauneuf-du-Pape, + variety: riesling, + year: 2016, + price: 39 USD, ID: ed-23 + } + } """ return result end