langroid 0.1.150__py3-none-any.whl → 0.1.152__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/__init__.py CHANGED
@@ -30,4 +30,5 @@ from .agent.task import Task
30
30
  from .mytypes import (
31
31
  DocMetaData,
32
32
  Document,
33
+ Entity,
33
34
  )
langroid/agent/task.py CHANGED
@@ -78,12 +78,17 @@ class Task:
78
78
  Args:
79
79
  agent (Agent): agent associated with the task
80
80
  name (str): name of the task
81
- llm_delegate (bool): whether to delegate control to LLM; conceptually,
81
+ llm_delegate (bool):
82
+ [Deprecated, not used; use `done_if_response`, `done_if_no_response`
83
+ instead]
84
+ Whether to delegate control to LLM; conceptually,
82
85
  the "controlling entity" is the one "seeking" responses to its queries,
83
86
  and has a goal it is aiming to achieve. The "controlling entity" is
84
87
  either the LLM or the USER. (Note within a Task there is just one
85
88
  LLM, and all other entities are proxies of the "User" entity).
86
- single_round (bool): If true, task runs until one message by controller,
89
+ single_round (bool):
90
+ [Deprecated: Use `done_if_response`, `done_if_no_response` instead].
91
+ If true, task runs until one message by controller,
87
92
  and subsequent response by non-controller. If false, runs for the
88
93
  specified number of turns in `run`, or until `done()` is true.
89
94
  One run of step() is considered a "turn".
@@ -92,16 +97,19 @@ class Task:
92
97
  restart (bool): if true, resets the agent's message history
93
98
  default_human_response (str): default response from user; useful for
94
99
  testing, to avoid interactive input from user.
100
+ [Instead of this, setting `interactive` usually suffices]
95
101
  interactive (bool): if true, wait for human input after each non-human
96
102
  response (prevents infinite loop of non-human responses).
97
103
  Default is true. If false, then `default_human_response` is set to ""
98
104
  only_user_quits_root (bool): if true, only user can quit the root task.
105
+ [Instead of this, setting `interactive` usually suffices]
99
106
  erase_substeps (bool): if true, when task completes, erase intermediate
100
107
  conversation with subtasks from this agent's `message_history`, and also
101
108
  erase all subtask agents' `message_history`.
102
109
  Note: erasing can reduce prompt sizes, but results in repetitive
103
110
  sub-task delegation.
104
- allow_null_result (bool): if true, allow null (empty or NO_ANSWER)
111
+ allow_null_result (bool): [Deprecated, may be removed in future.]
112
+ If true, allow null (empty or NO_ANSWER)
105
113
  as the result of a step or overall task result.
106
114
  Optional, default is True.
107
115
  max_stalled_steps (int): task considered done after this many consecutive
@@ -132,12 +140,13 @@ class Task:
132
140
  self.step_progress = False # progress in current step?
133
141
  self.n_stalled_steps = 0 # how many consecutive steps with no progress?
134
142
  self.max_stalled_steps = max_stalled_steps
135
- self.done_if_response = [str(r) for r in done_if_response]
136
- self.done_if_no_response = [str(r) for r in done_if_no_response]
143
+ self.done_if_response = [r.value for r in done_if_response]
144
+ self.done_if_no_response = [r.value for r in done_if_no_response]
137
145
  self.is_done = False # is task done (based on response)?
138
146
  self.is_pass_thru = False # is current response a pass-thru?
139
147
  self.task_progress = False # progress in current task (since run or run_async)?
140
148
  self.name = name or agent.config.name
149
+ self.value: str = self.name
141
150
  self.default_human_response = default_human_response
142
151
  self.interactive = interactive
143
152
  self.message_history_idx = -1
@@ -221,6 +230,10 @@ class Task:
221
230
  interactive=self.interactive,
222
231
  only_user_quits_root=self.only_user_quits_root,
223
232
  erase_substeps=self.erase_substeps,
233
+ allow_null_result=self.allow_null_result,
234
+ max_stalled_steps=self.max_stalled_steps,
235
+ done_if_no_response=[Entity(s) for s in self.done_if_no_response],
236
+ done_if_response=[Entity(s) for s in self.done_if_response],
224
237
  )
225
238
 
