fix: Fix issues in unified examples

- Add smart path detection for data directory
- Fix add_texts -> add_text method call
- Handle both running from project root and examples directory
This commit is contained in:
Andy Lee
2025-07-29 15:55:46 -07:00
parent 7fbb6c98ef
commit 9d77175ac8
2 changed files with 10 additions and 3 deletions

View File

@@ -164,7 +164,8 @@ class BaseRAGExample(ABC):
batch_size = 1000
for i in range(0, len(texts), batch_size):
batch = texts[i : i + batch_size]
builder.add_texts(batch)
for text in batch:
builder.add_text(text)
print(f"Added {min(i + batch_size, len(texts))}/{len(texts)} texts...")
print("Building index structure...")