This commit is contained in:
2024-01-24 14:36:04 +00:00
parent ae7861a55e
commit 5eece2e9fd
4 changed files with 152 additions and 359 deletions

View File

@@ -4,7 +4,7 @@ module interface
export agentReact, agentReflex,
addNewMessage, clearMessage, removeLatestMsg, conversation, directconversation,
writeEvaluationGuideline, grading, analyze, selfReflext,
formulateUserresponse, extractinfo, updateEnvState, chat_mistral_openorca,
formulateUserResponse, extractinfo, updateEnvState, chat_mistral_openorca,
recap
using JSON3, DataStructures, Dates, UUIDs, HTTP, Random
@@ -229,7 +229,7 @@ function planner_mistral_openorca(a::agentReflex)
<|assistant|>
Plan:
"""
# WORKING provide ecmaple that show good planning
# provide ecmaple that show good planning
plan = sendReceivePrompt(a, assistant_plan_prompt, max_tokens=1024, temperature=0.1,
timeout=180, stopword=["<|user|>", "</"])
plan = split(plan, "<|")[1]
@@ -290,6 +290,7 @@ function updatePlan(a::agentReflex)
end
# function selfAwareness(a::agentReflex)
# getonlykeys = ["Actinput", "Obs"]
# worknoplan = similar(a.memory[:shortterm])
@@ -310,33 +311,83 @@ end
# aboutYourself =
# """
# Your name is $(a.agentName)
# $(a.roles[a.role])
# $(a.roles[a.role])
# """
# # prompt =
# # """
# # <|system|>
# # <About yourself>
# # $aboutYourself
# # $(a.roleSpecificInstruction[a.role])
# # </About yourself>
# # <Your earlier work>
# # $work
# # </Your earlier work>
# # <Your plan>
# # $(a.memory[:shortterm]["Plan 1:"])
# # </Your plan>
# # <Your job>
# # Use the following format strictly:
# # What do I know: based on observed results, repeat all the information you got.
# # Info matching: using JSON format, explicitly state what information matches which variable name in my plan.
# # What am I missing: based on Info match, describe in detail what you are still missing based on the plan.
# # P.S. do not mention any toolnames
# # </Your job>
# # <Example>
# # What do I know:
# # - The user is buying an electric SUV car.
# # Info matching: {"car type": "SUV", "engine": "electric motor", "color": "N/A", "financing": "N/A"}
# # What am I missing:
# # - The user's preferred color
# # - The user's financing method
# # </Example>
# # </s>
# # <|assistant|>
# # What I know:
# # """
# prompt =
# """
# <|system|>
# <About yourself>
# $aboutYourself
# $(a.roleSpecificInstruction[a.role])
# </About yourself>
# <Your work>
# <Your earlier work>
# $work
# </your work
# </Your earlier work>
# <Your plan>
# $(a.memory[:shortterm]["Plan 1:"])
# </Your plan>
# <Your job>
# Use the following format:
# What I know: based on observed results, repeat all the details of what you have been gathered.
# Current progress: focus on checking your progress against the plan.
# What I am missing: describe in detail what you are missing.
# Use the following format strictly:
# What I know: based on observed results, repeat all the information you got thoroughly
# Info match: using JSON format, explicitly state what information might matches which variable name in my plan
# What am I missing: based on Info match, describe in detail what you are still missing based on the plan
# P.S. do not mention any toolnames
# </Your job>
# <Example>
# user response:
# - EV could mean electric vehicle
# What do I know:
# - The user is buying an electric SUV car.
# Info matching: {"car type": "SUV", "engine type": "electric motor", "color": "not know yet", "financing": "not know yet"}
# What am I missing:
# - The user's preferred color
# - The user's financing method
# </Example>
# </s>
# <|assistant|>
# What I know:
# """
# response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.4, timeout=180,
# stopword=["/n/n", "END", "End", "Obs", "<|", "</"])
# response = split(response, "<|")[1]
# response = split(response, "</")[1]
# @show response
# return response
@@ -366,40 +417,6 @@ function selfAwareness(a::agentReflex)
"""
# prompt =
# """
# <|system|>
# <About yourself>
# $aboutYourself
# $(a.roleSpecificInstruction[a.role])
# </About yourself>
# <Your earlier work>
# $work
# </Your earlier work>
# <Your plan>
# $(a.memory[:shortterm]["Plan 1:"])
# </Your plan>
# <Your job>
# Use the following format strictly:
# What do I know: based on observed results, repeat all the information you got.
# Info matching: using JSON format, explicitly state what information matches which variable name in my plan.
# What am I missing: based on Info match, describe in detail what you are still missing based on the plan.
# P.S. do not mention any toolnames
# </Your job>
# <Example>
# What do I know:
# - The user is buying an electric SUV car.
# Info matching: {"car type": "SUV", "engine": "electric motor", "color": "N/A", "financing": "N/A"}
# What am I missing:
# - The user's preferred color
# - The user's financing method
# </Example>
# </s>
# <|assistant|>
# What I know:
# """
prompt =
"""
<|system|>
@@ -416,17 +433,15 @@ function selfAwareness(a::agentReflex)
</Your plan>
<Your job>
Use the following format strictly:
What I know: based on observed results, repeat all the information you got
Info match: using JSON format, explicitly state what information matches which variable name in my plan
What am I missing: based on Info match, describe in detail what you are still missing based on the plan
What I know: based on observed results, breakdown then repeat all information you got one by one
Info matching: using JSON format, explicitly state what information matches which variable name in my plan
What am I missing: based on Info matching, describe in detail what you are still missing based on the plan
P.S. do not mention any toolnames
</Your job>
<Example>
user response:
- EV could mean electric vehicle
What do I know:
- The user is buying an electric SUV car.
Info matching: {"car type": "SUV", "engine type": "electric motor", "color": "not know yet", "financing": "not know yet"}
Info matching: {"car type": "SUV", "engine type": "electric motor", "color": null, "financing": null}
What am I missing:
- The user's preferred color
- The user's financing method
@@ -435,11 +450,58 @@ function selfAwareness(a::agentReflex)
<|assistant|>
What I know:
"""
response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.4, timeout=180,
response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.2, timeout=180,
stopword=["/n/n", "END", "End", "Obs", "<|", "</"])
response = split(response, "<|")[1]
response = split(response, "</")[1]
@show response
@show selfaware_1 = response
#WORKING
headerToDetect = ["What I know:", "Info matching:", "What am I missing:",]
headers = detectCharacters(response, headerToDetect)
chunkedtext = chunktext(response, headers)
println("")
_infomatch = chunkedtext["Info matching:"]
_infomatch = GeneralUtils.getStringBetweenCharacters(_infomatch, '{', '}', endCharLocation="next")
infomatch = copy(JSON3.read(_infomatch))
keywordMemoryUpdate!(a.memory[:keyword], infomatch)
prompt =
"""
<|system|>
<About yourself>
$aboutYourself
$(a.roleSpecificInstruction[a.role])
</About yourself>
<Your plan>
$(a.memory[:shortterm]["Plan 1:"])
</Your plan>
<Your job>
Use the following format strictly:
What am I missing: based on Info matching, describe in detail what you are still missing according to the plan
P.S. do not mention any toolnames
</Your job>
<Example>
Info matching: {"car type": "SUV", "engine type": "electric motor", "color": null, "financing": null}
What am I missing:
- The user's preferred color
- The user's financing method
</Example>
</s>
<|assistant|>
Info matching: $(JSON3.write(a.memory[:keyword]))
What am I missing:
"""
response = "What am I missing:" * sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.4, timeout=180,
stopword=["/n/n", "END", "End", "Obs", "<|", "</"])
response = split(response, "<|")[1]
response = split(response, "</")[1]
response = "Info matching:" * chunkedtext["Info matching:"] * response
@show selfaware_2 = response
return response
end
@@ -506,13 +568,9 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
thought = "Thought: you should always think about what to do according to the plan (pay attention to correct numeral calculation and commonsense and do one thing at a time.)"
if selfaware !== nothing
# aware = "Self-awareness: based on the recap, assess your progress against the plan then identify areas where you need to address."
# aware = "Self-awareness: based on the recap and the plan, state your current understanding of the matter in details then identify areas where you need to address."
# aware = "Self-awareness: Based on Obs, review your progress against the plan. Then, describe in detail the results you have achieved so far. Finally, describe in detail what you are missing. (focus on your actions and their results)"
# aware = "Self-awareness: Based on action's input and observed results, check your progress against the plan. Then, repeat all the details of what you have been gathered. Finally, describe in detail what you are missing."
thought =
"Self-awareness: $selfaware
Thought: based on self-awareness, you should always think about what to do next by prioritizing what you missed first. (P.S. 1) let's think a single step. 2) pay attention to correct numeral calculation and commonsense.)
Thought: To think about your next step, reflect on your self-awareness and prioritize what you need to improve first then consult your plan. (P.S. 1) let's think a single step. 2) pay attention to correct numeral calculation and commonsense.)
"
end
# your should request the missing information first before making a decision
@@ -564,6 +622,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
$work
"Thought: "
"""
prompt = replace(prompt, "{toolnames}" => toolnames)
println("")
@@ -826,7 +885,7 @@ function work(a::agentReflex)
elseif actorstate == "formulateFinalResponse"
println("all tasks done")
response = formulateUserresponse(a)
response = formulateUserResponse(a)
println("")
formulatedresponse = response
@@ -928,8 +987,6 @@ function actor(a::agentReflex)
selfaware = nothing
if length(a.memory[:shortterm]) > 2 # must have User:, Plan:, Thought:, Act:, Actinput: already
selfaware = selfAwareness(a)
println("")
@show selfaware
end
actorResult = actor_mistral_openorca(a, selfaware)
@@ -1229,10 +1286,10 @@ end
"Actinput 2:" => " amd graphics card latest\n",
"Obs 2:" => "No info available for your search query.")
julia> report = formulateUserresponse(agent, shorttermMemory)
julia> report = formulateUserResponse(agent, shorttermMemory)
```
"""
function formulateUserresponse(a)
function formulateUserResponse(a)
conversation = messagesToString_nomark(a.messages, addressAIas="I")
work = dictToString(a.memory[:shortterm])
@@ -1256,7 +1313,7 @@ function formulateUserresponse(a)
</your earlier work>
<your job>
Based on your talk with the user and your work, present a response that compares and justifies each option in great detail.
Based on your talk with the user and your work, present a response that compares and justifies each option in great detail to the user.
</your job>
</s>
<|assistant|>
@@ -1266,7 +1323,7 @@ function formulateUserresponse(a)
return response
end
# function formulateUserresponse(a)
# function formulateUserResponse(a)
# conversation = messagesToString_nomark(a.messages, addressAIas="I")
# work = dictToString(a.memory[:shortterm])

