This commit is contained in:
2026-06-28 22:03:58 +07:00
parent e63dd7d898
commit d076d5f912
8 changed files with 188 additions and 120 deletions
+6 -5
View File
@@ -190,7 +190,7 @@ pushfirst!(virtualCustomerChatHistory, Dict("name"=> "system", "text"=> systemms
push!(chathistory, newdict)
end
push!(chathistory, Dict("name"=> "assistant", "text"=> input))
push!(chathistory, Dict("name"=> "assistant", "text"=> input))
# put in model format
prompt = formatLLMtext(chathistory, "llama3instruct")
@@ -309,7 +309,8 @@ function checkwine(a::T1, input::T2; maxattempt::Int=3
inventoryquery = "Retrieves $retrieve_attributes of wines that match the following criteria - {$_inventoryquery}"
println("\ncheckinventory input: $inventoryquery ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
# add suppport for similarSQLVectorDB
textresult, rawresponse = SQLLLM.query(inventoryquery,
textresult, rawresponse = SQLLLM.query(
inventoryquery,
a.context.executeSQL,
a.context.text2textInstructLLM;
insertSQLVectorDB=a.context.insertSQLVectorDB,
@@ -546,7 +547,7 @@ function extractWineAttributes_1(a::T1, input::T2; maxattempt=10
if j == :wine_price
if responsedict["wine_price"] != "N/A"
if !occursin("to", responsedict["wine_price"])
errornote = "In your previous attempt, the 'wine_price' was set to $(responsedict["wine_price"]) which is not a correct format. Please adjust it accordingly."
errornote = "In your previous attempt, the 'wine_price' was set to $(responsedict["wine_price"]) which is not a correct format. Please adjust it accordingly."
println("\nERROR YiemAgent extractWineAttributes_1() $errornote ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
checkFlag = true
break
@@ -1006,7 +1007,7 @@ function jsoncorrection(config::T1, input::T2, correctJsonExample::T3;
externalService = config["externalservice"]["text2textinstruct"]
llminfo = externalService["llminfo"]
prompt =
if llminfo["name"] == "llama3instruct"
if llminfo["name"] == "llama3instruct"
formatLLMtext_llama3instruct("system", _prompt)
else
error("llm model name is not defied yet $(@__LINE__)")
@@ -1053,7 +1054,7 @@ end
# “action_name” is the name of the action taken, which can be one of the following functions:
# 1) CHATBOX[text], which you can use to talk with the user. "text" is in verbal English.
# 2) WINESTOCK[query], which you can use to find info about wine in your inventory. "query" is a search term in verbal English. The best query must includes "budget", "type of wine", "characteristics of wine" and "food pairing".
# "actioninput" is the input to the action
# "action_input" is the input to the action
# "observation" is result of the preceding immediate action.
# At each round of conversation, the user will give you: