Find answers from the community

Updated 5 months ago

Hello, nontechnical tinkerer here.

At a glance
Hello, nontechnical tinkerer here. Trying to build off of the Starter Tutorial (https://gpt-index.readthedocs.io/en/latest/getting_started/starter_example.html), where it asks you to create a folder called data, and add a Paul Graham essay as a .txt document in it. As a total newbie, it was cool to get everything working through the CL when I tried the tutorial. But now I want to add new documents to the Index that started with that Paul Graham essay; how can I do this? What is the Python script I could run that would take new .txt documents in the data folder with the Paul Graham essay already in it, and add it to the Index. So I can add my own documents instead of only being able to ask about PG. I think a lot of punters will start like me, so it'd be nice to have a manageable way to add new content to that index so I can ask question about my own documents/data and not just about Paul Graham.
L
M
5 comments
you can place your own text files in a folder and create an index the same way you did for paul graham πŸ‘
Hey thanks Logan! That is the easiest way. I did get it to work that way. And I appreciate the response. But can't I run some code in a .py file that will take an arbitrary .txt file in the same directory, './data' and add it to the existing Index? This would allow me to add to my Index easily, without too much fuss, and in this way build organically off the Starter Tutorial.
I have started watching your "Discover LlamaIndex" videos BTW, they're a bit advanced for me (as they shoujld be). But I will get there!
Awesome to hear!

Yea you can insert into an existing index

Plain Text
documents = ...

for document in documents:
  index.insert(document)
Add a reply
Sign up and join the conversation on Discord