Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	| from sentence_transformers import SentenceTransformer | |
| import faiss | |
| import numpy as np | |
| import pickle | |
| def build_vector_store(docs, save_path="vector_store.pkl"): | |
| model = SentenceTransformer("all-MiniLM-L6-v2") | |
| embeddings = model.encode(docs) | |
| # FAISS index 생성 | |
| index = faiss.IndexFlatL2(embeddings.shape[1]) | |
| index.add(np.array(embeddings)) | |
| # 튜플로 저장 | |
| with open(save_path, "wb") as f: | |
| pickle.dump((index, docs, model), f) | |
| print(f"✅ 벡터 저장소가 {save_path}에 저장되었습니다.") | |
