---
title: "Comment by law on \"Mastering LlamaIndex : Create, Save & Load Indexes, Customize LLMs, Prompts & Embeddings\" | Hashnode"
description: "Hi That is nicely written guides. I have a question: For below codes; from llama_index import VectorStoreIndex, SimpleDirectoryReader #Load documents from a dir"
url: "https://hashnode.com/posts/mastering-llamaindex-create-save-load-indexes-customize-llms-prompts-embeddings/64a560e87d111a4ae1f7f572/comment/64ca4fae218e67b3098f524f"
---

[Discussion](https://hashnode.com/posts/mastering-llamaindex-create-save-load-indexes-customize-llms-prompts-embeddings/64a560e87d111a4ae1f7f572)

Comment [Mastering LlamaIndex : Create, Save & Load Indexes, Customize LLMs, Prompts & Embeddings](https://hashnode.com/posts/mastering-llamaindex-create-save-load-indexes-customize-llms-prompts-embeddings/64a560e87d111a4ae1f7f572)

[law](https://hashnode.com/@law907)

[Aug 2, 2023](https://hashnode.com/posts/mastering-llamaindex-create-save-load-indexes-customize-llms-prompts-embeddings/64a560e87d111a4ae1f7f572/comment/64ca4fae218e67b3098f524f)

Hi That is nicely written guides. I have a question: For below codes;

from llama\_index import VectorStoreIndex, SimpleDirectoryReader

#Load documents from a directory documents = SimpleDirectoryReader('book').load\_data()

#Create an index from the documents index=VectorStoreIndex.from\_documents(documents)

i have an exception thrown at this line:VectorStoreIndex.from\_documents(..)

No API key found for OpenAI. Please set either the OPENAI\_API\_KEY environment variable or openai.api\_key prior to initialization. API keys can be found or created at .....

I am just testing the indexing, and i am not using openai. Why was there an openai exception when the app is executing this line: VectorStoreIndex.from\_documents(documents)?
