Skip to content

Commit 8a54afe

Browse files
committed
fix(rag): clarify web research ingestion failure messages
**Problem:** When web research fails to ingest content (too small/fragmented), error messages said: "RECOMMENDATION: Process this content directly without RAG ingestion." This confused agents because: - No actual content was provided to process - Agent received confusing instruction with no actionable data - Led to hallucination or repeated tool calls **Solution:** Replaced both error messages with clear, simple guidance: "This source did not return useable results... Please skip this source and try another." **Changes:** - VectorRAGService.swift line 781: Content too small error - VectorRAGService.swift line 860: Zero chunks error **Testing:** ✅ Build: PASS (make build-debug)
1 parent 9421342 commit 8a54afe

1 file changed

Lines changed: 6 additions & 18 deletions

File tree

Sources/ConversationEngine/VectorRAGService.swift

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -778,15 +778,9 @@ public class DocumentChunker: @unchecked Sendable {
778778
if document.content.count < minChunkSize {
779779
logger.warning("CONTENT_TOO_SMALL: Document '\(document.title)' has only \(document.content.count) characters (min: \(minChunkSize))")
780780
throw VectorRAGError.ingestionFailed("""
781-
Content too small to chunk: \(document.content.count) characters (minimum: \(minChunkSize)).
782-
783-
RECOMMENDATION: Process this content directly without RAG ingestion.
784-
The content is brief enough to include in your response without needing semantic search.
785-
786-
For very short content (summaries, snippets, brief articles):
787-
- Use the content directly in your synthesis
788-
- No need to store in memory
789-
- Reference the source URL for attribution
781+
This source did not return useable results (content too small: \(document.content.count) characters, minimum: \(minChunkSize)).
782+
783+
Please skip this source and try another.
790784
""")
791785
}
792786

@@ -855,15 +849,9 @@ public class DocumentChunker: @unchecked Sendable {
855849
if chunks.isEmpty {
856850
logger.warning("ZERO_CHUNKS: Document '\(document.title)' produced no chunks (content: \(document.content.count) chars, min: \(minChunkSize))")
857851
throw VectorRAGError.ingestionFailed("""
858-
No chunks created from content: Document has \(document.content.count) characters but all segments were below minimum chunk size (\(minChunkSize)).
859-
860-
RECOMMENDATION: Process this content directly without RAG ingestion.
861-
The content is too fragmented or brief for semantic chunking.
862-
863-
For very short or fragmented content:
864-
- Use the content directly in your synthesis
865-
- No need to store in memory
866-
- Reference the source URL for attribution
852+
This source did not return useable results (content too fragmented: \(document.content.count) characters but no valid chunks created).
853+
854+
Please skip this source and try another.
867855
""")
868856
}
869857

0 commit comments

Comments
 (0)