attp-client 0.0.7__tar.gz → 0.0.9__tar.gz

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.
Files changed (35) hide show
  1. {attp_client-0.0.7 → attp_client-0.0.9}/PKG-INFO +1 -1
  2. {attp_client-0.0.7 → attp_client-0.0.9}/pyproject.toml +1 -1
  3. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/inference.py +43 -13
  4. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/tools.py +16 -18
  5. {attp_client-0.0.7 → attp_client-0.0.9}/README.md +0 -0
  6. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/__init__.py +0 -0
  7. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/catalog.py +0 -0
  8. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/client.py +0 -0
  9. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/consts.py +0 -0
  10. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/errors/attp_exception.py +0 -0
  11. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/errors/correlated_rpc_exception.py +0 -0
  12. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/errors/dead_session.py +0 -0
  13. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/errors/not_found.py +0 -0
  14. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/errors/serialization_error.py +0 -0
  15. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/errors/unauthenticated_error.py +0 -0
  16. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/catalogs/catalog.py +0 -0
  17. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/catalogs/tools/envelope.py +0 -0
  18. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/error.py +0 -0
  19. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/handshake/auth.py +0 -0
  20. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/handshake/hello.py +0 -0
  21. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/handshake/ready.py +0 -0
  22. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/inference/enums/message_data_type.py +0 -0
  23. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/inference/enums/message_emergency_type.py +0 -0
  24. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/inference/enums/message_type.py +0 -0
  25. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/inference/message.py +0 -0
  26. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/inference/tool.py +0 -0
  27. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/interfaces/route_mappings.py +0 -0
  28. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/misc/fixed_basemodel.py +0 -0
  29. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/misc/serializable.py +0 -0
  30. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/router.py +0 -0
  31. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/session.py +0 -0
  32. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/types/route_mapping.py +0 -0
  33. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/utils/context_awaiter.py +0 -0
  34. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/utils/route_mapper.py +0 -0
  35. {attp_client-0.0.7 → attp_client-0.0.9}/src/attp_client/utils/serializer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: attp-client
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: A python-sdk client for interacting with AgentHub's ATTP protocol (Agent Tool Transport Protocol)
5
5
  License: MIT
6
6
  Author: Ascender Team
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "attp-client"
3
- version = "0.0.7"
3
+ version = "0.0.9"
4
4
  description = "A python-sdk client for interacting with AgentHub's ATTP protocol (Agent Tool Transport Protocol)"
5
5
  authors = [
6
6
  {name = "Ascender Team"}
@@ -18,6 +18,40 @@ class AttpInferenceAPI:
18
18
  self.router = router
19
19
  self.logger = logger
20
20
 
21
+ async def create_chat(
22
+ self,
23
+ name: str,
24
+ agent_id: int | None = None,
25
+ agent_name: str | None = None,
26
+ mode: str = "agent_autopilot",
27
+ platform: str = "unknown",
28
+ responsible: int | None = None,
29
+ client_id: str | None = None,
30
+ created_by_id: int | None = None,
31
+ timeout: float = 30
32
+ ):
33
+ """
34
+ Create chat for inference.
35
+ TODO: Implement own chat manager for chats, just like I did with catalogs.
36
+ """
37
+ response = await self.router.send(
38
+ "messages:chat:create",
39
+ Serializable[dict[str, Any]]({
40
+ "name": name,
41
+ "agent_id": agent_id,
42
+ "agent_name": agent_name,
43
+ "mode": mode,
44
+ "platform": platform,
45
+ "responsible": responsible,
46
+ "client_id": client_id,
47
+ "created_by_id": created_by_id
48
+ }),
49
+ timeout=timeout,
50
+ expected_response=dict[str, Any]
51
+ )
52
+
53
+ return response
54
+
21
55
  async def invoke_inference(
22
56
  self,
23
57
  agent_id: int | None = None,
@@ -67,13 +101,11 @@ class AttpInferenceAPI:
67
101
  raise ValueError("Cannot find agent by two identification specifiers, use only one!")
68
102
 
69
103
  response = await self.router.send("messages:inference:invoke", Serializable[dict[str, Any]]({
70
- "data": {
71
- "agent_id": agent_id,
72
- "agent_name": agent_name,
73
- "input_configuration": input_configuration,
74
- "messages": [message.model_dump(mode="json") for message in (messages or [])],
75
- "stream": stream
76
- }
104
+ "agent_id": agent_id,
105
+ "agent_name": agent_name,
106
+ "input_configuration": input_configuration,
107
+ "messages": [message.model_dump(mode="json") for message in (messages or [])],
108
+ "stream": stream
77
109
  }), timeout=timeout, expected_response=IMessageResponse)
78
110
 
79
111
  return response
@@ -110,10 +142,8 @@ class AttpInferenceAPI:
110
142
  response = await self.router.send(
111
143
  "messages:chat:invoke",
112
144
  Serializable[dict[str, Any]]({
113
- "data": {
114
- "chat_id": str(chat_id),
115
- "stream": stream
116
- }
145
+ "chat_id": str(chat_id),
146
+ "stream": stream
117
147
  }),
118
148
  timeout=timeout,
119
149
  expected_response=IMessageResponse
@@ -132,6 +162,6 @@ class AttpInferenceAPI:
132
162
  """
133
163
  if isinstance(message, Sequence):
134
164
  for msg in message:
135
- await self.router.emit("messages:append", Serializable[dict[str, Any]]({"data": msg}))
165
+ await self.router.emit("messages:append", msg)
136
166
  else:
137
- await self.router.emit("messages:append", Serializable[dict[str, Any]]({"data": message}))
167
+ await self.router.emit("messages:append", message)
@@ -20,23 +20,23 @@ class ToolsManager:
20
20
  return_direct: bool = False,
21
21
  schema_ver: str = "1.0",
22
22
  timeout_ms: float = 20000,
23
- idempotent: bool = False
23
+ idempotent: bool = False,
24
+ configs: Any | None = None
24
25
  ) -> UUID:
25
26
  response = await self.router.send(
26
27
  "tools:register",
27
28
  Serializable[dict[str, Any]]({
28
- "data": {
29
- "catalog": catalog_name,
30
- "tool": {
31
- "name": name,
32
- "description": description,
33
- "schema_id": schema_id,
34
- "return_direct": return_direct,
35
- "schema_ver": schema_ver,
36
- "schema": schema,
37
- "timeout_ms": timeout_ms,
38
- "idempotent": idempotent
39
- }
29
+ "catalog": catalog_name,
30
+ "tool": {
31
+ "name": name,
32
+ "description": description,
33
+ "schema_id": schema_id,
34
+ "return_direct": return_direct,
35
+ "schema_ver": schema_ver,
36
+ "schema": schema,
37
+ "timeout_ms": timeout_ms,
38
+ "idempotent": idempotent,
39
+ "config": configs or {}
40
40
  }
41
41
  }),
42
42
  timeout=30,
@@ -51,12 +51,10 @@ class ToolsManager:
51
51
  tool_id: str | Sequence[str]
52
52
  ) -> str | list[str]:
53
53
  response = await self.router.send(
54
- "tool:unregister",
54
+ "tools:unregister",
55
55
  Serializable[dict[str, Any]]({
56
- "data": {
57
- "catalog": catalog_name,
58
- "tool_id": tool_id
59
- }
56
+ "catalog": catalog_name,
57
+ "tool_id": tool_id
60
58
  }),
61
59
  timeout=30,
62
60
  expected_response=dict[str, Any]
File without changes