This commit is contained in:
narawat lamaiin
2024-07-28 20:45:19 +07:00
parent d042c1d9c3
commit 71479c5fd0
2 changed files with 27 additions and 26 deletions

View File

@@ -358,7 +358,7 @@ julia> result = winestock(agent, input)
# TODO # TODO
- [] update docs - [] update docs
- [WORKING] implement the function - [x] implement the function
# Signature # Signature
""" """
@@ -370,7 +370,7 @@ function winestock(a::T1, input::T2
# replace because SQLLLM didn't know what food_paired means # replace because SQLLLM didn't know what food_paired means
result = replace(wineattributes, "food_pairing" => "food_to_be_paired_with_wine") result = replace(wineattributes, "food_pairing" => "food_to_be_paired_with_wine")
result = SQLLLM.query(Dict(:text=> wineattributes), a.executeSQL, a.text2textInstructLLM) result = SQLLLM.query(result, a.executeSQL, a.text2textInstructLLM)
return result return result
end end

View File

@@ -1,5 +1,5 @@
using Revise # remove when this package is completed using Revise # remove when this package is completed
using YiemAgent, GeneralUtils, JSON3, MQTTClient, Dates, UUIDs, LibPQ using YiemAgent, GeneralUtils, JSON3, MQTTClient, Dates, UUIDs, LibPQ, DataStructures, SQLLLM
using Base.Threads using Base.Threads
# ---------------------------------------------- 100 --------------------------------------------- # # ---------------------------------------------- 100 --------------------------------------------- #
@@ -49,7 +49,7 @@ function text2textInstructLLM(prompt::String)
:payload=> Dict( :payload=> Dict(
:text=> prompt, :text=> prompt,
:kwargs=> Dict( :kwargs=> Dict(
:max_tokens=> 1024, :max_tokens=> 2048,
:stop=> ["<|eot_id|>"], :stop=> ["<|eot_id|>"],
:temperature=> 0.2, :temperature=> 0.2,
) )
@@ -70,6 +70,21 @@ end
id="testingSessionID", # agent instance id id="testingSessionID", # agent instance id
) )
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()
# response = YiemAgent.conversation(a, Dict(:text=> "newtopic",) ) # response = YiemAgent.conversation(a, Dict(:text=> "newtopic",) )
# response = YiemAgent.conversation(a, Dict(:text=> "Hello, I would like a get a bottle of wine.")) # response = YiemAgent.conversation(a, Dict(:text=> "Hello, I would like a get a bottle of wine."))
@@ -79,37 +94,23 @@ 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()
# input = "query=\"off dry, medium tannin, French Rosé\"" # # input = "query=\"off dry, medium tannin, French Rosé\""
input = "wine_type: rose, country: France, sweetness: 2, tannin: 3" # input = "Search the database for wine type: white, country: France, sweetness level: 1"
YiemAgent.winestock(a, input) # YiemAgent.winestock(a, input)
""" # """
I'm having a graduation party this evening. I'll pay at most 30 bucks. # 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? # I have no idea. The party will be formal. What type of wine people usually get for this occasion?
What about sparkling Rose? # What about sparkling Rose?
"""
# """