Skip to content

Commit 598637a

Browse files
authored
Fix indexer behavior when no kvblock-keys are generated (#118)
* return empty scores when no block-keys Signed-off-by: Maroon Ayoub <[email protected]> * //nolint:nilnil Signed-off-by: Maroon Ayoub <[email protected]> --------- Signed-off-by: Maroon Ayoub <[email protected]>
1 parent 8cd43f2 commit 598637a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/kvcache/indexer.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ func (k *Indexer) GetPodScores(ctx context.Context, prompt, modelName string,
124124

125125
// 2. get block keys
126126
blockKeys := k.tokensProcessor.TokensToKVBlockKeys(tokens, modelName)
127+
if len(blockKeys) == 0 {
128+
traceLogger.Info("no block keys found, returning empty scores")
129+
//nolint:nilnil // no need to return an error
130+
return nil, nil
131+
}
132+
127133
traceLogger.Info("found tokens", "tokens", tokens, "block-keys", blockKeys)
128134

129135
// 3. query kvblock indexer for pods

0 commit comments

Comments
 (0)