Find answers from the community

Updated 2 years ago

Working earlier

At a glance
I was getting this issue when it was working fine earlier? this is my code
Plain Text
import os
import streamlit as st
from llama_index import GPTSimpleVectorIndex, download_loader
from pathlib import Path

# Set API key
os.environ["OPENAI_API_KEY"] = ''

# Load the documents
CJKPDFReader = download_loader("CJKPDFReader")

loader = CJKPDFReader()
documents = loader.load_data(file=Path('./article.pdf'))
# Create the index
index = GPTSimpleVectorIndex.from_documents(documents)

# Streamlit app
st.title("Question-Answering Bot")
st.write("Ask a question about Justin Bieber:")

# Get user input
user_question = st.text_input("Your question:")

if user_question:
  response = index.query(user_question)
  st.write("Answer:", response)
else:
  st.write("Please enter a question.")
L
D
3 comments
Quite a few things changed in llama index recently, I recommend refreshing yourself with the docs
https://gpt-index.readthedocs.io/en/latest/guides/primer/usage_pattern.html

You can always specify the version when you install llama index (highly recommended for python libraries)
pip install llama-index==0.5.27

Then you can upgrade at your own pace when you are ready
Try to use "GPTVectorIndex" instad of "GPTSimple"
"GPTVectorStoreIndex" actually πŸ‘
Add a reply
Sign up and join the conversation on Discord