Definitely, ezpz
from langchain.chat_models import ChatOpenAI
from llama_index import ServiceContext, LLMPredictor, GPTVectorStoreIndex
llm = ChatOpenAI(model_name='gpt-3.5-turbo', temperature=0, streaming=True)
service_context = ServiceContext.from_defaults(llm_predictor=LLMPredictor(llm=llm))
index = GPTVectorStoreIndex.from_documents(documents, service_context=service_context)
query_engine = index.as_query_engine(streaming=True)
response = query_engine.query('...')
# print the stream to terminal
response.print_response_stream()
# OR get the actual token generator object
for token in response.response_gen:
# do a thing with the token?