@@ -285,6 +285,11 @@ async def run(
285285 sample_dir : Optional [Path ],
286286 qdrant_url : Optional [str ],
287287 qdrant_api_key : Optional [str ],
288+ qdrant_host : Optional [str ] = None ,
289+ qdrant_port : int = 6333 ,
290+ qdrant_grpc_port : int = 6334 ,
291+ qdrant_https : bool = False ,
292+ qdrant_prefer_grpc : bool = False ,
288293) -> None :
289294 """Core execution logic for the CLI."""
290295
@@ -323,7 +328,17 @@ async def run(
323328 dense_vectors = list (dense_model .embed (texts ))
324329 sparse_vectors = list (sparse_model .passage_embed (texts ))
325330
326- client = AsyncQdrantClient (qdrant_url or ":memory:" , api_key = qdrant_api_key )
331+ if qdrant_url is None and qdrant_host is None :
332+ qdrant_url = ":memory:"
333+ client = AsyncQdrantClient (
334+ location = qdrant_url ,
335+ api_key = qdrant_api_key ,
336+ host = qdrant_host ,
337+ port = qdrant_port ,
338+ grpc_port = qdrant_grpc_port ,
339+ https = qdrant_https ,
340+ prefer_grpc = qdrant_prefer_grpc ,
341+ )
327342 collection_name = "media-items"
328343 vectors_config = {
329344 "dense" : models .VectorParams (
@@ -456,6 +471,47 @@ async def run(
456471 required = False ,
457472 help = "Qdrant API key" ,
458473)
474+ @click .option (
475+ "--qdrant-host" ,
476+ envvar = "QDRANT_HOST" ,
477+ show_envvar = True ,
478+ required = False ,
479+ help = "Qdrant host" ,
480+ )
481+ @click .option (
482+ "--qdrant-port" ,
483+ envvar = "QDRANT_PORT" ,
484+ show_envvar = True ,
485+ type = int ,
486+ default = 6333 ,
487+ show_default = True ,
488+ required = False ,
489+ help = "Qdrant HTTP port" ,
490+ )
491+ @click .option (
492+ "--qdrant-grpc-port" ,
493+ envvar = "QDRANT_GRPC_PORT" ,
494+ show_envvar = True ,
495+ type = int ,
496+ default = 6334 ,
497+ show_default = True ,
498+ required = False ,
499+ help = "Qdrant gRPC port" ,
500+ )
501+ @click .option (
502+ "--qdrant-https/--no-qdrant-https" ,
503+ envvar = "QDRANT_HTTPS" ,
504+ show_envvar = True ,
505+ default = False ,
506+ help = "Use HTTPS when connecting to Qdrant" ,
507+ )
508+ @click .option (
509+ "--qdrant-prefer-grpc/--no-qdrant-prefer-grpc" ,
510+ envvar = "QDRANT_PREFER_GRPC" ,
511+ show_envvar = True ,
512+ default = False ,
513+ help = "Prefer gRPC when connecting to Qdrant" ,
514+ )
459515@click .option (
460516 "--continuous" ,
461517 is_flag = True ,
@@ -479,6 +535,11 @@ def main(
479535 sample_dir : Optional [Path ],
480536 qdrant_url : Optional [str ],
481537 qdrant_api_key : Optional [str ],
538+ qdrant_host : Optional [str ],
539+ qdrant_port : int ,
540+ qdrant_grpc_port : int ,
541+ qdrant_https : bool ,
542+ qdrant_prefer_grpc : bool ,
482543 continuous : bool ,
483544 delay : float ,
484545) -> None :
@@ -492,6 +553,11 @@ def main(
492553 sample_dir ,
493554 qdrant_url ,
494555 qdrant_api_key ,
556+ qdrant_host ,
557+ qdrant_port ,
558+ qdrant_grpc_port ,
559+ qdrant_https ,
560+ qdrant_prefer_grpc ,
495561 continuous ,
496562 delay ,
497563 )
@@ -505,6 +571,11 @@ async def load_media(
505571 sample_dir : Optional [Path ],
506572 qdrant_url : Optional [str ],
507573 qdrant_api_key : Optional [str ],
574+ qdrant_host : Optional [str ],
575+ qdrant_port : int ,
576+ qdrant_grpc_port : int ,
577+ qdrant_https : bool ,
578+ qdrant_prefer_grpc : bool ,
508579 continuous : bool ,
509580 delay : float ,
510581) -> None :
@@ -518,6 +589,11 @@ async def load_media(
518589 sample_dir ,
519590 qdrant_url ,
520591 qdrant_api_key ,
592+ qdrant_host ,
593+ qdrant_port ,
594+ qdrant_grpc_port ,
595+ qdrant_https ,
596+ qdrant_prefer_grpc ,
521597 )
522598 if not continuous :
523599 break
0 commit comments