Seems like maybe we need to re-test our langchain stuff, since its not a core dependency, its not garunteed to work π
Uninstall langchain, and do this instead
import os
import openai
#from dotenv import load_dotenv
from llama_index import VectorStoreIndex, SimpleDirectoryReader
from llama_index.llms import OpenAI
from llama_index import ServiceContext, StorageContext, load_index_from_storage
import os
os.environ['OPENAI_API_KEY'] = 'sk-...'
service_context = ServiceContext.from_defaults(
llm=OpenAI(model='gpt-3.5-turbo', temperature=0.2)
)
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents, service_context=service_context, show_progress=True)
query_engine = index.as_query_engine(similarity_top_k=2)
question = "What did the author do growing up?"
response = query_engine.query(question)
print(response.response)