langroid 0.1.226__py3-none-any.whl → 0.1.227__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.
@@ -8,6 +8,10 @@ from enum import Enum
8
8
  from typing import Any, Dict, List, Optional, Tuple, Type, cast, no_type_check
9
9
 
10
10
  from openai.types.beta import Assistant, Thread
11
+ from openai.types.beta.assistant_update_params import (
12
+ ToolResources,
13
+ ToolResourcesCodeInterpreter,
14
+ )
11
15
  from openai.types.beta.threads import Message, Run
12
16
  from openai.types.beta.threads.runs import RunStep
13
17
  from pydantic import BaseModel
@@ -29,7 +33,7 @@ logger = logging.getLogger(__name__)
29
33
 
30
34
 
31
35
  class ToolType(str, Enum):
32
- RETRIEVAL = "retrieval"
36
+ RETRIEVAL = "file_search"
33
37
  CODE_INTERPRETER = "code_interpreter"
34
38
  FUNCTION = "function"
35
39
 
@@ -127,7 +131,11 @@ class OpenAIAssistant(ChatAgent):
127
131
  self.config.files = list(set(self.config.files + files))
128
132
  self.assistant = self.assistants.update(
129
133
  self.assistant.id,
130
- file_ids=[f.id for f in self.files],
134
+ tool_resources=ToolResources(
135
+ code_interpreter=ToolResourcesCodeInterpreter(
136
+ file_ids=[f.id for f in self.files],
137
+ ),
138
+ ),
131
139
  )
132
140
 
133
141
  def add_assistant_tools(self, tools: List[AssistantTool]) -> None:
@@ -169,7 +169,8 @@ class DocChatAgentConfig(ChatAgentConfig):
169
169
  dims=1536,
170
170
  )
171
171
 
