grasp_agents 0.5.0__py3-none-any.whl → 0.5.2__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.
grasp_agents/memory.py CHANGED
@@ -34,3 +34,22 @@ class Memory(BaseModel, ABC):
34
34
  return f"{self.__class__.__name__}()"
35
35
 
36
36
  model_config = ConfigDict(arbitrary_types_allowed=True)
37
+
38
+
39
+ class DummyMemory(Memory):
40
+ def reset(
41
+ self, *args: Any, ctx: RunContext[Any] | None = None, **kwargs: Any
42
+ ) -> None:
43
+ pass
44
+
45
+ def erase(self) -> None:
46
+ pass
47
+
48
+ def update(
49
+ self, *args: Any, ctx: RunContext[Any] | None = None, **kwargs: Any
50
+ ) -> None:
51
+ pass
52
+
53
+ @property
54
+ def is_empty(self) -> bool:
55
+ return True
grasp_agents/printer.py CHANGED
@@ -136,9 +136,7 @@ class Printer:
136
136
  elif isinstance(message, AssistantMessage):
137
137
  out += f"<response>\n{content}\n</response>\n"
138
138
  else:
139
- out += (
140
- f"<tool result> [{message.tool_call_id}]{content}\n</tool result>"
141
- )
139
+ out += f"<tool result> [{message.tool_call_id}]\n{content}\n</tool result>\n"
142
140
 
143
141
  # Tool calls
144
142
  if isinstance(message, AssistantMessage) and message.tool_calls is not None:
@@ -154,7 +152,7 @@ class Printer:
154
152
  usage_str += f"/{usage.reasoning_tokens or '-'}"
155
153
  usage_str += f"/{usage.cached_tokens or '-'}"
156
154
 
157
- out += f"\n------------------------------------\n{usage_str}"
155
+ out += f"\n------------------------------------\n{usage_str}\n"
158
156
 
159
157
  logger.debug(out, **log_kwargs) # type: ignore
160
158
 
