llama_index icon indicating copy to clipboard operation
llama_index copied to clipboard

Add Reader for String Iterable

Open teoh opened this issue 2 years ago • 0 comments

This PR adds a reader for a string iterable. This is useful if you're working on an application in which you can easily produce, say, a list of strings you'd like to index. Usage:

from gpt_index import StringIterableReader, GPTTreeIndex

documents = StringIterableReader(["I went to the store", "I bought an apple"]).load_data()
index = GPTTreeIndex(documents)
index.query("what did I buy?")

# response should be something like "You bought an apple."

teoh avatar Jan 04 '23 06:01 teoh