View File

@@ -59,36 +59,8 @@ end
# function winestock(a::agentReflex, phrase::T) where {T<:AbstractString}
# result =
# """
# I found the following wines
# {
# 1: {
# Chateau: Louis Latou,
# name: Corton-Charlamagne,
# grape variety: chardonnay,
# year: 2014,
# price: 55 USD,
# stock ID: ws-114,
# Description: Corton-Charlemagne 2018 is a powerful, complex wine. Its nose is intense, with notes of white stone fruits such as white peach, fresh hazelnut, vanilla, and almond paste. The wine is full-bodied for the palate, and the vanilla is complemented by aromas of fresh almond and lime blossom. The experience ends with a very fine aromatic aftertaste that has subtle saline notes.,
# },
# 2: {
# Chateau: Beaucastel,
# name: Malbec Argentino,
# grape variety: riesling,
# year: 2016,
# price: 39 USD,
# stock ID: ed-23,
# Description: The quintessence of Château de Beaucastel, Hommage à Jacques Perrin delights us every year, and the 2019 vintage is no exception. To the eye it offers a splendid deep red color, verging on black. Full of power and supremely elegant, the nose is of magnificent aromatic complexity with notes of black fruit and spices that offer all the characteristic expression of Mourvèdre. Perfectly balanced by an incredible freshness, the mouth is eminently elegant with intense and complex aromas of great subtlety, a full, refined texture, subtle tannins of great finesse, and infinite length. A great classic Hommage à Jacques Perrin.,
# }
# }
# """
# return result
# end
#WORKING
"""
Arguments:
@@ -183,130 +155,6 @@ function winestock(a::agentReflex, actorResult::NamedTuple)
<|assistant|>
"""
# prompt =
# """
# <|system|>
# <About yourself>
# Your are a helpful assistant.
# </About yourself>
# <You have the following conversion table>
# Intensity level:
# intensity = 1, light bodied
# intensity = 2, light-medium bodied
# intensity = 3, medium bodied
# intensity = 4, medium-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, low-medium tannin
# tannin = 3, medium tannin
# tannin = 4, medium-high tannin
# tannin = 5, high tannin
# Acidity level:
# acidity = 1, low acidity
# acidity = 2, low-medium acidity
# acidity = 3, medium acidity
# acidity = 4, medium-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 the info from the user.
# List of keywords not allowed in SQL: ["BETWEEN", "--", "WHEN", "IN"]
# Use the following format:
# Think: How do I map the info in the query to conversion table
# Info map: based on conversion table, map the info in query to appropriate variables
# SQL: write a specific SQL command
# </Your job>
# <Example 1>
# 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\": {\"max\": \"50 USD\"}}
# SQL: SELECT * FROM White WHERE intensity = 5 AND sweetness = 2 AND acidity = 1 AND tannin = 2 AND price <= 50;
# </Example 1>
# <Example 2>
# 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\": {\"max\": \"22 USD\"}}
# SQL: SELECT * FROM Rose WHERE intensity = 1 AND tannin = 2 AND (sweetness = 1 OR sweetness = 2) AND price <= 22;
# </Example 2>
# </s>
# <|user's info|>
# $(actorResult[:selfaware])
# </s>
# <|assistant|>
# """
# prompt =
# """
# <s>[INST]
# <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, light-medium bodied
# intensity = 3, medium bodied
# intensity = 4, medium-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, low-medium tannin
# tannin = 3, medium tannin
# tannin = 4, medium-high tannin
# tannin = 5, high tannin
# Acidity level:
# acidity = 1, low acidity
# acidity = 2, low-medium acidity
# acidity = 3, medium acidity
# acidity = 4, medium-high acidity
# acidity = 5, high acidity
# </You have the following conversion table>
# <query info>
# The user is planning a wedding party and needs a bottle of wine for the occasion.\n - Thai dishes will be served at the wedding party.\n - The ambient temperature at the serving location is around 22 degrees Celsius.\n - The user prefers a red wine with medium-bodied, dry and low to medium tannin.\n - The user prefers a medium acidity level for the wine.\n - The user's budget for the bottle of wine is around 15 USD.\n\n Info match:\n - Occasion: wedding party\n - Type of food: Thai dishes\n - Ambient temperature: around 22 degrees Celsius\n - Preferred type of wine: red\n - Wine sweetness level: dry\n - Wine intensity level: medium-bodied\n - Wine tannin level: low to medium\n - Wine acidity level: medium\n - Wine price range: around 15 USD\n\n
# <query info>
# Consult the conversion table then write a specific SQL command using the query info to search a database table.
# List of keywords not allowed in SQL: ["BETWEEN", "--", "WHEN", "IN"]
# Use the following format:
# Think: How do I map the info in the query to conversion table
# Info map: based on conversion table, map the info in query to appropriate variables
# SQL: write a specific SQL command
# [/INST]
# 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\": {\"max\": \"50 USD\"}}
# SQL: SELECT * FROM White WHERE intensity = 5 AND sweetness = 2 AND acidity = 1 AND tannin = 2 AND price <= 50;
# </s>
# [INST]
# <query info>
# $(actorResult[:selfaware])
# <query info>
# Consult the conversion table then write a specific SQL command using the query info.
# List of keywords not allowed in SQL: ["BETWEEN", "--", "WHEN", "IN"]
# [/INST]
# """
println("")
@show db_prompt = prompt
_sql = nothing
@@ -388,144 +236,6 @@ function winestock(a::agentReflex, actorResult::NamedTuple)
end
# function winestock(a::agentReflex, query::Dict)
# query = JSON3.write(query)
# @show query
# prompt =
# """
# <|system|>
# <About yourself>
# Your are a helpful assistant.
# </About yourself>
# <You have the following conversion table>
# Intensity level:
# intensity = 1, light bodied
# intensity = 2, light-medium bodied
# intensity = 3, medium bodied
# intensity = 4, medium-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, low-medium tannin
# tannin = 3, medium tannin
# tannin = 4, medium-high tannin
# tannin = 5, high tannin
# Acidity level:
# acidity = 1, low acidity
# acidity = 2, low-medium acidity
# acidity = 3, medium acidity
# acidity = 4, medium-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"]
# </Your job>
# <Example 1>
# query: {\"wine type\": \"white\", \"wine characteristics\": \"full-bodied | off-dry | low acidity | medium tannin\", \"price\": {\"max\": \"50\"}}
# assistant: SELECT * FROM White WHERE intensity = 5 AND sweetness = 2 AND acidity = 1 AND tannin = 3 AND price <= 50;
# </Example 1>
# <Example 2>
# query: {\"wine characteristics\":\"low-bodied | semi-sweet | low-medium tannin\",\"price\":\"22 USD\",\"occasion\":\"anniversary\",\"wine type\":\"Rose\",\"food\":\"American dishes\"}
# assistant: SELECT * FROM Rose WHERE intensity = 1 AND sweetness = 3 AND (tannin = 2 OR tannin = 3) AND price <= 22;
# </Example 2>
# </s>
# <|query|>
# $query
# </s>
# <|assistant|>
# """
# println("")
# @show db_prompt = prompt
# _sql = nothing
# while true
# _sql = sendReceivePrompt(a, prompt, max_tokens=256, temperature=0.2,
# stopword=["/n/n", "END", "End", "Obs", "<|", "</"])
# _sql = split(_sql, ";")[1] * ";"
# # check for valid SQL command
# check_1 = occursin("BETWEEN", _sql)
# check_2 = occursin("--", _sql)
# check_3 = occursin("IN", _sql)
# if check_1 == false && check_2 == false && check_3 == false
# break
# end
# println("illegal SQL command")
# end
# println("")
# @show db_sql = replace(_sql, '\n'=>"")
# # remove any blank character in front of a string
# newsql = nothing
# for i in eachindex(_sql)
# if _sql[i] != ' '
# newsql = _sql[i:end]
# break
# end
# end
# body = newsql
# uri = URI(scheme="http", host="192.168.88.12", port="9010", path="/sql", userinfo="root:root")
# r = HTTP.request("POST", uri, ["Accept" => "application/json", "NS"=>"yiem", "DB"=>"Blossom_wines"], body)
# println("")
# @show r
# a.memory[:r] = r
# result = copy(JSON3.read(r.body))
# wines = shuffle(result[1][:result]) # shuffle in case there are more than 1 result
# println("")
# @show wines
# # choose only 2 wines
# if length(wines) > 2
# println("$(length(wines)) wines found")
# wines = wines[1:2]
# end
# result = nothing
# if length(wines) == 0
# result =
# """
# Wine not found.
# """
# else
# # write wines dictionary in to string
# wines_str = ""
# for (i, wine) in enumerate(wines)
# winename = wine[:wine_name]
# wines_str *= "$i: $(JSON3.write(wines[i])),"
# end
# result =
# """
# I found the following wines in our stock:
# {
# $wines_str
# }
# """
# end
# @show result
# return result
# end