172
- vecdb: VectorStoreConfig = LanceDBConfig(
172
+ # Allow vecdb to be None in case we want to explicitly set it later
173
+ vecdb: Optional[VectorStoreConfig] = LanceDBConfig(
173
174
  collection_name="doc-chat-lancedb",
174
175
  replace_collection=True,
175
176
  storage_path=".lancedb/data/",
@@ -209,12 +210,13 @@ class DocChatAgent(ChatAgent):
209
210
 
210
211
  def clear(self) -> None:
211
212
  """Clear the document collection and the specific collection in vecdb"""
212
- if self.vecdb is None:
213
- raise ValueError("VecDB not set")
214
213
  self.original_docs = []
215
214
  self.original_docs_length = 0
216
215
  self.chunked_docs = []
217
216
  self.chunked_docs_clean = []
217
+ if self.vecdb is None:
218
+ logger.warning("Attempting to clear VecDB, but VecDB not set.")
219
+ return
218
220
  collection_name = self.vecdb.config.collection_name
219
221
  if collection_name is None:
220
222
  return
@@ -192,8 +192,7 @@ class QdrantDB(VectorStore):
192
192
  with the same name. Defaults to False.
193
193
  """
194
194
  self.config.collection_name = collection_name
195
- collections = self.list_collections()
196
- if collection_name in collections:
195
+ if self.client.collection_exists(collection_name=collection_name):
197
196
  coll = self.client.get_collection(collection_name=collection_name)
198
197
  if (
199
198
  coll.status == CollectionStatus.GREEN
@@ -205,7 +204,8 @@ class QdrantDB(VectorStore):
205
204
  return
206
205
  else:
207
206
  logger.warning("Recreating fresh collection")
208
- self.client.recreate_collection(
207
+ self.client.delete_collection(collection_name=collection_name)
208
+ self.client.create_collection(
209
209
  collection_name=collection_name,
210
210
  vectors_config=VectorParams(
211
211
  size=self.embedding_dim,
@@ -214,7 +214,7 @@ class QdrantDB(VectorStore):
214
214
  )
215
215
  collection_info = self.client.get_collection(collection_name=collection_name)
216
216
  assert collection_info.status == CollectionStatus.GREEN
217
- assert collection_info.vectors_count == 0
217
+ assert collection_info.vectors_count in [0, None]
218
218
  if settings.debug:
219
219
  level = logger.getEffectiveLevel()
220
220
  logger.setLevel(logging.INFO)
@@ -1,14 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.1.226
3
+ Version: 0.1.227
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
7
7
  Author-email: pchalasani@gmail.com
8
- Requires-Python: >=3.9.1,<3.12
8
+ Requires-Python: >=3.11,<3.12
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.10
12
11
  Classifier: Programming Language :: Python :: 3.11
13
12
  Provides-Extra: chainlit
14
13
  Provides-Extra: chromadb
@@ -8,9 +8,9 @@ langroid/agent/chat_agent.py,sha256=X5uVMm9qdw3j-FRf4hbN8k8ByaSdtQCTuU8olKE0sbs,
8
8
  langroid/agent/chat_document.py,sha256=PL8iA1ZYjXNFVa3kMO8T4sbbM3rzHWpRAY6PN_7n5LQ,7969
9
9
  langroid/agent/helpers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  langroid/agent/junk,sha256=LxfuuW7Cijsg0szAzT81OjWWv1PMNI-6w_-DspVIO2s,339
11
- langroid/agent/openai_assistant.py,sha256=QTLBgnH6Btf2GWzN-WApvra-vPQWvYcXcAOULuIy4Ig,32702
11
+ langroid/agent/openai_assistant.py,sha256=xWSDR4SyMcZhCUkgaM4-mu77rbEDF_xpt7N8m8CkiA4,32962
12
12
  langroid/agent/special/__init__.py,sha256=XPE076zD-roskxNBn-A1hnh4AHoMiQN9gk1UDjPaBaU,1201
13
- langroid/agent/special/doc_chat_agent.py,sha256=OpPWLFHBi3C5V6H0xRgmXUubmvy80EJRTgS6YkYfBJA,53242
13
+ langroid/agent/special/doc_chat_agent.py,sha256=Ur57J3xolTaoTgzr2DfP8TY7BViIMNFGNEmmRfHbkL4,53373
14
14
  langroid/agent/special/lance_doc_chat_agent.py,sha256=USp0U3eTaJzwF_3bdqE7CedSLbaqAi2tm-VzygcyLaA,10175
15
15
  langroid/agent/special/lance_rag/__init__.py,sha256=QTbs0IVE2ZgDg8JJy1zN97rUUg4uEPH7SLGctFNumk4,174
16
16
  langroid/agent/special/lance_rag/critic_agent.py,sha256=pi_9eMBxEycbWTddtq_yz-mOb2V4SgGm3zfsOH1HU-Q,5775
@@ -120,8 +120,8 @@ langroid/vector_store/lancedb.py,sha256=lbl8wZuV6GNw0LnIwOSriSNwoMEba90umQTcQHtM
120
120
  langroid/vector_store/meilisearch.py,sha256=d2huA9P-NoYRuAQ9ZeXJmMKr7ry8u90RUSR28k2ecQg,11340
121
121
  langroid/vector_store/momento.py,sha256=9cui31TTrILid2KIzUpBkN2Ey3g_CZWOQVdaFsA4Ors,10045
122
122
  langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
123
- langroid/vector_store/qdrantdb.py,sha256=_egbsP9SWBwmI827EDYSSOqfIQSmwNsmJfFTxrLpWYE,13457
124
- langroid-0.1.226.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
125
- langroid-0.1.226.dist-info/METADATA,sha256=Dssqa7k6VMEBWxwulUiub5XM9TyreczBTC-xrNGXeK4,48003
126
- langroid-0.1.226.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
127
- langroid-0.1.226.dist-info/RECORD,,
123
+ langroid/vector_store/qdrantdb.py,sha256=foKRxRv0BBony6S4Vt0Vav9Rn9HMxZvcIh1cE7nosFE,13524
124
+ langroid-0.1.227.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
125
+ langroid-0.1.227.dist-info/METADATA,sha256=pm5XedC6otRVliKik-XnZd7l0DUn9QpSXnA_tFTiDfI,47951
126
+ langroid-0.1.227.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
127
+ langroid-0.1.227.dist-info/RECORD,,