diff --git a/pylib/embedding_helper.py b/pylib/embedding_helper.py index ab68f14..ea79aa6 100644 --- a/pylib/embedding_helper.py +++ b/pylib/embedding_helper.py @@ -60,11 +60,14 @@ def __init__(self, name, embedding_model, db=None, **conn_params): https://github.com/qdrant/qdrant-client/blob/master/qdrant_client/qdrant_client.py#L12 Example: + >>> from ogbujipt.text_helper import text_splitter - >>> from ogbujipt.embedding_helper import qdrant_collection + >>> from ogbujipt.embedding_helper import qdrant_collection # pip install qdrant_client + >>> from sentence_transformers import SentenceTransformer # pip install sentence_transformers >>> text = 'The quick brown fox\njumps over the lazy dog,\nthen hides under a log\nwith a frog.' - >>> collection = qdrant_collection('my-text', 'all-MiniLM-L6-v2') - >>> chunks = text_splitter(text, chunk_size=30, chunk_overlap=5, separator='\n') + >>> embedding_model = SentenceTransformer('all-MiniLM-L6-v2') + >>> collection = qdrant_collection('my-text', embedding_model) + >>> chunks = text_splitter(text, chunk_size=20, chunk_overlap=4, separator='\n') >>> collection.add(texts=chunks, metas=[{'seq-index': i} for (i, _) in enumerate(chunks)]) >>> retval = collection.search('what does the fox say?', limit=1) retval