init
__all__ = ['GithubSearchUOW', 'MessageSearchUnitOfWork', 'QdrantAdapter', 'default_qdrant_client', 'get_qdrant_client']
module-attribute
default_qdrant_client = get_qdrant_client(settings.QDRANT_HOST)
module-attribute
GithubSearchUOW
collection_name = COLLECTION_NAME
class-attribute
qdrant = qdrant
instance-attribute
read_only_uow
property
__init__(qdrant, read_only_uow=None)
MessageSearchUnitOfWork
collection_name = COLLECTION_NAME
class-attribute
qdrant = qdrant
instance-attribute
read_only_uow
property
__init__(qdrant, read_only_uow)
QdrantAdapter
My implementation of a qdrant client tied to a specific collection.
Everything here should be general to any collection in qdrant.
collection_name
property
writable
dense_code_embedder = dense_code_embedder
instance-attribute
dense_embedder = dense_embedder
instance-attribute
qdrant_client = qdrant_client
instance-attribute
sparse_embedder
property
__init__(qdrant_client, dense_embedder=default_dense_embedder, dense_code_embedder=default_dense_embedder, sparse_embedder=default_sparse_embedder, collection_name=None)
add_index(metadata_key, params)
async
Add an index to the collection metadata.
| PARAMETER | DESCRIPTION |
|---|---|
metadata_key
|
The key to add the index to
TYPE:
|
params
|
The parameters for the index
TYPE:
|
add_items(upsertables, wait=True)
async
Adds qdrant points to the collection.
Points contain the QdrantPayload information (id, content, metadata). Note: The content is either what was embedded, or where to find it.
| PARAMETER | DESCRIPTION |
|---|---|
upsertables
|
List of Upsertables to add to the collection
TYPE:
|
wait
|
Whether to wait for the operation to complete (defaults to True).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
UpdateResult
|
The qdrant result of the operation |
batch_update(update_operations, wait=False)
async
delete_index(metadata_key)
async
Delete an index from the collection metadata.
delete_items(points_selector, wait=True)
async
get_collection_info()
async
get_count(count_filter)
async
get_index_infos()
async
scroll(scroll_filter=None, limit=100, latest_point_id=None)
async
Scroll through points in collection.
Note: Use scroll_all to iterate all records.
| PARAMETER | DESCRIPTION |
|---|---|
scroll_filter
|
Additional filter to apply to the scroll
TYPE:
|
limit
|
How many results to return in one go
TYPE:
|
latest_point_id
|
The previous latest point id to start from
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[list[QdrantPayload], PointId | None]
|
Tuple of records and the last point id (last point will be None if no more records) |
scroll_all(scroll_filter=None, num_per_iteration=100, limit=None)
async
Scroll through all points in collection.
| PARAMETER | DESCRIPTION |
|---|---|
scroll_filter
|
Additional filter to apply to the scroll
TYPE:
|
num_per_iteration
|
How many results to return per iteration
TYPE:
|
limit
|
Maximum number of records to return
TYPE:
|
| YIELDS | DESCRIPTION |
|---|---|
AsyncIterator[list[QdrantPayload]]
|
List of records |
search(query_text, query_vector_name=None, k=5, query_filter=None, score_threshold=None, use_sparse=False, offset=0, group_by=None, group_by_count=None)
async
Search collection for items related to query_text.
| PARAMETER | DESCRIPTION |
|---|---|
query_text
|
Text that will be embedded to produce a query vector
TYPE:
|
query_vector_name
|
Name of the vector to use for the query
TYPE:
|
k
|
Number of results to return
TYPE:
|
query_filter
|
Additional qdrant filter to apply to the search
TYPE:
|
score_threshold
|
Minimum score to return
TYPE:
|
use_sparse
|
Whether to use the sparse or dense embeddings
TYPE:
|
offset
|
Offset for pagination
TYPE:
|
group_by
|
Metadata field to group by
TYPE:
|
group_by_count
|
Number of results to return per group
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[QdrantSearchResult]
|
List of search results |