This commit is contained in:
2023-12-11 05:20:49 +00:00
parent 71986d5c9e
commit c590c49a1d
4 changed files with 85 additions and 35 deletions

View File

@@ -38,13 +38,13 @@ using ..type, ..utils
""" Add new message to agent.
Args:
Arguments:
Return:
```jldoctest
julia> addNewMessage(agent1, "user", "Where should I go to buy snacks")
````
```
"""
function addNewMessage(a::T1, role::String, content::T2) where {T1<:agent, T2<:AbstractString}
if role a.availableRole # guard against typo
@@ -608,7 +608,7 @@ end
"""
Actor function.
Args:
Arguments:
a, one of ChatAgent's agent.
plan, a step by step plan to respond
@@ -731,7 +731,7 @@ end
""" Write evaluation guideline.
Args:
Arguments:
a, one of ChatAgent's agent.
usermsg, stimulus e.g. question, task and etc.
@@ -773,7 +773,7 @@ end
""" Determine a score out of 10 according to evaluation guideline.
Args:
Arguments:
a, one of ChatAgent's agent.
guidelines, an evaluation guideline.
shorttermMemory, a short term memory that logs what happened.
@@ -840,7 +840,7 @@ end
""" Analize work.
Args:
Arguments:
a, one of ChatAgent's agent.
Return:
@@ -893,7 +893,7 @@ end
""" Write a lesson drawn from evaluation.
Args:
Arguments:
a, one of ChatAgent's agent.
report, a report resulted from analyzing shorttermMemory
@@ -947,7 +947,7 @@ end
""" Formulate a respond from work for user's stimulus.
Args:
Arguments:
a, one of ChatAgent's agent.
Return:
@@ -1004,7 +1004,7 @@ end
""" Determine whether LLM should go to next step.
Args:
Arguments:
a, one of ChatAgent's agent.
Return:
@@ -1111,39 +1111,31 @@ end
#WORKING
""" Determine whether LLM should go to next step.
""" Extract important info from text into key-value pair text.
Args:
Arguments:
a, one of ChatAgent's agent.
text, a text you want to extract info
Return:
"Yes" or "no" decision to go next step.
a text with important info are in key-value format.
# Example
```jldoctest
julia> using ChatAgent, CommUtils
julia> using ChatAgent
julia> agent = ChatAgent.agentReflex("Jene")
julia> shorttermMemory = OrderedDict{String, Any}(
"user:" => "What's the latest AMD GPU?",
"Plan 1:" => " To answer this question, I will need to search for the latest AMD GPU using the wikisearch tool.\n",
"Act 1:" => " wikisearch\n",
"Actinput 1:" => " amd gpu latest\n",
"Obs 1:" => "No info available for your search query.",
"Act 2:" => " wikisearch\n",
"Actinput 2:" => " amd graphics card latest\n",
"Obs 2:" => "No info available for your search query.")
julia> decision = goNogo(agent)
"Yes"
julia> text = "We are holding a wedding party at the beach."
julia> extract(agent, text)
"location=beach, event=wedding party"
```
"""
function extractinfo(a, msg)
function extractinfo(a, text::T) where {T<:AbstractString}
prompt =
"""
<|im_start|>system
User message:
$msg
$text
Your job is to extract important info from user's message into keys and values using this format: key=value ,.
p.s.1 you can extract many key-value pairs.