update
This commit is contained in:
@@ -232,7 +232,7 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol, Any} where {T<:age
|
|||||||
|
|
||||||
systemmsg =
|
systemmsg =
|
||||||
"""
|
"""
|
||||||
Your name is $(a.name). You are a helpful assistant acting as a polite, website-based sommelier for Yiem's online wine store.
|
Your name is $(a.name). You are a helpful assistant acting as a polite, website-based sommelier for $(a.retailername) store.
|
||||||
Your goal includes:
|
Your goal includes:
|
||||||
1) Get to know the user preferences about wine
|
1) Get to know the user preferences about wine
|
||||||
2) Help them select the best wines from your inventory that align with their preferences
|
2) Help them select the best wines from your inventory that align with their preferences
|
||||||
@@ -1422,6 +1422,9 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St
|
|||||||
q_number = count("Q", response)
|
q_number = count("Q", response)
|
||||||
if q_number < 3
|
if q_number < 3
|
||||||
error("too few questions only $q_number questions are generated ", @__FILE__, " ", @__LINE__)
|
error("too few questions only $q_number questions are generated ", @__FILE__, " ", @__LINE__)
|
||||||
|
# check whether "A1" is in the response, if not error.
|
||||||
|
elseif !occursin("A1", response)
|
||||||
|
error("no answer found in the response ", @__FILE__, " ", @__LINE__)
|
||||||
end
|
end
|
||||||
# response = string(split(response, "Please")[1]) # LLM usually add comments which is no need.
|
# response = string(split(response, "Please")[1]) # LLM usually add comments which is no need.
|
||||||
responsedict = GeneralUtils.textToDict(response,
|
responsedict = GeneralUtils.textToDict(response,
|
||||||
|
|||||||
@@ -289,12 +289,13 @@ julia> result = checkinventory(agent, input)
|
|||||||
"""
|
"""
|
||||||
function checkinventory(a::T1, input::T2
|
function checkinventory(a::T1, input::T2
|
||||||
)::NamedTuple{(:result, :success, :errormsg), Tuple{String, Bool, Union{String, Nothing}}} where {T1<:agent, T2<:AbstractString}
|
)::NamedTuple{(:result, :success, :errormsg), Tuple{String, Bool, Union{String, Nothing}}} where {T1<:agent, T2<:AbstractString}
|
||||||
println("--> checkinventory order: $input ", @__FILE__, " ", @__LINE__)
|
println("~~~ checkinventory order: $input ", @__FILE__, " ", @__LINE__)
|
||||||
wineattributes_1 = extractWineAttributes_1(a, input)
|
wineattributes_1 = extractWineAttributes_1(a, input)
|
||||||
wineattributes_2 = extractWineAttributes_2(a, input)
|
wineattributes_2 = extractWineAttributes_2(a, input)
|
||||||
|
|
||||||
inventoryquery = "$wineattributes_1, $wineattributes_2"
|
inventoryquery = "retailer name: $(a.retailername), $wineattributes_1, $wineattributes_2"
|
||||||
println("--> checkinventory input: $inventoryquery ", @__FILE__, " ", @__LINE__)
|
println("~~~ checkinventory input: $inventoryquery ", @__FILE__, " ", @__LINE__)
|
||||||
|
|
||||||
result = SQLLLM.query(inventoryquery, a.executeSQL, a.text2textInstructLLM,
|
result = SQLLLM.query(inventoryquery, a.executeSQL, a.text2textInstructLLM,
|
||||||
addSQLVectorDB=a.addSQLVectorDB,
|
addSQLVectorDB=a.addSQLVectorDB,
|
||||||
querySQLVectorDB=a.querySQLVectorDB)
|
querySQLVectorDB=a.querySQLVectorDB)
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ julia> agent = YiemAgent.bsommelier(
|
|||||||
mutable struct sommelier <: agent
|
mutable struct sommelier <: agent
|
||||||
name::String # agent name
|
name::String # agent name
|
||||||
id::String # agent id
|
id::String # agent id
|
||||||
|
retailername::String
|
||||||
tools::Dict
|
tools::Dict
|
||||||
maxHistoryMsg::Integer # e.g. 21th and earlier messages will get summarized
|
maxHistoryMsg::Integer # e.g. 21th and earlier messages will get summarized
|
||||||
|
|
||||||
@@ -160,6 +161,7 @@ function sommelier(
|
|||||||
;
|
;
|
||||||
name::String= "Assistant",
|
name::String= "Assistant",
|
||||||
id::String= string(uuid4()),
|
id::String= string(uuid4()),
|
||||||
|
retailername::String= "retailer_name",
|
||||||
maxHistoryMsg::Integer= 20,
|
maxHistoryMsg::Integer= 20,
|
||||||
chathistory::Vector{Dict{Symbol, String}} = Vector{Dict{Symbol, String}}(),
|
chathistory::Vector{Dict{Symbol, String}} = Vector{Dict{Symbol, String}}(),
|
||||||
)
|
)
|
||||||
@@ -192,6 +194,7 @@ function sommelier(
|
|||||||
newAgent = sommelier(
|
newAgent = sommelier(
|
||||||
name,
|
name,
|
||||||
id,
|
id,
|
||||||
|
retailername,
|
||||||
tools,
|
tools,
|
||||||
maxHistoryMsg,
|
maxHistoryMsg,
|
||||||
chathistory,
|
chathistory,
|
||||||
|
|||||||
Reference in New Issue
Block a user