InferenceAI

Enter at least two characters to search.

Start free

Deduplicate Retrieved Chunks

easyRAG12 min10 XP

Return chunks with duplicate IDs removed, keeping the first occurrence. Each chunk is [id,text].

Examples

EXAMPLE WALKTHROUGHduplicate

A guided view of the published example, not a trace of your code.

INPUT[[[1,"a"],[1,"a2"],[2,"b"]]]
TASKdeduplicate_chunks()
EXPECTED OUTPUT[[1,"a"],[2,"b"]]

Start with the input values shown in this example.

Example 1 of 2

Input: chunks = [[1,"a"],[1,"a2"],[2,"b"]]

Output: [[1,"a"],[2,"b"]]

Explanation: duplicate

Input: chunks = []

Output: []

Explanation: empty

Hint 1

Track IDs already seen.

Topics

PythonRAG