langroid 0.56.9__py3-none-any.whl → 0.56.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -314,6 +314,10 @@ class DocChatAgent(ChatAgent):
314
314
  # Note we may have used a vecdb with a config.collection_name
315
315
  # different from the agent's config.vecdb.collection_name!!
316
316
  self.vecdb.delete_collection(collection_name)
317
+ # Close the old vecdb before creating a new one
318
+ old_vecdb = self.vecdb
319
+ if old_vecdb and hasattr(old_vecdb, "close"):
320
+ old_vecdb.close()
317
321
  self.vecdb = VectorStore.create(self.vecdb.config)
318
322
  except Exception as e:
319
323
  logger.warning(
@@ -4,7 +4,7 @@ import logging
4
4
  import os
5
5
  import time
6
6
  import uuid
7
- from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Tuple, TypeVar
7
+ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Tuple, TypeVar
8
8
 
9
9
  from dotenv import load_dotenv
10
10
 
@@ -143,6 +143,24 @@ class QdrantDB(VectorStore):
143
143
  config.collection_name, replace=config.replace_collection
144
144
  )
145
145
 
146
+ def close(self) -> None:
147
+ """
148
+ Close the QdrantDB client and release any resources (e.g., file locks).
149
+ This is especially important for local storage to release the .lock file.
150
+ """
151
+ if hasattr(self.client, "close"):
152
+ # QdrantLocal has a close method that releases the lock
153
+ self.client.close()
154
+ logger.info(f"Closed QdrantDB connection for {self.config.storage_path}")
155
+
156
+ def __enter__(self) -> "QdrantDB":
157
+ """Context manager entry."""
158
+ return self
159
+
160
+ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
161
+ """Context manager exit - ensure cleanup even if an exception occurred."""
162
+ self.close()
163
+
146
164
  def clear_empty_collections(self) -> int:
147
165
  coll_names = self.list_collections()
148
166
  n_deletes = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langroid
3
- Version: 0.56.9
3
+ Version: 0.56.10
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  Author-email: Prasad Chalasani <pchalasani@gmail.com>
6
6
  License: MIT
@@ -15,7 +15,7 @@ langroid/agent/xml_tool_message.py,sha256=oeBKnJNoGaKdtz39XoWGMTNlVyXew2MWH5lgtY
15
15
  langroid/agent/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  langroid/agent/callbacks/chainlit.py,sha256=4rJw07NIIVTIVvksVY08h5PdLE_kRoJItjbQM0UjRn0,20962
17
17
  langroid/agent/special/__init__.py,sha256=gik_Xtm_zV7U9s30Mn8UX3Gyuy4jTjQe9zjiE3HWmEo,1273
18
- langroid/agent/special/doc_chat_agent.py,sha256=s3cQTUzbfuLiDOG8x5aRyZd1Ql-b1alHWOiQ4b5wgF8,68628
18
+ langroid/agent/special/doc_chat_agent.py,sha256=PysF6K_rj_xe1yHVZyaldQkGacdHv905zmNBqOdrzYU,68815
19
19
  langroid/agent/special/doc_chat_task.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  langroid/agent/special/lance_doc_chat_agent.py,sha256=6pIqi2DF-MvYYN3-blsdUgulYnOBTl7I21T7wPAt1zM,10413
21
21
  langroid/agent/special/lance_tools.py,sha256=qS8x4wi8mrqfbYV2ztFzrcxyhHQ0ZWOc-zkYiH7awj0,2105
@@ -135,9 +135,9 @@ langroid/vector_store/lancedb.py,sha256=Qd20gKjWozPWfW5-D66J6U8dSrJo1yl-maj6s1lb
135
135
  langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3HmhHQICXLs,11663
136
136
  langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZXpEY9M,14994
137
137
  langroid/vector_store/postgres.py,sha256=wHPtIi2qM4fhO4pMQr95pz1ZCe7dTb2hxl4VYspGZoA,16104
138
- langroid/vector_store/qdrantdb.py,sha256=O6dSBoDZ0jzfeVBd7LLvsXu083xs2fxXtPa9gGX3JX4,18443
138
+ langroid/vector_store/qdrantdb.py,sha256=ZYrT9mxoUCx_67Qzb5xnkWuFG12rfe30yAg4NgG2ueA,19168
139
139
  langroid/vector_store/weaviatedb.py,sha256=Yn8pg139gOy3zkaPfoTbMXEEBCiLiYa1MU5d_3UA1K4,11847
140
- langroid-0.56.9.dist-info/METADATA,sha256=uppdkleoPy1RXOJ6sGIRfFDrYhcSUKAZ_1rfjaYErA8,65744
141
- langroid-0.56.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
142
- langroid-0.56.9.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
143
- langroid-0.56.9.dist-info/RECORD,,
140
+ langroid-0.56.10.dist-info/METADATA,sha256=QYPsEwh24uWqM4OwExH1tSmsWlnj-cyFRkTAXd2Rl64,65745
141
+ langroid-0.56.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
142
+ langroid-0.56.10.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
143
+ langroid-0.56.10.dist-info/RECORD,,