This commit is contained in:
narawat lamaiin
2024-03-17 18:53:49 +07:00
parent 512799d7ca
commit 645e03d41a
2 changed files with 89 additions and 37 deletions

View File

@@ -1200,7 +1200,7 @@ end
)
julia> response = ChatAgent.conversation(newAgent, "Hi! how are you?")
```
# """
"""
function conversation(a::agentReflex, usermsg::String; attemptlimit::Int=3)
a.attemptlimit = attemptlimit
workstate = nothing
@@ -1234,6 +1234,62 @@ function conversation(a::agentReflex, usermsg::String; attemptlimit::Int=3)
return response
end
""" Chat with llm.
Arguments\n
-----
a::agent
an agent
Return\n
-----
None
Example\n
-----
```jldoctest
julia> using JSON3, UUIDs, Dates, FileIO, MQTTClient, ChatAgent
julia> const mqttBroker = "mqtt.yiem.cc"
julia> mqttclient, connection = MakeConnection(mqttBroker, 1883)
julia> tools=Dict( # update input format
"askbox"=>Dict(
:description => "<askbox tool description>Useful for when you need to ask the user for more context. Do not ask the user their own question.</askbox tool description>",
:input => "<input>Input is a text in JSON format.</input><input example>{\"Q1\": \"How are you doing?\", \"Q2\": \"How may I help you?\"}</input example>",
:output => "" ,
:func => nothing,
),
)
julia> msgMeta = Dict(
:msgPurpose=> "updateStatus",
:from=> "agent",
:to=> "llmAI",
:requestresponse=> "request",
:sendto=> "", # destination topic
:replyTo=> "agent/api/v0.1.0/txt/response", # requester ask responseer to send reply to this topic
:repondToMsgId=> "", # responseer is responseing to this msg id
:taskstatus=> "", # "complete", "fail", "waiting" or other status
:timestamp=> Dates.now(),
:msgId=> "$(uuid4())",
)
julia> a = ChatAgent.agentReflex(
"Jene",
mqttclient,
msgMeta,
agentConfigTopic, # I need a function to send msg to config topic to get load balancer
role=:sommelier,
tools=tools
)
julia> newAgent = ChatAgent.agentReact(agent)
julia> response = ChatAgent.conversation(newAgent, "Hi! how are you?")
```
Signature\n
-----
"""
"""
Continuously run llm functions except when llm is getting Answer: or askbox.
There are many work() depend on thinking mode.