This commit is contained in:
narawat lamaiin
2024-07-18 11:22:53 +07:00
parent 0ddc98a447
commit 6e2391e0e3
4 changed files with 168 additions and 138 deletions

View File

@@ -27,6 +27,13 @@ msgMeta = GeneralUtils.generate_msgMeta(
# :externalservice=> config[:externalservice],
# )
function executeSQL(sql::T) where {T<:AbstractString}
DBconnection = LibPQ.Connection("host=192.168.88.12 port=5432 dbname=yiem_wine_assistant user=yiem password=yiem@Postgres_0.0")
result = LibPQ.execute(DBconnection, sql)
close(DBconnection)
return result
end
function text2textInstructLLM(prompt::String)
msgMeta = GeneralUtils.generate_msgMeta(
config[:externalservice][:text2textinstruct][:mqtttopic],
@@ -58,6 +65,7 @@ end
# Instantiate an agent
a = YiemAgent.sommelier(
text2textInstructLLM,
executeSQL;
name="assistant",
id="testingSessionID", # agent instance id
)
@@ -71,27 +79,33 @@ end
function main()
userinput = "Hello, I would like a get a bottle of wine."
for i in 1:10
response = YiemAgent.conversation(a, Dict(:text=> userinput))
println("")
println("--> assistant response: \n", response)
println("")
println("--> user input:")
userinput = readline()
end
end
main()
# function main()
# userinput = "Hello, I would like a get a bottle of wine."
# for i in 1:10
# response = YiemAgent.conversation(a, Dict(:text=> userinput))
# println("")
# println("--> assistant response: \n", response)
# println("")
# println("--> user input:")
# userinput = readline()
# end
# end
# main()
input = "query=\"off dry, medium tannin French Rosé and spicy Thai food pairing under 30 dollars\""
YiemAgent.winestock(a, input)
"""
I'm having a graduation party this evening. I'll pay at most 30 bucks.
I have no idea. The party will be formal. What type of wine people usually get for this occasion?
What about sparkling Rose?
"""