File size: 527 Bytes
6ea7f47 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from langchain_community.embeddings.sentence_transformer import (
SentenceTransformerEmbeddings,
)
from langchain_community.vectorstores import Chroma
# create the open-source embedding function
embedding_function = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
# load Chroma
db = Chroma(embedding_function=embedding_function, persist_directory="./chroma_db")
print("There are", db._collection.count(), " docs in the collection")
docs = db._collection.peek(10)
for doc in docs['documents']:
print(doc) |