This commit is contained in:
Your Name
2024-02-08 19:40:12 +07:00
parent cb24340777
commit 62fa62253f
2 changed files with 96 additions and 19 deletions

View File

@@ -844,7 +844,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
</You have access to the following tools>
<Your job>
Use the following format:
Thought: considering what you know about the user thoroughly then you should think about what to do next according to your plan while prioritize what you don't know (null means don't know) first. (PS. 1. let's think only one thing at a time. 2. pay attention to correct numeral calculation and commonsense.)
Thought: based on what you know about the user, where are you at according to the plan? what to do next?. (PS. 1. let's think only one thing at a time. 2. pay attention to correct numeral calculation and commonsense.)
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
@@ -863,7 +863,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
- Luxury level is high
</What I know about the user>
<|assistant|>
Thought: Based on what I know about the user, I still don't know what color the user like. I should ask the user.
Thought: after checking what I know about the user against my plan, I still don't know the color and financing method yet. Next, I need to know what color the user like.
Act: askbox
Actinput:
</|assistant|>
@@ -1269,6 +1269,7 @@ function actor(a::agentReflex)
addShortMem!(a.memory[:shortterm], chunkedtext)
println(">>> already done")
actorState = "formulateFinalResponse"
error(5555)
break
else # function call
addShortMem!(a.memory[:shortterm], chunkedtext)

View File

@@ -92,11 +92,78 @@ function winestock(a::agentReflex, input::NamedTuple)
println("")
@show query
# prompt =
# """
# <|system|>
# <About yourself>
# Your are a helpful assistant.
# </About yourself>
# <You have the following conversion table>
# Database table name by wine type:
# Red = table for wine type "red"
# White = table for wine type "white"
# Sparkling = table for wine type "sparkling"
# Rose = table for wine type "rose"
# Dessert = table for wine type "dessert"
# Fortified = table for wine type "fortified"
# Intensity level:
# intensity = 1, light bodied
# intensity = 2, semi-light bodied
# intensity = 3, medium bodied
# intensity = 4, semi-full bodied
# intensity = 5, full bodied
# Sweetness level:
# sweetness = 1, dry
# sweetness = 2, off-dry
# sweetness = 3, semi-sweet
# sweetness = 4, sweet
# sweetness = 5, very sweet
# Tannin level:
# tannin = 1, low tannin
# tannin = 2, semi-low tannin
# tannin = 3, medium tannin
# tannin = 4, semi-high tannin
# tannin = 5, high tannin
# Acidity level:
# acidity = 1, low acidity
# acidity = 2, semi-low acidity
# acidity = 3, medium acidity
# acidity = 4, semi-high acidity
# acidity = 5, high acidity
# </You have the following conversion table>
# <Your job>
# Consult the conversion table then write a specific SQL command using only available info from a JSON-format query.
# List of keywords not allowed in SQL: ["BETWEEN", "--", "WHEN", "IN"]
# Use the following format:
# Info map: based on conversion table, map the info in query to appropriate variables
# SQL: write a specific SQL command
# </Your job>
# <Example 1>
# query: {\"wine type\": \"white\", \"wine characteristics\": \"full-bodied | off-dry | low acidity | low to medium tannin\", \"price\": {\"max\": \"50\"}}
# Think: 1) low to medium tannin is not explicitly stated, but assuming it falls within the range of low-medium tannin.
# Info map: {\"wine type\": \"white\", \"intensity\": 5, \"sweetness\": 2, \"tannin\": 2, \"acidity\": 1, \"price\": 50}
# SQL: SELECT * FROM White WHERE intensity = 5 AND sweetness = 2 AND acidity = 1 AND tannin = 2 AND price <= 50;
# </Example 1>
# <Example 2>
# query: {\"wine characteristics\":\"low-bodied | a little sweet | low-medium tannin\",\"price\":\"22 USD\",\"occasion\":\"anniversary\",\"wine type\":\"Rose\",\"food\":\"American dishes\"}
# Think: 1) medium sweet is not explicitly stated, but assuming it falls within the range of dry and off-dry.
# Info map: {\"wine type\": \"Rose\", \"intensity\": 1, \"sweetness\": 3, \"tannin\": 2, \"acidity\": 3, \"price\": 22, \"food\":\"American dishes\"}
# SQL: SELECT * FROM Rose WHERE intensity = 1 AND tannin = 2 AND (sweetness = 1 OR sweetness = 2) AND price <= 22 AND food = American;
# </Example 2>
# </s>
# <|query|>
# $query
# </s>
# <|assistant|>
# """
prompt =
"""
<s>
<|system|>
<About yourself>
Your are a helpful assistant.
Your are a helpful assistant.
</About yourself>
<You have the following conversion table>
Database table name by wine type:
@@ -132,30 +199,39 @@ function winestock(a::agentReflex, input::NamedTuple)
acidity = 5, high acidity
</You have the following conversion table>
<Your job>
Consult the conversion table then write a specific SQL command using only available info from a JSON-format query.
List of keywords not allowed in SQL: ["BETWEEN", "--", "WHEN", "IN"]
Write a specific SQL command from a query using a conversion table
List of keywords not allowed the command: ["BETWEEN", "--", "WHEN", "IN"]
Use the following format:
Info map: based on conversion table, map the info in query to appropriate variables
SQL: write a specific SQL command
Use the following format:
Info map: based on conversion table, map the info in query to appropriate variables
SQL: write a specific SQL command
</Your job>
<Example 1>
query: {\"wine type\": \"white\", \"wine characteristics\": \"full-bodied | off-dry | low acidity | low to medium tannin\", \"price\": {\"max\": \"50\"}}
</|system|>
<Example 1>
<query>
{\"wine type\": \"white\", \"wine characteristics\": \"full-bodied | off-dry | low acidity | low to medium tannin\", \"price\": {\"max\": \"50\"}}
</query>
<|assistant|>
Think: 1) low to medium tannin is not explicitly stated, but assuming it falls within the range of low-medium tannin.
Info map: {\"wine type\": \"white\", \"intensity\": 5, \"sweetness\": 2, \"tannin\": 2, \"acidity\": 1, \"price\": 50}
SQL: SELECT * FROM White WHERE intensity = 5 AND sweetness = 2 AND acidity = 1 AND tannin = 2 AND price <= 50;
</Example 1>
<Example 2>
query: {\"wine characteristics\":\"low-bodied | a little sweet | low-medium tannin\",\"price\":\"22 USD\",\"occasion\":\"anniversary\",\"wine type\":\"Rose\",\"food\":\"American dishes\"}
</|assistant|>
</Example 1>
<Example 2>
<query>
{\"wine characteristics\":\"low-bodied | a little sweet | low-medium tannin\",\"price\":\"22 USD\",\"occasion\":\"anniversary\",\"wine type\":\"Rose\",\"food\":\"American dishes\"}
</query>
<|assistant|>
Think: 1) medium sweet is not explicitly stated, but assuming it falls within the range of dry and off-dry.
Info map: {\"wine type\": \"Rose\", \"intensity\": 1, \"sweetness\": 3, \"tannin\": 2, \"acidity\": 3, \"price\": 22, \"food\":\"American dishes\"}
SQL: SELECT * FROM Rose WHERE intensity = 1 AND tannin = 2 AND (sweetness = 1 OR sweetness = 2) AND price <= 22 AND food = American;
</Example 2>
</s>
<|query|>
</|assistant|>
</Example 2>
</s>
<query>
$query
</s>
<|assistant|>
</query>
<|assistant|>
"""
println("")
@@ -234,7 +310,7 @@ function winestock(a::agentReflex, input::NamedTuple)
end
@show result
error(7777)
return result
end