You can pass the arguments inside query_engine!
No external imports are needed if you are simply using the default openAI setup.
I see you are using service_context, i would suggest creating a new env and do
pip install llama-index
and for every intergration like if you are using Huggingface, there is a separate pypi package that needs to be installed.
here's the package guide:
https://pretty-sodium-5e0.notion.site/ce81b247649a44e4b6b35dfb24af28a6?v=53b3c2ced7bb4c9996b81b83c9f01139