langroid 0.19.4__py3-none-any.whl → 0.19.5__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.
langroid/agent/task.py CHANGED
@@ -1226,8 +1226,23 @@ class Task:
1226
1226
  # reset stuck counter since we made progress
1227
1227
  self.n_stalled_steps = 0
1228
1228
 
1229
- # update counters for infinite loop detection
1229
+
1230
1230
  if self.pending_message is not None:
1231
+ if (
1232
+ self._is_done_response(result, r)
1233
+ and self._level == 0
1234
+ and self.only_user_quits_root
1235
+ and self._user_can_respond()
1236
+ ):
1237
+ # We're ignoring the DoneTools (if any) in this case,
1238
+ # so remove them from the pending msg, to ensure
1239
+ # they don't affect the next step.
1240
+ self.pending_message.tool_messages = [
1241
+ t
1242
+ for t in self.pending_message.tool_messages
1243
+ if not isinstance(t, (DoneTool, AgentDoneTool))
1244
+ ]
1245
+ # update counters for infinite loop detection
1231
1246
  hashed_msg = hash(str(self.pending_message))
1232
1247
  self.message_counter.update([hashed_msg])
1233
1248
  self.history.append(hashed_msg)
@@ -1520,6 +1535,7 @@ class Task:
1520
1535
  content = to_string(t.content)
1521
1536
  content_any = t.content
1522
1537
  if isinstance(t, AgentDoneTool):
1538
+ # AgentDoneTool may have tools, unlike DoneTool
1523
1539
  tool_messages = t.tools
1524
1540
  break
1525
1541
  # drop the "Done" tools since they should not be part of the task result,
@@ -115,7 +115,7 @@ class FinalResultTool(ToolMessage):
115
115
  Note:
116
116
  - when defining a tool handler or agent_response, you can directly return
117
117
  FinalResultTool(field1 = val1, ...),
118
- where the values can be aribitrary data structures, including nested
118
+ where the values can be arbitrary data structures, including nested
119
119
  Pydantic objs, or you can define a subclass of FinalResultTool with the
120
120
  fields you want to return.
121
121
  - This is a special ToolMessage that is NOT meant to be used or handled
@@ -6,6 +6,15 @@ the method `_get_tool_list()`).
6
6
 
7
7
  See usage examples in `tests/main/test_multi_agent_complex.py` and
8
8
  `tests/main/test_recipient_tool.py`.
