Skip to content

Commit 49e40fa

Browse files
committed
fix(extended-memory): use default topK/overfetch in anaphora score lookup
1 parent 6ca092a commit 49e40fa

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

internal/memory/extended/extended_memory.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,15 @@ func (em *ExtendedMemory) AnaphoraResolve(ctx context.Context, msg string) (stri
404404
}
405405

406406
// Match the top returned atom to its vector similarity score.
407-
candidates := em.index.search(msg, em.cfg.SemanticSearchTopK*em.cfg.SemanticSearchOverfetch)
407+
k := em.cfg.SemanticSearchTopK
408+
if k <= 0 {
409+
k = DefaultConfig().SemanticSearchTopK
410+
}
411+
overfetch := em.cfg.SemanticSearchOverfetch
412+
if overfetch <= 0 {
413+
overfetch = DefaultConfig().SemanticSearchOverfetch
414+
}
415+
candidates := em.index.search(msg, k*overfetch)
408416
var topScore float32
409417
for _, c := range candidates {
410418
if c.ID == atoms[0].ID {

0 commit comments

Comments
 (0)