This commit is contained in:
narawat lamaiin
2025-03-31 21:30:14 +07:00
parent 883f581b2a
commit b8fd772a28
6 changed files with 818 additions and 426 deletions

View File

@@ -36,13 +36,13 @@ function executeSQLVectorDB(sql)
return result
end
function text2textInstructLLM(prompt::String; maxattempt=2)
function text2textInstructLLM(prompt::String; maxattempt::Integer=2, modelsize::String="medium")
msgMeta = GeneralUtils.generate_msgMeta(
config[:externalservice][:loadbalancer][:mqtttopic];
msgPurpose="inference",
senderName="yiemagent",
senderId=sessionId,
receiverName="text2textinstruct_small",
receiverName="text2textinstruct_$modelsize",
mqttBrokerAddress=config[:mqttServerInfo][:broker],
mqttBrokerPort=config[:mqttServerInfo][:port],
)
@@ -94,7 +94,11 @@ function getEmbedding(text::T) where {T<:AbstractString}
:text => [text] # must be a vector of string
)
)
response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
#BUG it returns nothing from ollama
response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120, maxattempt=2)
embedding = response[:response][:embeddings]
return embedding
end
@@ -234,7 +238,7 @@ a = YiemAgent.sommelier(
)
while true
print("your respond: ")
print("\nyour respond: ")
user_answer = readline()
response = YiemAgent.conversation(a, Dict(:text=> user_answer))
println("\n$response")
@@ -244,14 +248,13 @@ end
# response = YiemAgent.conversation(a, Dict(:text=> "I want to get a French red wine under 100."))
"""
hello I want to get a bottle of red wine for my boss. I have a budget around 50 dollars. Show me some options.
I have no idea about his wine taste but he likes spicy food.
"""