226
239
  def __repr__(self) -> str:
@@ -808,11 +821,11 @@ class Task:
808
821
  )
809
822
  return (
810
823
  (
811
- str(responder) in self.done_if_response
824
+ responder.value in self.done_if_response
812
825
  and not self._is_empty_message(result)
813
826
  )
814
827
  or (
815
- str(responder) in self.done_if_no_response
828
+ responder.value in self.done_if_no_response
816
829
  and self._is_empty_message(result)
817
830
  )
818
831
  or (not self._is_empty_message(result) and response_says_done)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.1.150
3
+ Version: 0.1.152
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -1,4 +1,4 @@
1
- langroid/__init__.py,sha256=-T6zCLCy-0U_h4iDmC2d6OUXjqopFe0XGrclYgbnBZk,465
1
+ langroid/__init__.py,sha256=mlQxyJTPRJjTon0D5MlzpMHQ0jwdzSIEpiB0A6mZR7A,477
2
2
  langroid/agent/__init__.py,sha256=ZqDw3Ktw7XGDl6mC8DN61F71V4ckf0rBoEOydH9l6C4,428
3
3
  langroid/agent/base.py,sha256=LefRKYgXkun5p58whlFD0A5J6m8TKvCTAr7ppwKAi9s,32494
4
4
  langroid/agent/batch.py,sha256=Cg7Qv1yGi_M9rMl38_4-hjXPsoLlZrOSXDhbOFqUcKY,5593
@@ -20,7 +20,7 @@ langroid/agent/special/sql/utils/populate_metadata.py,sha256=zRjw31a1ZXvpx9bcmbt
20
20
  langroid/agent/special/sql/utils/system_message.py,sha256=qKLHkvQWRQodTtPLPxr1GSLUYUFASZU8x-ybV67cB68,1885
21
21
  langroid/agent/special/sql/utils/tools.py,sha256=6uB2424SLtmapui9ggcEr0ZTiB6_dL1-JRGgN8RK9Js,1332
22
22
  langroid/agent/special/table_chat_agent.py,sha256=G7QIhZZmJwbM4d51C4cYTvfvtSKfBX0qKFFisuS2xSg,7807
23
- langroid/agent/task.py,sha256=0EW9ZFh6SLYXZU62htsY6VhddVRdCNTqP7xndXcmwIM,42705
23
+ langroid/agent/task.py,sha256=Zqz5NrLRoTMecl4O2icNCSVtB1MBQZmXqBBZfTEif08,43436
24
24
  langroid/agent/tool_message.py,sha256=vyCyHs3-kliKxk9TVjdlhFUHMtkijBzsaF8GvH3FFfA,5988
25
25
  langroid/agent/tools/__init__.py,sha256=6le5y_iPEHwh7Tli_0MtwCGOjy3tPQfAdfDC7WBg2e0,172
26
26
  langroid/agent/tools/extract_tool.py,sha256=u5lL9rKBzaLBOrRyLnTAZ97pQ1uxyLP39XsWMnpaZpw,3789
@@ -97,7 +97,7 @@ langroid/vector_store/meilisearch.py,sha256=d2huA9P-NoYRuAQ9ZeXJmMKr7ry8u90RUSR2
97
97
  langroid/vector_store/momento.py,sha256=j6Eo6oIDN2fe7lsBOlCXJn3uvvERHHTFL5QJfeREeOM,10044
98
98
  langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
99
99
  langroid/vector_store/qdrantdb.py,sha256=qt7Dye6rcgoe0551WzmOxRGIlJfL87D4MX7HdqxuEok,13393
100
- langroid-0.1.150.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
101
- langroid-0.1.150.dist-info/METADATA,sha256=IxY9LjMOVFIWj2dJn_WJB-pf1wJCkPNWPmdo8X0kg9Q,41534
102
- langroid-0.1.150.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
103
- langroid-0.1.150.dist-info/RECORD,,
100
+ langroid-0.1.152.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
101
+ langroid-0.1.152.dist-info/METADATA,sha256=Ss-63ccEK7xHwAIvxuH1NTWl7_frpYEk4ZqVjEsWzr0,41534
102
+ langroid-0.1.152.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
103
+ langroid-0.1.152.dist-info/RECORD,,