update
This commit is contained in:
@@ -29,7 +29,7 @@ function executeSQLVectorDB(sql)
|
||||
return result
|
||||
end
|
||||
|
||||
function text2textInstructLLM(prompt::String)
|
||||
function text2textInstructLLM(prompt::String; maxattempt=3)
|
||||
msgMeta = GeneralUtils.generate_msgMeta(
|
||||
config[:externalservice][:loadbalancer][:mqtttopic];
|
||||
msgPurpose="inference",
|
||||
@@ -51,8 +51,19 @@ function text2textInstructLLM(prompt::String)
|
||||
)
|
||||
)
|
||||
|
||||
_response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120, maxattempt=2)
|
||||
response = _response[:response][:text]
|
||||
response = nothing #[WORKING] receive nothing when LLM container reset
|
||||
for attempts in 1:maxattempt
|
||||
_response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120, maxattempt=2)
|
||||
response = _response[:response][:text]
|
||||
if response !== nothing
|
||||
break
|
||||
else
|
||||
println("\n<text2textInstructLLM()> attempt $attempts/$maxattempt failed ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
pprintln(outgoingMsg)
|
||||
println("</text2textInstructLLM()> attempt $attempts/$maxattempt failed ", @__FILE__, ":", @__LINE__, " $(Dates.now())\n")
|
||||
sleep(3)
|
||||
end
|
||||
end
|
||||
|
||||
return response
|
||||
end
|
||||
@@ -103,8 +114,8 @@ function similarSQLVectorDB(query; maxdistance::Integer=100)
|
||||
df = findSimilarTextFromVectorDB(query, tablename,
|
||||
"function_input_embedding", executeSQLVectorDB)
|
||||
row, col = size(df)
|
||||
# distance = row == 0 ? Inf : df[1, :distance]
|
||||
distance = 100 # CHANGE this is for testing only
|
||||
distance = row == 0 ? Inf : df[1, :distance]
|
||||
# distance = 100 # CHANGE this is for testing only
|
||||
if row != 0 && distance < maxdistance
|
||||
# if there is usable SQL, return it.
|
||||
output_b64 = df[1, :function_output_base64] # pick the closest match
|
||||
@@ -146,8 +157,8 @@ sessionId = "555"
|
||||
|
||||
|
||||
# query = Dict(:text=> "How many wines from France do you have that can be paired with lamb?")
|
||||
# query = "How many wines are from United States?"
|
||||
query = "retailer: Yiem, wine_type: red, sweetness: 1-2, intensity: 4-5, wine price: 20-40"
|
||||
query = "How many wines are from Italy?"
|
||||
# query = "retailer: Yiem, wine_type: red, sweetness: 1-2, intensity: 4-5, wine price: 20-40"
|
||||
# query = "wine_type: white, country: United States, sweetness: 1-2, tannin: 3, food to be served with wine: pizza"
|
||||
# query = "wine_type: white, country: Austria, food to be served with wine: pork"
|
||||
# query = "wine price: less than 25, wine_type: rose, country: France, sweetness: 2, tannin: 3, food to be served with wine: pizza"
|
||||
|
||||
Reference in New Issue
Block a user