+
+
+ Load a document and highlight text chunks to label them for chunk
+ extraction/retrieval. Add prompt and query context, then provide
+ ground truth labels for generation evaluation.
+
+
+
+
+
+
+
+
+ setFilePath(e.target.value)}
+ />
+
+
+
+
+
+ Load Document
+
+
+
+
+
+
+
+ {isLoading && (
+
+
+
+
+
+ Loading document...
+
+
+ )}
+
+ {error && (
+
+ {error}
+
+ )}
+
+ {documentContent && (
+ <>
+
+
+ RAG Context
+
+
+
+
+
+ {
+ setPrompt(e.target.value);
+ setHasUnsavedChanges(true);
+ }}
+ rows={3}
+ />
+
+
+
+
+ {
+ setQuery(e.target.value);
+ setHasUnsavedChanges(true);
+ }}
+ rows={3}
+ />
+
+
+
+
+
+
+
+
+ Step 1: Label for Chunk Extraction
+
+
+
+
+
+
+ setLabelingMode(id)}
+ buttonSize="s"
+ />
+
+
+
+
+
+ Label Selected Text
+
+
+
+
+
+
+
+ {selectedText && (
+
+ {selectedText.text}
+
+ )}
+
+
+
+
+
+ Document Content
+
+
+
+
+ {renderDocumentWithHighlights(documentContent.content)}
+
+
+
+
+
+
+
+ Step 2: Label for Generation
+
+
+
+
+ {
+ setGroundTruthLabel(e.target.value);
+ setHasUnsavedChanges(true);
+ }}
+ rows={3}
+ />
+
+
+
+
+
+
+
+ Save Labels
+
+
+
+
+
+
+ {(labels.length > 0 || groundTruthLabel || prompt || query) && (
+ <>
+
+
+ Click "Save Labels" to download your labeled data as a JSON
+ file.
+
+
+
+ >
+ )}
+
+
+
+ {hasUnsavedChanges && (
+ <>
+
+
+ You have unsaved changes. Click "Save Labels" to persist your
+ work.
+
+
+
+ >
+ )}
+
+ {labels.length > 0 && (
+ <>
+
+
+
+ Extracted Chunk Labels ({labels.length})
+
+
+ {labels.map((label, index) => (
+
+
+
+ Chunk: {label.label}
+
+
+ {label.groundTruthLabel && (
+
+
+ GT: {label.groundTruthLabel}
+
+
+ )}
+
+
+ "{label.text.substring(0, 80)}
+ {label.text.length > 80 ? "..." : ""}"
+
+
+
+ handleRemoveLabel(index)}
+ >
+ Remove
+
+
+
+ ))}
+
+ >
+ )}
+ >
+ )}
+
+ );
+};
+
+export default RagTab;
diff --git a/ui/src/test-document.txt b/ui/src/test-document.txt
index 9a25d0c3d95..eae58809242 100644
--- a/ui/src/test-document.txt
+++ b/ui/src/test-document.txt
@@ -1,4 +1,4 @@
-This is a sample document for testing the document labeling functionality in Feast UI.
+This is a sample document for testing the data labeling functionality in Feast UI.
The document contains multiple paragraphs and sections that can be used to test the text highlighting and labeling features.