This commit is contained in:
Your Name
2024-02-11 11:45:32 +07:00
parent 9159cd359e
commit 4ae2f4d036
3 changed files with 43 additions and 33 deletions

View File

@@ -350,27 +350,30 @@ function selfAwareness(a::agentReflex)
</About yourself>
<Your job>
Use the following format strictly:
Info extraction: repeat all important info from the latest observed result thoroughly
Info extraction: from the latest observed result, breakdown all info into smaller one and repeat every important info thoroughly
Info mapping: based on extracted info, explicitly state what each info could match which keyword memory's key
Info matching: using JSON format, what key in my memory matches which info
Info matching: using JSON format, what key in my memory matches which info (Donot use nested JSON)
</Your job>
</|system|>
<Example>
<Your earlier work>
The user wants to buy an electric SUV car under 20000 dollars.
The user wants to buy an 4WD electric SUV car under 20000 dollars.
</Your earlier work>
<Your keyword memory>
{\"car type\": null, \"engine type\": null, \"price\": null, \"color\": null, \"financing\": null}
{\"car type\": null, \"powertrain type\": null, \"price\": null, \"color\": null, \"financing\": null, \"drive type\": null}
</Your keyword memory>
<|assistant|>
Info extraction:
- The user is buying an electric SUV car.
- The user is buying a SUV car.
- The user prefers 4WD drive type
- The user prefers electric powertrain
- price is under 20000 dollars
Info mapping:
- "SUV" could matches "car type" key
- "electric" could matches "engine type" key
- "electric" could matches "powertrain type" key
- "under 20000 dollars" could match "price" key
Info matching: {\"car type\": \"SUV\", \"engine type\": \"electric motor\", \"price\": \"under 20000\", \"color\": null, \"financing\": null}
- "4WD" could matches "drive type" key
Info matching: {\"car type\": \"SUV\", \"powertrain type\": \"electric\", \"price\": \"under 20000\", \"color\": null, \"financing\": null, \"drive type\": "4WD"}
</|assistant|>
</Example>
</s>
@@ -903,7 +906,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
keywordmemory = ""
for (k, v) in a.memory[:keyword]
if v === nothing
keywordmemory *= "- I didn't know about the user preferred $k yet.\n"
keywordmemory *= "- The user preferred $k is null \n"
else
keywordmemory *= "- The user preferred $k is $v \n"
end
@@ -918,6 +921,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
- Luxury level is high
{\"car type\": "SUV",\"brand\":\"Lexus\",\"price\":\"200000\",\"color\": null,\"financing method\": null, \"luxury level\":\"high\"}
Thought: Based on the recall, you must address what you don't know first if you have one. Otherwise, you must think about what is the immediate next step to do according to the plan
Recall: repeat each of the user info, if you didn't know (indicate by null) say, which info I didn't know
"""
#WORKING actor donot call final reapond after found matched wines because the current prompt
@@ -936,8 +940,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
</You have access to the following tools>
<Your job>
Use the following format:
Recall: repeat each of the user info, if you didn't know say, which info I didn't know
Thought: based on the recall, you must address what you don't know first if you have one. Otherwise, you must think about what is the immediate next step to do according to the plan (PS. 1. pay attention to correct numeral calculation and commonsense.)
Thought: check the user info thoroughly, if you don't know some info (indicates by null keyword) you must address it first. Otherwise, you must think about what is the immediate next step to do according to the plan (PS. 1. pay attention to correct numeral calculation and commonsense 2. you must assume nothing)
Act: based on your thought what action to choose?, must be one of [{toolnames}].
Actinput: your input to the action using JSON format (pay attention to the tool's input)
Obs: observed result of the action
@@ -952,7 +955,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
</User info>
$winestocksearchresult
<|assistant|>
Recall:
Thought:
"""
prompt_2 =
@@ -981,7 +984,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
"""
prompt = prompt_1
if winestocksearchresult
if nothing values(a.memory[:keyword])
prompt = prompt_2
end
@@ -1250,21 +1253,23 @@ function work(a::agentReflex)
response = formulateUserResponse(a)
println("")
formulatedresponse = response
@show formulatedresponse
# println("")
# formulatedresponse = response
# @show formulatedresponse
a.memory[:shortterm]["response $(a.attempt):"] = response
a.memory[:log]["response $(a.attempt):"] = response
# a.memory[:shortterm]["response $(a.attempt):"] = response
# a.memory[:log]["response $(a.attempt):"] = response
# evaluate. if score > 6/10 good enough.
guideline = writeEvaluationGuideline(a)
# # evaluate. if score > 6/10 good enough.
# guideline = writeEvaluationGuideline(a)
println("")
@show guideline
# println("")
# @show guideline
score = grading(a, guideline, response)
@show score
# score = grading(a, guideline, response)
# @show score
score = 9 #TODO let grading() make a score
if score > 5 # good enough answer
println("")
formulatedresponse_final = response