from llama_index import ServiceContext, set_global_service_context llm = <llm> embed_model = <embed_model> set_global_service_context(ServiceContext.from_defaults(llm=llm, embed_model=embed_model))