Lesson Complete!

Index Any File Type

What you learned

  • How to walk a directory recursively with os.walk and filter files by extension
  • How to read plain-text files safely and split them into overlapping chunks with source metadata
  • How to separate file I/O from AI logic by extracting files.py
  • How to update main() to accept a folder path and pass structured chunks to the embedding pipeline

Next up

In the next lesson, you will add an interactive loop so you can ask multiple questions without restarting the program — and the assistant will display which files it has indexed.