update
This commit is contained in:
@@ -69,7 +69,8 @@ julia>
|
||||
|
||||
# Signature
|
||||
"""
|
||||
function virtualWineCustomerReccommendbox(a::T1, input::T2)::String where {T1<:agent, T2<:AbstractString}
|
||||
function virtualWineCustomerReccommendbox(a::T1, input
|
||||
)::Union{Tuple{String, Number, Number, Bool}, Tuple{String, Nothing, Number, Bool}} where {T1<:agent}
|
||||
|
||||
input = "I reccomment Zeno crown vista"
|
||||
|
||||
@@ -92,7 +93,7 @@ function virtualWineCustomerReccommendbox(a::T1, input::T2)::String where {T1<:a
|
||||
mqttBroker= a.config[:mqttServerInfo][:broker],
|
||||
mqttBrokerPort= a.config[:mqttServerInfo][:port],
|
||||
msgId = "dummyid" #CHANGE remove after testing finished
|
||||
)
|
||||
)
|
||||
|
||||
outgoingMsg = Dict(
|
||||
:msgMeta=> msgMeta,
|
||||
@@ -102,9 +103,9 @@ function virtualWineCustomerReccommendbox(a::T1, input::T2)::String where {T1<:a
|
||||
)
|
||||
@show outgoingMsg
|
||||
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
|
||||
response = result[:response][:text]
|
||||
response = result[:response]
|
||||
|
||||
return response
|
||||
return (response[:text], response[:select], response[:reward], response[:isterminal])
|
||||
end
|
||||
|
||||
|
||||
@@ -131,7 +132,8 @@ julia>
|
||||
|
||||
# Signature
|
||||
"""
|
||||
function virtualWineCustomerChatbox(a::T1, input::T2)::String where {T1<:agent, T2<:AbstractString}
|
||||
function virtualWineCustomerChatbox(a::T1, input::T2
|
||||
)::Union{Tuple{String, Number, Number, Bool}, Tuple{String, Nothing, Number, Bool}} where {T1<:agent, T2<:AbstractString}
|
||||
|
||||
# put in model format
|
||||
virtualWineCustomer = a.config[:externalservice][:virtualWineCustomer_1]
|
||||
@@ -192,7 +194,9 @@ julia> result = winestock(agent, input)
|
||||
|
||||
# Signature
|
||||
"""
|
||||
function winestock(a::T1, input::T2) where {T1<:agent, T2<:AbstractString}
|
||||
function winestock(a::T1, input::T2
|
||||
)::Union{Tuple{String, Number, Number, Bool}, Tuple{String, Nothing, Number, Bool}} where {T1<:agent, T2<:AbstractString}
|
||||
|
||||
winesStr =
|
||||
"""
|
||||
1: El Enemigo Cabernet Franc 2019
|
||||
@@ -205,7 +209,7 @@ function winestock(a::T1, input::T2) where {T1<:agent, T2<:AbstractString}
|
||||
$winesStr
|
||||
}
|
||||
"""
|
||||
return result
|
||||
return result, nothing, 0, false
|
||||
end
|
||||
|
||||
|
||||
@@ -218,17 +222,14 @@ end
|
||||
text to be send to virtual wine customer
|
||||
|
||||
# Return
|
||||
- `response::String`
|
||||
response of virtual wine customer
|
||||
- `correctjson::String`
|
||||
corrected json string
|
||||
|
||||
# Example
|
||||
```jldoctest
|
||||
julia>
|
||||
```
|
||||
|
||||
# TODO
|
||||
- [] update docstring
|
||||
- [x] implement the function
|
||||
|
||||
# Signature
|
||||
"""
|
||||
function jsoncorrection(a::T1, input::T2,
|
||||
@@ -306,77 +307,6 @@ function jsoncorrection(a::T1, input::T2,
|
||||
|
||||
return correctjson
|
||||
end
|
||||
# function jsoncorrection(a::T1, input::T2,
|
||||
# correctJsonExample::T3) where {T1<:agent, T2<:AbstractString, T3<:AbstractString}
|
||||
|
||||
# attemptround = 0
|
||||
# incorrectjson = deepcopy(input)
|
||||
# correctjson = nothing
|
||||
# while true
|
||||
# attemptround += 1
|
||||
# if attemptround <= 5
|
||||
# try
|
||||
# JSON3.read(incorrectjson)
|
||||
# correctjson = incorrectjson
|
||||
# break
|
||||
# catch
|
||||
# @warn "Attempting correct JSON string. $attemptround"
|
||||
# incorrectjson = deepcopy(input)
|
||||
# _prompt =
|
||||
# """
|
||||
# Your goal is to correct a given incorrect JSON format while retaining original content.
|
||||
|
||||
# $correctJsonExample
|
||||
|
||||
# Incorrect JSON:
|
||||
# $incorrectjson
|
||||
# Corrention:
|
||||
# """
|
||||
|
||||
# # apply LLM specific instruct format
|
||||
# externalService = a.config[:externalservice][:text2textinstruct]
|
||||
# llminfo = externalService[:llminfo]
|
||||
# prompt =
|
||||
# if llminfo[:name] == "llama3instruct"
|
||||
# formatLLMtext_llama3instruct("system", _prompt)
|
||||
# else
|
||||
# error("llm model name is not defied yet $(@__LINE__)")
|
||||
# end
|
||||
|
||||
# # send formatted input to user using GeneralUtils.sendReceiveMqttMsg
|
||||
# msgMeta = GeneralUtils.generate_msgMeta(
|
||||
# externalService[:mqtttopic],
|
||||
# senderName= "jsoncorrection",
|
||||
# senderId= a.id,
|
||||
# receiverName= "text2textinstruct",
|
||||
# mqttBroker= a.config[:mqttServerInfo][:broker],
|
||||
# mqttBrokerPort= a.config[:mqttServerInfo][:port],
|
||||
# )
|
||||
|
||||
# outgoingMsg = Dict(
|
||||
# :msgMeta=> msgMeta,
|
||||
# :payload=> Dict(
|
||||
# :text=> prompt,
|
||||
# :kwargs=> Dict(
|
||||
# :max_tokens=> 512,
|
||||
# :stop=> ["<|eot_id|>"],
|
||||
# )
|
||||
# )
|
||||
# )
|
||||
# result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
|
||||
# incorrectjson = result[:response][:text]
|
||||
# end
|
||||
# else
|
||||
# error("Can't fix JSON string")
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
|
||||
# return correctjson
|
||||
# end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user