@@ -66,29 +66,26 @@ def _main():
6666
6767 # Run queries in a loop to demonstrate the query capabilities.
6868 while True :
69- try :
70- query = input ("Enter search query (or Enter to quit): " )
71- if query == "" :
72- break
73-
74- # Get the embedding for the query
75- query_embedding = text_to_embedding .eval (query )
76-
77- search_results = client .search (
78- collection_name = QDRANT_COLLECTION ,
79- query_vector = ("text_embedding" , query_embedding ),
80- limit = 10
81- )
82- print ("\n Search results:" )
83- for result in search_results :
84- score = result .score
85- payload = result .payload
86- print (f"[{ score :.3f} ] { payload ['filename' ]} " )
87- print (f" { payload ['text' ]} " )
88- print ("---" )
89- print ()
90- except KeyboardInterrupt :
69+ query = input ("Enter search query (or Enter to quit): " )
70+ if query == "" :
9171 break
72+
73+ # Get the embedding for the query
74+ query_embedding = text_to_embedding .eval (query )
75+
76+ search_results = client .search (
77+ collection_name = QDRANT_COLLECTION ,
78+ query_vector = ("text_embedding" , query_embedding ),
79+ limit = 10
80+ )
81+ print ("\n Search results:" )
82+ for result in search_results :
83+ score = result .score
84+ payload = result .payload
85+ print (f"[{ score :.3f} ] { payload ['filename' ]} " )
86+ print (f" { payload ['text' ]} " )
87+ print ("---" )
88+ print ()
9289
9390
9491if __name__ == "__main__" :
0 commit comments