langroid 0.56.3__py3-none-any.whl → 0.56.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/base.py +21 -12
- {langroid-0.56.3.dist-info → langroid-0.56.5.dist-info}/METADATA +1 -1
- {langroid-0.56.3.dist-info → langroid-0.56.5.dist-info}/RECORD +5 -5
- {langroid-0.56.3.dist-info → langroid-0.56.5.dist-info}/WHEEL +0 -0
- {langroid-0.56.3.dist-info → langroid-0.56.5.dist-info}/licenses/LICENSE +0 -0
langroid/agent/base.py
CHANGED
@@ -265,8 +265,10 @@ class Agent(ABC):
|
|
265
265
|
"""
|
266
266
|
sig = inspect.signature(handler_method)
|
267
267
|
params = list(sig.parameters.values())
|
268
|
-
# Remove 'self' parameter
|
269
|
-
params = [
|
268
|
+
# Remove the first 'self' parameter
|
269
|
+
params = params[1:]
|
270
|
+
# Don't use name
|
271
|
+
# [p for p in params if p.name != "self"]
|
270
272
|
|
271
273
|
agent_param = None
|
272
274
|
chat_doc_param = None
|
@@ -278,17 +280,26 @@ class Agent(ABC):
|
|
278
280
|
ann_str = str(param.annotation)
|
279
281
|
# Check for Agent-like types
|
280
282
|
if (
|
281
|
-
param.annotation
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
283
|
+
inspect.isclass(param.annotation)
|
284
|
+
and issubclass(param.annotation, Agent)
|
285
|
+
) or (
|
286
|
+
not inspect.isclass(param.annotation)
|
287
|
+
and (
|
288
|
+
"Agent" in ann_str
|
289
|
+
or (
|
290
|
+
hasattr(param.annotation, "__name__")
|
291
|
+
and "Agent" in param.annotation.__name__
|
292
|
+
)
|
286
293
|
)
|
287
294
|
):
|
288
295
|
agent_param = param.name
|
289
296
|
has_annotations = True
|
290
297
|
# Check for ChatDocument-like types
|
291
|
-
elif
|
298
|
+
elif (
|
299
|
+
param.annotation is ChatDocument
|
300
|
+
or "ChatDocument" in ann_str
|
301
|
+
or "ChatDoc" in ann_str
|
302
|
+
):
|
292
303
|
chat_doc_param = param.name
|
293
304
|
has_annotations = True
|
294
305
|
|
@@ -303,7 +314,6 @@ class Agent(ABC):
|
|
303
314
|
@no_type_check
|
304
315
|
def _create_handler_wrapper(
|
305
316
|
self,
|
306
|
-
message_class: Type[ToolMessage],
|
307
317
|
handler_method: Any,
|
308
318
|
is_async: bool = False,
|
309
319
|
) -> Any:
|
@@ -320,7 +330,8 @@ class Agent(ABC):
|
|
320
330
|
"""
|
321
331
|
sig = inspect.signature(handler_method)
|
322
332
|
params = list(sig.parameters.values())
|
323
|
-
params = [
|
333
|
+
params = params[1:]
|
334
|
+
# params = [p for p in params if p.name != "self"]
|
324
335
|
|
325
336
|
has_annotations, agent_param, chat_doc_param = self._analyze_handler_params(
|
326
337
|
handler_method,
|
@@ -471,7 +482,6 @@ class Agent(ABC):
|
|
471
482
|
See `tests/main/test_stateless_tool_messages.py` for an example.
|
472
483
|
"""
|
473
484
|
wrapper = self._create_handler_wrapper(
|
474
|
-
message_class,
|
475
485
|
message_class.handle,
|
476
486
|
is_async=False,
|
477
487
|
)
|
@@ -521,7 +531,6 @@ class Agent(ABC):
|
|
521
531
|
and not hasattr(self, async_handler_name)
|
522
532
|
):
|
523
533
|
wrapper = self._create_handler_wrapper(
|
524
|
-
message_class,
|
525
534
|
message_class.handle_async,
|
526
535
|
is_async=True,
|
527
536
|
)
|
@@ -3,7 +3,7 @@ langroid/exceptions.py,sha256=OPjece_8cwg94DLPcOGA1ddzy5bGh65pxzcHMnssTz8,2995
|
|
3
3
|
langroid/mytypes.py,sha256=HIcYAqGeA9OK0Hlscym2FI5Oax9QFljDZoVgRlomhRk,4014
|
4
4
|
langroid/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
langroid/agent/__init__.py,sha256=ll0Cubd2DZ-fsCMl7e10hf9ZjFGKzphfBco396IKITY,786
|
6
|
-
langroid/agent/base.py,sha256=
|
6
|
+
langroid/agent/base.py,sha256=GVE_vdtDUJpldACH4LQwjqbQ11UDn9thr2-uBXk0RjU,86009
|
7
7
|
langroid/agent/batch.py,sha256=wpE9RqCNDVDhAXkCB7wEqfCIEAi6qKcrhaZ-Zr9T4C0,21375
|
8
8
|
langroid/agent/chat_agent.py,sha256=2HIYzYxkrGkRIS97ioKfIqjaW3RbX89M39LjzBobBEY,88381
|
9
9
|
langroid/agent/chat_document.py,sha256=0e6zYkqIorMIVbCsxOul9ziwAPPOWDsBsRV9E8ux-WI,18055
|
@@ -137,7 +137,7 @@ langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZ
|
|
137
137
|
langroid/vector_store/postgres.py,sha256=wHPtIi2qM4fhO4pMQr95pz1ZCe7dTb2hxl4VYspGZoA,16104
|
138
138
|
langroid/vector_store/qdrantdb.py,sha256=O6dSBoDZ0jzfeVBd7LLvsXu083xs2fxXtPa9gGX3JX4,18443
|
139
139
|
langroid/vector_store/weaviatedb.py,sha256=Yn8pg139gOy3zkaPfoTbMXEEBCiLiYa1MU5d_3UA1K4,11847
|
140
|
-
langroid-0.56.
|
141
|
-
langroid-0.56.
|
142
|
-
langroid-0.56.
|
143
|
-
langroid-0.56.
|
140
|
+
langroid-0.56.5.dist-info/METADATA,sha256=6SY2uUuGE0NGaE-a__rDk2g0MMGBxudxikjVpjdla2A,65744
|
141
|
+
langroid-0.56.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
142
|
+
langroid-0.56.5.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
|
143
|
+
langroid-0.56.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|