Find answers from the community

Updated 3 months ago

Hey guys,

Hey guys,
  1. can we save query engines state so that we don't have to re-initialize it with the rerankers or the indexes?
Assume the index is in a vector store and not in memory.
Mendable tells this MLesque answer
import pickle

Assuming 'query_engine' is your initialized query engine

with open('query_engine.pkl', 'wb') as f:
pickle.dump(query_engine, f)

To load the query engine later

with open('query_engine.pkl', 'rb') as f:
loaded_query_engine = pickle.load(f)
which i am not sure correct...
L
1 comment
There is no "state" really. You can't really pickle a local model either (if you are using an API based model, then it might be more possible, but if its api based, then initializing it is basically a no-op
Add a reply
Sign up and join the conversation on Discord