code
os.environ["OPENAI_API_KEY"] = "sk-"
import nest_asyncio
nest_asyncio.apply()
from llama_index import SimpleDirectoryReader
documents = SimpleDirectoryReader(input_dir='rag_data_dir').load_data()
from services.dense_pack.base import DenseXRetrievalPack
from llama_index.llms import OpenAI
from llama_index.text_splitter import SentenceSplitter
dense_pack = DenseXRetrievalPack(
documents,
proposition_llm=OpenAI(model="gpt-3.5-turbo", max_tokens=750),
query_llm=OpenAI(model="gpt-3.5-turbo", max_tokens=256),
text_splitter=SentenceSplitter(chunk_size=1024),
)
dense_query_engine = dense_pack.query_engine
I got
AttributeError: 'OpenAI' object has no attribute 'apredict'
when running on python 3.10.x
But when successfully on python 3.11.x