from llama_index.core import Settings Settings.llm = OpenAI(model="gpt-4", ...)
index.as_query_engine(llm=OpenAI(...))