@@ -199,11 +197,11 @@ async def print_event_stream(
199
197
  closing_text += "\n</tool call>\n"
200
198
 
201
199
  if _thinking_open:
202
- closing_text += "</thinking>\n"
200
+ closing_text += "\n</thinking>\n"
203
201
  _thinking_open = False
204
202
 
205
203
  if _response_open:
206
- closing_text += "</response>\n"
204
+ closing_text += "\n</response>\n"
207
205
  _response_open = False
208
206
 
209
207
  if closing_text:
grasp_agents/processor.py CHANGED
@@ -10,15 +10,13 @@ from pydantic import ValidationError as PydanticValidationError
10
10
 
11
11
  from .errors import ProcInputValidationError, ProcOutputValidationError
12
12
  from .generics_utils import AutoInstanceAttributesMixin
13
- from .memory import MemT
13
+ from .memory import DummyMemory, MemT
14
14
  from .packet import Packet
15
15
  from .run_context import CtxT, RunContext
16
16
  from .typing.events import (
17
17
  Event,
18
- # ProcFinishEvent,
19
18
  ProcPacketOutputEvent,
20
19
  ProcPayloadOutputEvent,
21
- # ProcStartEvent,
22
20
  ProcStreamingErrorData,
23
21
  ProcStreamingErrorEvent,
24
22
  )
@@ -42,7 +40,7 @@ class Processor(AutoInstanceAttributesMixin, ABC, Generic[InT, OutT_co, MemT, Ct
42
40
  super().__init__()
43
41
 
44
42
  self._name: ProcName = name
45
- self._memory: MemT
43
+ self._memory: MemT = cast("MemT", DummyMemory())
46
44
  self._max_retries: int = max_retries
47
45
 
48
46
  @property
@@ -176,6 +174,7 @@ class Processor(AutoInstanceAttributesMixin, ABC, Generic[InT, OutT_co, MemT, Ct
176
174
  chat_inputs=chat_inputs, in_packet=in_packet, in_args=in_args
177
175
  )
178
176
  _memory = self.memory.model_copy(deep=True) if forgetful else self.memory
177
+
179
178
  outputs = await self._process(
180
179
  chat_inputs=chat_inputs,
181
180
  in_args=resolved_in_args,
@@ -292,7 +291,6 @@ class Processor(AutoInstanceAttributesMixin, ABC, Generic[InT, OutT_co, MemT, Ct
292
291
  resolved_in_args = self._validate_and_resolve_single_input(
293
292
  chat_inputs=chat_inputs, in_packet=in_packet, in_args=in_args
294
293
  )
295
-
296
294
  _memory = self.memory.model_copy(deep=True) if forgetful else self.memory
297
295
 
298
296
  outputs: list[OutT_co] = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: grasp_agents
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: Grasp Agents Library
5
5
  License-File: LICENSE.md
6
6
  Requires-Python: <4,>=3.11.4
@@ -10,11 +10,11 @@ grasp_agents/llm.py,sha256=YCzHlb2gdWVy77DmQpcu0dyEzGp4VQa3UMRJKodCYSs,6557
10
10
  grasp_agents/llm_agent.py,sha256=coXcYSd1G8UiYPqNpF1z5ESQcH2zhSHYO8QhQfRtqiE,14401
11
11
  grasp_agents/llm_agent_memory.py,sha256=GZ2Z66_JC_sR10vATvR53ui62xxY4lDDtL0XvL_AQNk,1846
12
12
  grasp_agents/llm_policy_executor.py,sha256=aWxXS2-7Twzaz8U07wslzR8zR9byl2bDha1ACKxUEvI,16734
13
- grasp_agents/memory.py,sha256=uRplf46uxHDmiNR3q7nk9fGSPv_BUtp8zJ-vzxUrXXg,783
13
+ grasp_agents/memory.py,sha256=keHuNEZNSxHT9FKpMohHOCNi7UAz_oRIc91IQEuzaWE,1162
14
14
  grasp_agents/packet.py,sha256=neJ139jgLKgZjLyXAwSe0lH08BftveYOsLFyri9MZ0w,785
15
15
  grasp_agents/packet_pool.py,sha256=doG7UpTO7cqJi4YT0UP_vfOnOebqiwzBUHfoxy1TkPY,3282
16
- grasp_agents/printer.py,sha256=JpEnal0wuI5dAVvg7IgzBSJsZgfydUVmfjXLGpEOE0I,10853
17
- grasp_agents/processor.py,sha256=WKtU5BleZ7IGSqDv0ZpO8RgBY04SInMU7JIjh3m34wg,15828
16
+ grasp_agents/printer.py,sha256=by7-wW0y1rCEqhGLuK8Jq-wsJfbZZO-0u8hS41-XJJU,10823
17
+ grasp_agents/processor.py,sha256=jel12KXWR8oA241NKt-sy0eWGbsfuBPwwdmj6Ecqg5s,15826
18
18
  grasp_agents/prompt_builder.py,sha256=3Ua-f-lRdoE2LomFWDiZILpKpfuQxAM-aHcY69hvv1U,7978
19
19
  grasp_agents/run_context.py,sha256=dUxwx1yM3gSk2KqMIAeDVVftysdk7v_1Ht0EcLk9jJI,1242
20
20
  grasp_agents/runner.py,sha256=yH1yUIhwpcAivLFFaq5pXJ9OQdFa4WjOs_uqJ4XTNQw,1456
@@ -51,7 +51,7 @@ grasp_agents/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
51
51
  grasp_agents/workflow/looped_workflow.py,sha256=eA2V4ftAjXth1OqQS_jTNS3D5_hzLGGyWfn4Ju47FQ0,6338
52
52
  grasp_agents/workflow/sequential_workflow.py,sha256=wKlF6PvzLXkKDGlfvd8h-WI3AGNo6qyS2gkROzdPvWM,3421
53
53
  grasp_agents/workflow/workflow_processor.py,sha256=I0sTMfWGeTcx0y0oYssz8B85_PFhbatHXrSJ31woI6Q,3015
54
- grasp_agents-0.5.0.dist-info/METADATA,sha256=w21-UoIaSRaFmJe1KWfk4dQqQtvKmPfAQscIcMeMHjg,6865
55
- grasp_agents-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
- grasp_agents-0.5.0.dist-info/licenses/LICENSE.md,sha256=-nNNdWqGB8gJ2O-peFQ2Irshv5tW5pHKyTcYkwvH7CE,1201
57
- grasp_agents-0.5.0.dist-info/RECORD,,
54
+ grasp_agents-0.5.2.dist-info/METADATA,sha256=bBp_1qNM0Wv6zMwFN_lyjludKHn6MT7OOKaBnOWCZ3Q,6865
55
+ grasp_agents-0.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
+ grasp_agents-0.5.2.dist-info/licenses/LICENSE.md,sha256=-nNNdWqGB8gJ2O-peFQ2Irshv5tW5pHKyTcYkwvH7CE,1201
57
+ grasp_agents-0.5.2.dist-info/RECORD,,