使用模式#
快速开始#
每个数据加载器都包含一个"使用说明"部分,展示该加载器的使用方法。使用每个加载器的核心是download_loader
函数,它会将加载器文件下载成一个可在应用程序中使用的模块。
示例用法:
from llama_index.core import VectorStoreIndex, download_loader
from llama_index.readers.google import GoogleDocsReader
gdoc_ids = ["1wf-y2pd9C878Oh-FmLH7Q_BQkljdm6TQal-c1pUfrec"]
loader = GoogleDocsReader()
documents = loader.load_data(document_ids=gdoc_ids)
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
query_engine.query("Where did the author go to school?")