9
+
10
+ A simpler alternative to this tool is `SendTool`, see here:
11
+ https://github.com/langroid/langroid/blob/main/langroid/agent/tools/orchestration.py
12
+
13
+ You can also define your own XML-based variant of this tool:
14
+ https://github.com/langroid/langroid/blob/main/examples/basic/xml-tool.py
15
+ which uses XML rather than JSON, and can be more reliable than JSON,
16
+ especially with weaker LLMs.
17
+
9
18
  """
10
19
 
11
20
  from typing import List, Type
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.19.4
3
+ Version: 0.19.5
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -33,15 +33,15 @@ langroid/agent/special/sql/utils/system_message.py,sha256=qKLHkvQWRQodTtPLPxr1GS
33
33
  langroid/agent/special/sql/utils/tools.py,sha256=vFYysk6Vi7HJjII8B4RitA3pt_z3gkSglDNdhNVMiFc,1332
34
34
  langroid/agent/special/table_chat_agent.py,sha256=d9v2wsblaRx7oMnKhLV7uO_ujvk9gh59pSGvBXyeyNc,9659
35
35
  langroid/agent/structured_message.py,sha256=y7pud1EgRNeTFZlJmBkLmwME3yQJ_IYik-Xds9kdZbY,282
36
- langroid/agent/task.py,sha256=GDnP24wsoXSZbwlG0g-OmKWM_pY-G4KGUgnCEbCsrYM,84660
36
+ langroid/agent/task.py,sha256=DUitErf1VIhaPNirP3fdOYU2MZEGjO1FPfEniIzFoks,85356
37
37
  langroid/agent/tool_message.py,sha256=jkN7uq7YwUC_wBcSCNUYjrB_His2YCfQay_lqIa4Tww,10498
38
38
  langroid/agent/tools/__init__.py,sha256=IMgCte-_ZIvCkozGQmvMqxIw7_nKLKzD78ccJL1bnQU,804
39
39
  langroid/agent/tools/duckduckgo_search_tool.py,sha256=NhsCaGZkdv28nja7yveAhSK_w6l_Ftym8agbrdzqgfo,1935
40
40
  langroid/agent/tools/file_tools.py,sha256=GjPB5YDILucYapElnvvoYpGJuZQ25ecLs2REv7edPEo,7292
41
41
  langroid/agent/tools/google_search_tool.py,sha256=y7b-3FtgXf0lfF4AYxrZ3K5pH2dhidvibUOAGBE--WI,1456
42
42
  langroid/agent/tools/metaphor_search_tool.py,sha256=qj4gt453cLEX3EGW7nVzVu6X7LCdrwjSlcNY0qJW104,2489
43
- langroid/agent/tools/orchestration.py,sha256=u_iQDwD5L9JgE39pCemmIRG3MxyrBsw6KpQYf7pH-Ek,10881
44
- langroid/agent/tools/recipient_tool.py,sha256=0m2kQhYKTeGujAxhSPqH5z6hSAhVB_Dqour6uul2U30,9427
43
+ langroid/agent/tools/orchestration.py,sha256=vp2Qx-DYPtDnACosxKqwHGy6DeD1QnEllWz0Ht81Cyc,10880
44
+ langroid/agent/tools/recipient_tool.py,sha256=dr0yTxgNEIoxUYxH6TtaExC4G_8WdJ0xGohIa4dFLhY,9808
45
45
  langroid/agent/tools/retrieval_tool.py,sha256=2q2pfoYbZNfbWQ0McxrtmfF0ekGglIgRl-6uF26pa-E,871
46
46
  langroid/agent/tools/rewind_tool.py,sha256=XAXL3BpNhCmBGYq_qi_sZfHJuIw7NY2jp4wnojJ7WRs,5606
47
47
  langroid/agent/tools/segment_extract_tool.py,sha256=__srZ_VGYLVOdPrITUM8S0HpmX4q7r5FHWMDdHdEv8w,1440
@@ -137,8 +137,8 @@ langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3Hmh
137
137
  langroid/vector_store/momento.py,sha256=qR-zBF1RKVHQZPZQYW_7g-XpTwr46p8HJuYPCkfJbM4,10534
138
138
  langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
139
139
  langroid/vector_store/qdrantdb.py,sha256=v88lqFkepADvlN6lByUj9I4NEKa9X9lWH16uTPPbYrE,17457
140
- pyproject.toml,sha256=lidhX-USXT61UtttKdG0y4Y7pZhnfJCliByisRnsGD0,7251
141
- langroid-0.19.4.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
142
- langroid-0.19.4.dist-info/METADATA,sha256=abQ0VzdRQdcxtXfZ9KnexfvOeqKLC8jTl8vEl3Wpz1s,56513
143
- langroid-0.19.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
144
- langroid-0.19.4.dist-info/RECORD,,
140
+ pyproject.toml,sha256=tKD9OebCwUNxXivb-EoM3ZvOjGBmFx4m-Bl9bztRkyg,7251
141
+ langroid-0.19.5.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
142
+ langroid-0.19.5.dist-info/METADATA,sha256=jStMm7ROZxiIDxUHVKXHhc7UNXJ6LkK5QRpr7pTiUAU,56513
143
+ langroid-0.19.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
144
+ langroid-0.19.5.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langroid"
3
- version = "0.19.4"
3
+ version = "0.19.5"
4
4
  description = "Harness LLMs with Multi-Agent Programming"
5
5
  authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
6
6
  readme = "README.md"