mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 11:39:18 +00:00
Templates (#12294)
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> Co-authored-by: Lance Martin <lance@langchain.dev> Co-authored-by: Jacob Lee <jacoblee93@gmail.com>
This commit is contained in:
13
templates/csv-agent/ingest.py
Normal file
13
templates/csv-agent/ingest.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from langchain.document_loaders import CSVLoader
|
||||
from langchain.tools.retriever import create_retriever_tool
|
||||
from langchain.indexes import VectorstoreIndexCreator
|
||||
from langchain.vectorstores import FAISS
|
||||
|
||||
loader = CSVLoader('/Users/harrisonchase/Downloads/titanic.csv')
|
||||
|
||||
docs = loader.load()
|
||||
index_creator = VectorstoreIndexCreator(vectorstore_cls=FAISS)
|
||||
|
||||
index = index_creator.from_documents(docs)
|
||||
|
||||
index.vectorstore.save_local("titanic_data")
|
Reference in New Issue
Block a user