Find answers from the community

v
vcb
Offline, last seen 3 months ago
Joined September 25, 2024
v
vcb
·

Llama2

hi all I'm wondering if it might be straightforward to do a q&a implementation of llama2 instead of gpt-x usiing llamaindex?
2 comments
v
L
hi all, just a short, hopefully not completely stupid, question. I have the following short application (roughly):

Plain Text
d = 1536 # chatGPT embedding
faiss_index = faiss.IndexFlatL2(d)
vector_store = FaissVectorStore(faiss_index)
storage_context = StorageContext.from_defaults(vector_store=vector_store)

llm_predictor2 = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-4"))
service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor2)

# initialize an index using our sample data and the client we just created
index = VectorStoreIndex.from_documents(storage_context=storage_context,
documents=documents, service_context=service_context)

query_engine = index.as_query_engine()


From what I understand with using chatgpt-4 the maximum context size is 8192, so i want to make sure i only retrieve k-amount of vectors of size 1536 so that k*1536<8192 (roughly). So my question is, do I have to set k manually somewhere or is there a fundamental misunderstanding?
4 comments
L
v
hi all, I'm trying to figure out how to reload an index from persistent storage but I'm getting errors:
Plain Text
#create an index
d = 1536
faiss_index = faiss.IndexFlatL2(d)
vector_store = FaissVectorStore(faiss_index)
storage_context = StorageContext.from_defaults(vector_store=vector_store)

index = VectorStoreIndex.from_documents(storage_context=storage_context,documents=documents)
#index works

#to store:
index.storage_context.persist()

#reload
vector_store = FaissVectorStore.from_persist_dir('./storage')
storage_context = StorageContext.from_defaults(vector_store=vector_store)
#this index doesnt work
index = load_index_from_storage(storage_context=storage_context)
#ValueError: No index in storage context, check if you specified the right persist_dir.
7 comments
L
v