llama_index icon indicating copy to clipboard operation
llama_index copied to clipboard

can't use GPTSimpleVectorIndex with Microsoft Azure OpenAI

Open alexeenka opened this issue 2 years ago • 3 comments

I can't use GPTSimpleVectorIndex with Microsoft Azure OpenAI

I have the following settings:

openai.api_type = "azure"
openai.api_base = "https://xyz.openai.azure.com/"
openai.api_version = "2022-12-01"
openai.api_key = os.getenv("OPENAI_API_KEY")

from gpt_index import GPTSimpleVectorIndex, SimpleDirectoryReader, LLMPredictor

documents = SimpleDirectoryReader('docs/test-data', recursive=True, required_exts=[".md"]).load_data()
llm_predictor = LLMPredictor(llm=AzureOpenAI(deployment_name="xyz-Curie", openai_api_key=openai.api_key))
index = GPTSimpleVectorIndex(documents=documents, llm_predictor=llm_predictor)

Error:

openai.error.InvalidRequestError: The API deployment for the resource does not exist.

alexeenka avatar Jan 29 '23 13:01 alexeenka

i haven't really tested the AzureOpenAI stuff, i think we only have embedding support atm and not the full llm? https://github.com/jerryjliu/gpt_index/pull/254/files

jerryjliu avatar Feb 01 '23 01:02 jerryjliu

Any update on this? What is being supported now?

hophanms avatar Feb 02 '23 18:02 hophanms

It works if you specify both embedding and completion model:

embed_model = OpenAIEmbedding(deployment_name="text-search-ada-doc-001")
llm_predictor = LLMPredictor(llm=AzureOpenAI(deployment_name="davinci-003", openai_api_key=openai.api_key))
index = GPTSimpleVectorIndex(documents, embed_model=embed_model, llm_predictor=llm_predictor)

schthms avatar Feb 06 '23 14:02 schthms

should be resolved with the nb provided in #402

jerryjliu avatar Feb 20 '23 03:02 jerryjliu