Skip to content

Commit

Permalink
[#16] Sync back up
Browse files Browse the repository at this point in the history
  • Loading branch information
uogbuji committed Jul 17, 2023
1 parent f301b1d commit 643d701
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pylib/embedding_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 643d701

Please sign in to comment.