カテゴリー【Python】
【LlamaIndex】GPTSimpleVectorIndexからGPTVectorStoreIndexへの移行方法
POSTED BY
2023-07-12
2023-07-12
llama_index.GPTSimpleVectorIndexは廃止になりGPTVectorStoreIndexに変更された。
名前だけでなく関数の仕様も変わっているので、以下移行方法をメモ。
GPTSimpleVectorIndex→GPTVectorStoreIndex
旧:
from llama_index import SimpleDirectoryReader, ServiceContext, GPTSimpleVectorIndex, LLMPredictor
新:
from llama_index import SimpleDirectoryReader, ServiceContext, GPTVectorStoreIndex, LLMPredictor
save_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('明日の天気を教えてください。')
Android
iPhone/iPad
Flutter
MacOS
Windows
Debian
Ubuntu
CentOS
FreeBSD
RaspberryPI
HTML/CSS
C/C++
PHP
Java
JavaScript
Node.js
Swift
Python
MatLab
Amazon/AWS
CORESERVER
Google
仮想通貨
LINE
OpenAI/ChatGPT
IBM Watson
Microsoft Azure
Xcode
VMware
MySQL
PostgreSQL
Redis
Groonga
Git/GitHub
Apache
nginx
Postfix
SendGrid
Hackintosh
Hardware
Fate/Grand Order
ウマ娘
将棋
ドラレコ
※本記事は当サイト管理人の個人的な備忘録です。本記事の参照又は付随ソースコード利用後にいかなる損害が発生しても当サイト及び管理人は一切責任を負いません。
※本記事内容の無断転載を禁じます。
※本記事内容の無断転載を禁じます。
【WEBMASTER/管理人】
自営業プログラマーです。お仕事ください!ご連絡は以下アドレスまでお願いします★
【キーワード検索】
【最近の記事】【全部の記事】
CORESERVER v1プランからさくらインターネットスタンダートプランへ引っ越しメモさくらインターネットでPython MecabをCGIから使う
さくらインターネットのPHPでAnalytics-G4 APIを使う
インクルードパスの調べ方
【Git】特定ファイルを除外する.gitignore
【Ubuntu/Debian】NVIDIA関係のドライバを自動アップデートさせない
【Python】Spacyを使用して文章から出発地と目的地を抜き出す
HomeBrewでApache2を入れて自動起動つきで動かしPHPモジュールと連携する
macOSに標準付属のApacheを自動起動つきで動かす
HomeBrewでPostgreSQLを入れて自動起動つきで動かす
【人気の記事】【全部の記事】
【Windows10】リモートデスクトップ間のコピー&ペーストができなくなった場合の対処法進研ゼミチャレンジタッチをAndroid端末化する
Windows版Google Driveが使用中と言われアンインストールできない場合
Windows11+WSL2でUbuntuを使う【2】ブリッジ接続+固定IPの設定
【C/C++】小数点以下の切り捨て・切り上げ・四捨五入
【PHP】Mail/mimeDecodeを使ってメールの中身を解析(準備編)
【Apache】サーバーに同時接続可能なクライアント数を調整する
【Hackintosh】Z370 MORTARにmacOS Sonomaをインストール
cannot guess build type; you must specify oneと言われた場合
【MinGW】Windowsでgcc/g++コンパイラを使って開発する
【カテゴリーリンク】
Android
iPhone/iPad
Flutter
MacOS
Windows
Debian
Ubuntu
CentOS
FreeBSD
RaspberryPI
HTML/CSS
C/C++
PHP
Java
JavaScript
Node.js
Swift
Python
MatLab
Amazon/AWS
CORESERVER
Google
仮想通貨
LINE
OpenAI/ChatGPT
IBM Watson
Microsoft Azure
Xcode
VMware
MySQL
PostgreSQL
Redis
Groonga
Git/GitHub
Apache
nginx
Postfix
SendGrid
Hackintosh
Hardware
Fate/Grand Order
ウマ娘
将棋
ドラレコ