Handle missing config keys during checkpoint search #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When queried for checkpoints of a root graph, the
config
object the checkpointer receives may getcheckpoint_id
orcheckpoint_ns
keys with None or empty string values, or these keys may be missing. Our queries are not handling this situation well.With an empty
checkpoint_id
, we end up querying for the literalNone
string:This doesn't find anything, so the checkpointer fails to return conversation history, and memory "doesn't work."
On the other hand, if
checkpoint_ns
, is unset, we don't include it in the query. This conflicts with the Postgres and SQLlite checkpointer implementations, which search for a literal empty string in that case. The difference is that performing an exact match on only checkpoints whosecheckpoint_ns
is empty finds a different set of checkpoints than "find any matching checkpoint with or without acheckpoint_ns
".Our index doesn't support querying for empty strings on these fields (we would need the INDEXEMPTY option on fields, which RedisVL doesn't currently support and only recent versions of RediSearch support).
This commit doesn't entirely solve the problem, however. Now, we are searching for any checkpoint for the thread, not checkpoints with an empty
checkpoint_id
orcheckpoint_ns
. We need to store a sentinel value like "empty" and then query for it when the keys are not present in config.