View File

@@ -99,11 +99,12 @@ julia> agent = ChatAgent.agentReflex(
env::AbstractString = "N/A"
thinkingFormat::Union{Dict, Nothing} = nothing
roleSpecificInstruction::Union{Dict, Nothing} = nothing
memory::Dict{Symbol, Any} = Dict(
memory::Dict{Any, Any} = Dict(
:shortterm=> OrderedDict{String, Any}(),
:longterm=> OrderedDict{String, Any}(),
:log=> OrderedDict{String, Any}(), # span from user stimulus -> multiples attempts -> final respond
)
:keyword=> Dict{String, Any}(),
)
# LLM function related
winestockResult = ""
@@ -151,8 +152,8 @@ function agentReflex(
"""
Request the users input for the following info initially, and use alternative sources of information only if they are unable to provide it:
- occasion
- type of food that will be served with wine
- type of wine (we have Rose, White, Red, Rose and Sparkling)
- food type that will be served with wine
- wine type (Rose, White, Red, Rose, Sparkling, Dessert)
- wine sweetness level (dry to very sweet)
- wine intensity level (light to full bodied)
- wine tannin level (low to high)

View File

@@ -4,7 +4,8 @@ export sendReceivePrompt, chunktext, extractStepFromPlan, checkTotalTaskInPlan,
detectCharacters, findDetectedCharacter, extract_number, toolNameBeingCalled,
isUsePlans, conversationSummary, checkReasonableness, replaceHeaders,
addShortMem!, splittext, dictToString, removeHeaders, keepOnlyKeys, experience,
messagesToString, messagesToString_nomark, removeTrailingCharacters, shortMemLatestTask
messagesToString, messagesToString_nomark, removeTrailingCharacters, shortMemLatestTask,
keywordMemoryUpdate!
using UUIDs, Dates, DataStructures
using CommUtils, GeneralUtils
@@ -944,7 +945,7 @@ end
```jldoctest
julia> dict = OrderedDict(
"Plan 1:" => "1. Ask about the type of food that will be served at the wedding party.")
julia>shortMemLatestTask(dict)
julia> shortMemLatestTask(dict)
"""
function shortMemLatestTask(dict::T) where {T<:AbstractDict}
_latest_step = keys(dict)
@@ -955,8 +956,32 @@ function shortMemLatestTask(dict::T) where {T<:AbstractDict}
end
""" Update a keyword memory
Arguments:
newinfo = a dictionary contain new info
keywordmemory = a dictionary contain previous info
Return:
an updated keyword memory
Example:
```jldoctest
julia> newinfo = Dict("car type" => "SUV", "engine type" => "electric")
julia> keywordmemory = Dict("car type" => "sedan", "car color" => "blue", "financing" => null)
julia> keywordMemoryUpdate(keywordmemory, newdict)
"""
function keywordMemoryUpdate!(keywordmemory::AbstractDict, newinfo::AbstractDict)
for (k, v) in newinfo
k = String(k)
if v === nothing && haskey(keywordmemory, k) && keywordmemory[k] !== nothing
# skip
else
keywordmemory[k] = v
end
end
end