remove_seeds_from_memory(harm_categories=["hate"]) also deletes seeds tagged hate_speech, and even whatever. The list filters (harm_categories, authors, groups, parameters) go through field.contains(value), which is an unescaped LIKE '%value%' on the JSON text.
For get_seeds the substring match looks intentional (there are tests for it). But the remove methods already default value to an exact match so a short value can't wipe out more than you meant, and the list filters never got the same treatment.
seeds = [SeedPrompt(value="a", harm_categories=["hate"]),
SeedPrompt(value="b", harm_categories=["hate_speech"]),
SeedPrompt(value="c", harm_categories=["whatever"])]
await memory.add_seeds_to_memory_async(seeds=seeds, added_by="t")
memory.remove_seeds_from_memory(harm_categories=["hate"]) # removes all 3
Suggested fix: when exact=True (the default for removes), match whole list elements using the existing _get_condition_json_array_match helper, and leave get_seeds as is.
remove_seeds_from_memory(harm_categories=["hate"])also deletes seeds taggedhate_speech, and evenwhatever. The list filters (harm_categories,authors,groups,parameters) go throughfield.contains(value), which is an unescapedLIKE '%value%'on the JSON text.For
get_seedsthe substring match looks intentional (there are tests for it). But the remove methods already defaultvalueto an exact match so a short value can't wipe out more than you meant, and the list filters never got the same treatment.Suggested fix: when
exact=True(the default for removes), match whole list elements using the existing_get_condition_json_array_matchhelper, and leaveget_seedsas is.