Steps to Install and Use LlamaIndex

  1. Get LlamaIndex on Your Computer
    • Ask a grown-up to open their computer’s “command box” (it’s like a magic typing spot).
    • Type this and press Enter: pip install llama-index
    • Wait a little bit—it’s like downloading a new toy for your robot friend!
  2. Tell It Where Your Stuff Is
    • Put a story, picture, or file (like a PDF) in a folder on the computer.
    • Write this in a file called play.py (a grown-up can help): pythonfrom llama_index.core import SimpleDirectoryReader documents = SimpleDirectoryReader("your/folder/here").load_data()
    • This is like saying, “Hey, look at my cool stuff in this folder!”
  3. Make a Magic List
    • Add this to your play.py file: pythonfrom llama_index.core import VectorStoreIndex index = VectorStoreIndex.from_documents(documents)
    • This makes a special list (like a treasure map) so your robot friend can find things fast.
  4. Ask Your Question
    • Add this to the same file: pythonquery_engine = index.as_query_engine() answer = query_engine.query("What’s my story about?") print(answer)
    • This is you asking your robot friend a question, and he’ll tell you the answer!
  5. Run It and See the Magic
    • Ask a grown-up to type this in the command box: python play.py
    • Press Enter, and your robot friend will tell you what he learned!

Extra Fun (Optional)

That’s it! Now your robot friend knows all about your stuff and can answer your questions like a super smart buddy!

Chat Icon