llama_index.GPTSimpleVectorIndexは廃止になりGPTVectorStoreIndexに変更された。
名前だけでなく関数の仕様も変わっているので、以下移行方法をメモ。
GPTSimpleVectorIndex→GPTVectorStoreIndex
旧:
from llama_index import SimpleDirectoryReader, ServiceContext, GPTSimpleVectorIndex, LLMPredictor新:
from llama_index import SimpleDirectoryReader, ServiceContext, GPTVectorStoreIndex, LLMPredictorsave_to_disk→storage_context.persist
旧:
index.save_to_disk('index.json')新:
mkdir index_json_dir
index.storage_context.persist(persist_dir="index_json_dir")query→as_query_engine.query
旧:
response = index.query('明日の天気を教えてください。')新:
query_engine = index.as_query_engine(service_context=service_context)
response = query_engine.query('明日の天気を教えてください。')
