This commit is contained in:
2023-12-11 06:57:39 +00:00
parent c590c49a1d
commit 2e55921074
3 changed files with 191 additions and 133 deletions

View File

@@ -59,28 +59,6 @@ end
```jldoctest
julia> using JSON3, UUIDs, Dates, FileIO, CommUtils, ChatAgent
julia> mqttClientSpec = (
clientName= "someclient", # name of this client
clientID= "$(uuid4())",
broker= "mqtt.yiem.ai",
pubtopic= (imgAI="img/api/v0.0.1/gpu/request",
txtAI="txt/api/v0.1.0/gpu/request"),
subtopic= (imgAI="agent/api/v0.1.0/img/respond",
txtAI="agent/api/v0.1.0/txt/respond"),
keepalive= 30,
)
julia> msgMeta = Dict(
:msgPurpose=> "updateStatus",
:from=> "agent",
:to=> "llmAI",
:requestrespond=> "request",
:sendto=> "", # destination topic
:replyTo=> "agent/api/v0.1.0/txt/respond", # requester ask responder to send reply to this topic
:repondToMsgId=> "", # responder is responding to this msg id
:taskstatus=> "", # "complete", "fail", "waiting" or other status
:timestamp=> Dates.now(),
:msgId=> "$(uuid4())",
)
julia> newAgent = ChatAgent.agentReact(
"Jene",
mqttClientSpec,
@@ -226,9 +204,9 @@ function extractStepFromPlan(a::agent, plan::T, step::Int) where {T<:AbstractStr
"""
respond = sendReceivePrompt(a, prompt)
response = sendReceivePrompt(a, prompt)
return respond
return response
end
function checkTotalStepInPlan(a::agent)
@@ -265,8 +243,8 @@ function checkTotalStepInPlan(a::agent)
<|im_start|>assistant
"""
respond = sendReceivePrompt(a, prompt)
result = extract_number(respond)
response = sendReceivePrompt(a, prompt)
result = extract_number(response)
return result
end
@@ -351,13 +329,13 @@ end
# """
# <|im_start|>system
# {systemMsg}
# You always use tools if there is a chance to impove your respond.
# You always use tools if there is a chance to impove your response.
# You have access to the following tools:
# {tools}
# Your job is to determine whether you will use tools or actions to respond.
# Your job is to determine whether you will use tools or actions to response.
# Choose one of the following choices:
# Choice 1: If you don't need to use tools or actions to respond to the stimulus say, "{no}".
# Choice 1: If you don't need to use tools or actions to response to the stimulus say, "{no}".
# Choice 2: If you think the user want to get wine say, "{yes}".
# <|im_end|>
@@ -393,11 +371,10 @@ function isUseTools(a::agentReflex, usermsg::String)
You have access to the following tools:
{tools}
User message:
User's message:
{input}
Your job is to answer the following questions:
Question 1: From the user's message, Do you need to any tools before responding? Answer: {Yes/No/Not sure}. What will the you do?
From the user's message, Do you need to any tools before responseing? Answer: {Yes/No/Not sure}. What will the you do?
<|im_end|>
<|im_start|>assistant
Answer:
@@ -415,9 +392,6 @@ function isUseTools(a::agentReflex, usermsg::String)
result = sendReceivePrompt(a, prompt, temperature=0.2)
# headers = detectCharacters(result, ["Question 1:", "Question 2:"])
# chunkedtext = chunktext(result, headers)
if occursin("Yes", result)
return true
else