@@ -25,7 +25,7 @@ class Milvus(VectorStore):
2525 default = 384 , description = "default embedding model dimension"
2626 )
2727
28- # Initializes the Milvus object with collection names, a URI for the Milvus database,
28+ # Initializes the Milvus object with collection names, a URI for the Milvus database,
2929 # a logger, and the embedding function.
3030 def __init__ (
3131 self ,
@@ -86,10 +86,7 @@ def add_question_answer(
8686 collection_name = self .qa_collection_name ,
8787 data = data ,
8888 )
89-
9089 return milvus_ids
91-
92-
9390
9491 # Adds documents to the Milvus collection.
9592 # It accepts documents, optional IDs, and metadata, and stores them in the document collection.
@@ -124,7 +121,7 @@ def add_docs(
124121 collection_name = self .docs_collection_name ,
125122 data = data ,
126123 )
127-
124+
128125 return milvus_ids
129126
130127 # Retrieves the most relevant question-answer pairs from the QA collection
@@ -146,7 +143,6 @@ def get_relevant_question_answers(self, question: str, k: int = 1) -> List[Dict]
146143 filter = "" ,
147144 output_fields = [DOCUMENT ],
148145 )
149-
150146 return self ._convert_search_response (response )
151147
152148 # Retrieves the most relevant documents from the document collection
@@ -166,7 +162,6 @@ def get_relevant_docs(self, question: str, k: int = 1) -> List[Dict]:
166162 limit = k ,
167163 output_fields = [DOCUMENT ],
168164 )
169-
170165 return self ._convert_search_response (response )
171166
172167 # Converts the search response returned by Milvus into a list of dictionaries
@@ -271,7 +266,6 @@ def get_relevant_question_answers_by_id(self, ids: Iterable[str]) -> List[Dict]:
271266 ids = milvus_ids ,
272267 output_fields = [DOCUMENT , ID , "distance" , "entity" ],
273268 )
274-
275269 return self ._convert_search_response (response )["documents" ]
276270
277271 # Deletes documents from the document collection based on a list of document IDs.
@@ -388,4 +382,4 @@ def _is_valid_uuid(self, id: str):
388382
389383 # Generates a list of random UUIDs.
390384 def generate_random_uuids (self , n ):
391- return [str (uuid .uuid4 ()) for _ in range (n )]
385+ return [str (uuid .uuid4 ()) for _ in range (n )]
0 commit comments