attp-client 0.0.11__py3-none-any.whl → 0.0.13__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.
attp_client/client.py
CHANGED
@@ -21,6 +21,8 @@ from attp_client.utils import envelopizer
|
|
21
21
|
|
22
22
|
from attp_core.rs_api import AttpCommand
|
23
23
|
|
24
|
+
from attp_client.utils.trigger_callable import trigger_callable
|
25
|
+
|
24
26
|
class ATTPClient:
|
25
27
|
|
26
28
|
is_connected: bool
|
@@ -48,7 +50,7 @@ class ATTPClient:
|
|
48
50
|
self.max_retries = max_retries
|
49
51
|
self.limits = limits or Limits(max_payload_size=50000)
|
50
52
|
self.client = AttpClientSession(self.connection_url, limits=self.limits)
|
51
|
-
self.logger = logger
|
53
|
+
self.logger = logger or getLogger("Ascender Framework")
|
52
54
|
|
53
55
|
self.route_increment_index = 2
|
54
56
|
|
@@ -73,25 +75,26 @@ class ATTPClient:
|
|
73
75
|
)
|
74
76
|
asyncio.create_task(self.session.start_listener())
|
75
77
|
# Send an authentication frame as soon as connection estabilishes with agenthub
|
78
|
+
self.add_event_handler("tools:call", "message", self._tool_callback)
|
79
|
+
|
76
80
|
await self.session.authenticate(self.routes)
|
77
81
|
asyncio.create_task(self.session.listen(self.responder))
|
78
82
|
|
79
83
|
self.router = AttpRouter(self.responder, self.session)
|
80
84
|
self.inference = AttpInferenceAPI(self.router)
|
81
85
|
|
82
|
-
self.add_event_handler("tools:call", "message", self._tool_callback)
|
83
|
-
|
84
|
-
|
85
|
-
|
86
86
|
self.disposable = self.responder.pipe(
|
87
87
|
ops.subscribe_on(AsyncIOScheduler(asyncio.get_event_loop())),
|
88
88
|
).subscribe(
|
89
|
-
on_next=lambda item: self.
|
89
|
+
on_next=lambda item: trigger_callable(self._handle_incoming, (item,)),
|
90
90
|
on_error=lambda e: self.logger.error(f"Error in responder stream: {e}"),
|
91
91
|
)
|
92
92
|
|
93
93
|
async def close(self):
|
94
94
|
if self.session:
|
95
|
+
if self.disposable:
|
96
|
+
self.disposable.dispose()
|
97
|
+
|
95
98
|
await self.session.close()
|
96
99
|
self.session = None
|
97
100
|
self.is_connected = False
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import asyncio
|
2
|
+
from typing import Any, Callable, Mapping
|
3
|
+
|
4
|
+
|
5
|
+
def trigger_callable(
|
6
|
+
callable: Callable[..., Any],
|
7
|
+
args: tuple[Any] | None = None,
|
8
|
+
kwargs: Mapping[str, Any] | None = None
|
9
|
+
):
|
10
|
+
asyncio.create_task(callable(*(args or tuple()), **(kwargs or {})))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
attp_client/__init__.py,sha256=25qGMUU_W8juBuW9N6318vWoqALrPQSp3ECHHkNzUcg,2749
|
2
2
|
attp_client/catalog.py,sha256=TLQvNKx3GtEYcyqWCJuvF6soZXeebKn6wfQNcvV4cX0,4921
|
3
|
-
attp_client/client.py,sha256=
|
3
|
+
attp_client/client.py,sha256=UeKyGTmgp9SG2iyGGhSzj4b9nuN8nZhES0pQ6O7XWw0,7643
|
4
4
|
attp_client/consts.py,sha256=6UZyqWddycOp-TKW5yvb0JW2fdfcS-J2xFVVNfuJQbU,18
|
5
5
|
attp_client/errors/attp_exception.py,sha256=HePYyYMknS4t6tMrwU-p9L_LPdj1i7chntrlM53ueK4,347
|
6
6
|
attp_client/errors/correlated_rpc_exception.py,sha256=GivYlF0rC4zxbEt5sMxc1cO-iGxIuiEjTy7knN_iur4,591
|
@@ -31,6 +31,7 @@ attp_client/utils/context_awaiter.py,sha256=oCptu5g8mY43j5cr-W4fOe85OCCaqQI9r_Pn
|
|
31
31
|
attp_client/utils/envelopizer.py,sha256=wnFEnEEDGx8eW-UYlhpTeOTyLLXnjBYw3-BOHWG-Hhk,310
|
32
32
|
attp_client/utils/route_mapper.py,sha256=uJNhKp6ipCSUxoiZS0Liix2lHOgUAnJM0kfgXWAh9RQ,554
|
33
33
|
attp_client/utils/serializer.py,sha256=O1tWYbQS9jC9aus-ISKtliKCgGmOEIb9hxykVrmMKGY,636
|
34
|
-
attp_client
|
35
|
-
attp_client-0.0.
|
36
|
-
attp_client-0.0.
|
34
|
+
attp_client/utils/trigger_callable.py,sha256=F5z0JJcSW7UU0Ss4rbCluBM4uhge__27X3p1faMfqmE,271
|
35
|
+
attp_client-0.0.13.dist-info/METADATA,sha256=6Gcgn3JlgK2IjXSEsu02kgRDsd5cjHkleH-P2Me7NAk,7138
|
36
|
+
attp_client-0.0.13.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
37
|
+
attp_client-0.0.13.dist-info/RECORD,,
|
File without changes
|