from llama_index import ServiceContext, set_global_service_context service_context = ServiceContext.from_defaults(llm=llm) set_global_service_context(service_context)