agenthub-python 0.4.1__tar.gz → 0.4.3__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.
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/PKG-INFO +31 -41
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/README.md +29 -40
- agenthub_python-0.4.3/agenthub/ant_messages/__init__.py +18 -0
- {agenthub_python-0.4.1/agenthub/claude4_6 → agenthub_python-0.4.3/agenthub/ant_messages}/client.py +116 -145
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/auto_client.py +34 -35
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/claude5/client.py +27 -4
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/deepseek_v4/client.py +8 -1
- {agenthub_python-0.4.1/agenthub/claude4_6 → agenthub_python-0.4.3/agenthub/gemini3_7}/__init__.py +2 -2
- {agenthub_python-0.4.1/agenthub/gemini3_6 → agenthub_python-0.4.3/agenthub/gemini3_7}/client.py +103 -20
- {agenthub_python-0.4.1/agenthub/glm5_1 → agenthub_python-0.4.3/agenthub/glm5_3}/__init__.py +2 -2
- {agenthub_python-0.4.1/agenthub/glm5_2 → agenthub_python-0.4.3/agenthub/glm5_3}/client.py +51 -24
- {agenthub_python-0.4.1/agenthub/gpt5_5 → agenthub_python-0.4.3/agenthub/gpt5_6}/__init__.py +2 -2
- {agenthub_python-0.4.1/agenthub/gpt5_5 → agenthub_python-0.4.3/agenthub/gpt5_6}/client.py +50 -37
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/kimi_k3/client.py +37 -11
- {agenthub_python-0.4.1/agenthub/gemini3 → agenthub_python-0.4.3/agenthub/minimax_m3}/__init__.py +2 -2
- agenthub_python-0.4.3/agenthub/minimax_m3/client.py +316 -0
- agenthub_python-0.4.3/agenthub/openai_chat/__init__.py +18 -0
- {agenthub_python-0.4.1/agenthub/openai → agenthub_python-0.4.3/agenthub/openai_chat}/client.py +7 -2
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/openai_embedding/client.py +6 -0
- agenthub_python-0.4.3/agenthub/openai_responses/__init__.py +18 -0
- agenthub_python-0.4.3/agenthub/openai_responses/client.py +375 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/registry.py +100 -29
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/types.py +3 -0
- agenthub_python-0.4.3/pyproject.toml +86 -0
- agenthub_python-0.4.1/pyproject.toml → agenthub_python-0.4.3/pyproject.toml.orig +2 -2
- agenthub_python-0.4.1/agenthub/gemini3/client.py +0 -449
- agenthub_python-0.4.1/agenthub/gemini3_6/__init__.py +0 -18
- agenthub_python-0.4.1/agenthub/glm5_1/client.py +0 -393
- agenthub_python-0.4.1/agenthub/glm5_2/__init__.py +0 -18
- agenthub_python-0.4.1/agenthub/kimi_k2_6/__init__.py +0 -18
- agenthub_python-0.4.1/agenthub/kimi_k2_6/client.py +0 -429
- agenthub_python-0.4.1/agenthub/openai/__init__.py +0 -18
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/__init__.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/abort_signal.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/base_client.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/claude5/__init__.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/deepseek_v4/__init__.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/errors.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/integration/__init__.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/integration/playground.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/integration/tracer.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/kimi_k3/__init__.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/openai_embedding/__init__.py +0 -0
- {agenthub_python-0.4.1 → agenthub_python-0.4.3}/agenthub/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agenthub-python
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: AgentHub is the LLM API Hub for the Agent era, built for high-precision autonomous agents.
|
|
5
5
|
Keywords: agent,llm,gemini,claude,gpt
|
|
6
6
|
Author: PrismShadow
|
|
@@ -13,6 +13,7 @@ Requires-Dist: httpx>=0.27.0
|
|
|
13
13
|
Requires-Dist: httpx[socks] ; extra == 'dev'
|
|
14
14
|
Requires-Dist: pytest>=8.4.2 ; extra == 'dev'
|
|
15
15
|
Requires-Dist: pytest-asyncio>=0.23.0 ; extra == 'dev'
|
|
16
|
+
Requires-Dist: pytest-xdist>=3.6.0 ; extra == 'dev'
|
|
16
17
|
Requires-Dist: ruff>=0.14.3 ; extra == 'dev'
|
|
17
18
|
Requires-Dist: pillow>=10.0.0 ; extra == 'dev'
|
|
18
19
|
Requires-Python: >=3.11
|
|
@@ -68,20 +69,16 @@ Stateless method that requires passing the full message history on each call:
|
|
|
68
69
|
import asyncio
|
|
69
70
|
from agenthub import AutoLLMClient
|
|
70
71
|
|
|
72
|
+
|
|
71
73
|
async def main():
|
|
72
74
|
client = AutoLLMClient(model="gpt-5.5")
|
|
73
75
|
|
|
74
76
|
async for event in client.streaming_response(
|
|
75
|
-
messages=[
|
|
76
|
-
{
|
|
77
|
-
"role": "user",
|
|
78
|
-
"content_items": [{"type": "text", "text": "Hello!"}]
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
config={}
|
|
77
|
+
messages=[{"role": "user", "content_items": [{"type": "text", "text": "Hello!"}]}], config={}
|
|
82
78
|
):
|
|
83
79
|
print(event)
|
|
84
80
|
|
|
81
|
+
|
|
85
82
|
asyncio.run(main())
|
|
86
83
|
```
|
|
87
84
|
|
|
@@ -93,29 +90,23 @@ Stateful method that maintains conversation history internally:
|
|
|
93
90
|
import asyncio
|
|
94
91
|
from agenthub import AutoLLMClient
|
|
95
92
|
|
|
93
|
+
|
|
96
94
|
async def main():
|
|
97
95
|
client = AutoLLMClient(model="gpt-5.5")
|
|
98
96
|
|
|
99
97
|
# First message
|
|
100
98
|
async for event in client.streaming_response_stateful(
|
|
101
|
-
message={
|
|
102
|
-
"role": "user",
|
|
103
|
-
"content_items": [{"type": "text", "text": "My name is Alice"}]
|
|
104
|
-
},
|
|
105
|
-
config={}
|
|
99
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "My name is Alice"}]}, config={}
|
|
106
100
|
):
|
|
107
101
|
print(event)
|
|
108
102
|
|
|
109
103
|
# Second message - history is maintained automatically
|
|
110
104
|
async for event in client.streaming_response_stateful(
|
|
111
|
-
message={
|
|
112
|
-
"role": "user",
|
|
113
|
-
"content_items": [{"type": "text", "text": "What's my name?"}]
|
|
114
|
-
},
|
|
115
|
-
config={}
|
|
105
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "What's my name?"}]}, config={}
|
|
116
106
|
):
|
|
117
107
|
print(event)
|
|
118
108
|
|
|
109
|
+
|
|
119
110
|
asyncio.run(main())
|
|
120
111
|
```
|
|
121
112
|
|
|
@@ -169,10 +160,12 @@ import asyncio
|
|
|
169
160
|
import json
|
|
170
161
|
from agenthub import AutoLLMClient
|
|
171
162
|
|
|
163
|
+
|
|
172
164
|
def get_weather(location: str) -> str:
|
|
173
165
|
"""Mock function to get weather."""
|
|
174
166
|
return f"Temperature in {location}: 22°C"
|
|
175
167
|
|
|
168
|
+
|
|
176
169
|
async def main():
|
|
177
170
|
# Define tool
|
|
178
171
|
weather_function = {
|
|
@@ -180,14 +173,9 @@ async def main():
|
|
|
180
173
|
"description": "Gets the current weather for a given location.",
|
|
181
174
|
"parameters": {
|
|
182
175
|
"type": "object",
|
|
183
|
-
"properties": {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"description": "The city name"
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
"required": ["location"]
|
|
190
|
-
}
|
|
176
|
+
"properties": {"location": {"type": "string", "description": "The city name"}},
|
|
177
|
+
"required": ["location"],
|
|
178
|
+
},
|
|
191
179
|
}
|
|
192
180
|
|
|
193
181
|
client = AutoLLMClient(model="gpt-5.5")
|
|
@@ -196,11 +184,8 @@ async def main():
|
|
|
196
184
|
# User asks about weather
|
|
197
185
|
events = []
|
|
198
186
|
async for event in client.streaming_response_stateful(
|
|
199
|
-
message={
|
|
200
|
-
|
|
201
|
-
"content_items": [{"type": "text", "text": "What's the weather in London?"}]
|
|
202
|
-
},
|
|
203
|
-
config=config
|
|
187
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "What's the weather in London?"}]},
|
|
188
|
+
config=config,
|
|
204
189
|
):
|
|
205
190
|
events.append(event)
|
|
206
191
|
|
|
@@ -227,14 +212,15 @@ async def main():
|
|
|
227
212
|
{
|
|
228
213
|
"type": "tool_result",
|
|
229
214
|
"text": result,
|
|
230
|
-
"tool_call_id": tool_call["tool_call_id"] # Required for tool responses
|
|
215
|
+
"tool_call_id": tool_call["tool_call_id"], # Required for tool responses
|
|
231
216
|
}
|
|
232
|
-
]
|
|
217
|
+
],
|
|
233
218
|
},
|
|
234
|
-
config=config
|
|
219
|
+
config=config,
|
|
235
220
|
):
|
|
236
221
|
print(event)
|
|
237
222
|
|
|
223
|
+
|
|
238
224
|
asyncio.run(main())
|
|
239
225
|
```
|
|
240
226
|
|
|
@@ -248,8 +234,13 @@ asyncio.run(main())
|
|
|
248
234
|
"content_items": [
|
|
249
235
|
{"type": "text", "text": "Hello"},
|
|
250
236
|
{"type": "image_url", "image_url": "https://..."},
|
|
251
|
-
{
|
|
252
|
-
|
|
237
|
+
{
|
|
238
|
+
"type": "tool_call",
|
|
239
|
+
"name": "get_weather",
|
|
240
|
+
"arguments": {"location": "London"},
|
|
241
|
+
"tool_call_id": "call_abc123",
|
|
242
|
+
},
|
|
243
|
+
],
|
|
253
244
|
}
|
|
254
245
|
```
|
|
255
246
|
|
|
@@ -264,9 +255,9 @@ When responding to a tool call, include the `tool_call_id` in the result content
|
|
|
264
255
|
{
|
|
265
256
|
"type": "tool_result",
|
|
266
257
|
"text": "London is 22°C today.",
|
|
267
|
-
"tool_call_id": "call_abc123" # From tool_call event
|
|
258
|
+
"tool_call_id": "call_abc123", # From tool_call event
|
|
268
259
|
}
|
|
269
|
-
]
|
|
260
|
+
],
|
|
270
261
|
}
|
|
271
262
|
```
|
|
272
263
|
|
|
@@ -284,7 +275,7 @@ config = {
|
|
|
284
275
|
"tool_choice": "auto", # "auto", "required", "none", or ["tool_name"]
|
|
285
276
|
"system_prompt": "You are a helpful assistant",
|
|
286
277
|
"prompt_caching": PromptCaching.ENABLE,
|
|
287
|
-
"trace_id": "agent1/conversation_001" # Optional: save conversation trace
|
|
278
|
+
"trace_id": "agent1/conversation_001", # Optional: save conversation trace
|
|
288
279
|
}
|
|
289
280
|
```
|
|
290
281
|
|
|
@@ -303,8 +294,7 @@ client = AutoLLMClient(model="gpt-5.5")
|
|
|
303
294
|
config = {"trace_id": "agent1/conversation_001"}
|
|
304
295
|
|
|
305
296
|
async for event in client.streaming_response_stateful(
|
|
306
|
-
message={"role": "user", "content_items": [{"type": "text", "text": "Hello"}]},
|
|
307
|
-
config=config
|
|
297
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "Hello"}]}, config=config
|
|
308
298
|
):
|
|
309
299
|
pass # Conversation is automatically saved
|
|
310
300
|
```
|
|
@@ -44,20 +44,16 @@ Stateless method that requires passing the full message history on each call:
|
|
|
44
44
|
import asyncio
|
|
45
45
|
from agenthub import AutoLLMClient
|
|
46
46
|
|
|
47
|
+
|
|
47
48
|
async def main():
|
|
48
49
|
client = AutoLLMClient(model="gpt-5.5")
|
|
49
50
|
|
|
50
51
|
async for event in client.streaming_response(
|
|
51
|
-
messages=[
|
|
52
|
-
{
|
|
53
|
-
"role": "user",
|
|
54
|
-
"content_items": [{"type": "text", "text": "Hello!"}]
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
config={}
|
|
52
|
+
messages=[{"role": "user", "content_items": [{"type": "text", "text": "Hello!"}]}], config={}
|
|
58
53
|
):
|
|
59
54
|
print(event)
|
|
60
55
|
|
|
56
|
+
|
|
61
57
|
asyncio.run(main())
|
|
62
58
|
```
|
|
63
59
|
|
|
@@ -69,29 +65,23 @@ Stateful method that maintains conversation history internally:
|
|
|
69
65
|
import asyncio
|
|
70
66
|
from agenthub import AutoLLMClient
|
|
71
67
|
|
|
68
|
+
|
|
72
69
|
async def main():
|
|
73
70
|
client = AutoLLMClient(model="gpt-5.5")
|
|
74
71
|
|
|
75
72
|
# First message
|
|
76
73
|
async for event in client.streaming_response_stateful(
|
|
77
|
-
message={
|
|
78
|
-
"role": "user",
|
|
79
|
-
"content_items": [{"type": "text", "text": "My name is Alice"}]
|
|
80
|
-
},
|
|
81
|
-
config={}
|
|
74
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "My name is Alice"}]}, config={}
|
|
82
75
|
):
|
|
83
76
|
print(event)
|
|
84
77
|
|
|
85
78
|
# Second message - history is maintained automatically
|
|
86
79
|
async for event in client.streaming_response_stateful(
|
|
87
|
-
message={
|
|
88
|
-
"role": "user",
|
|
89
|
-
"content_items": [{"type": "text", "text": "What's my name?"}]
|
|
90
|
-
},
|
|
91
|
-
config={}
|
|
80
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "What's my name?"}]}, config={}
|
|
92
81
|
):
|
|
93
82
|
print(event)
|
|
94
83
|
|
|
84
|
+
|
|
95
85
|
asyncio.run(main())
|
|
96
86
|
```
|
|
97
87
|
|
|
@@ -145,10 +135,12 @@ import asyncio
|
|
|
145
135
|
import json
|
|
146
136
|
from agenthub import AutoLLMClient
|
|
147
137
|
|
|
138
|
+
|
|
148
139
|
def get_weather(location: str) -> str:
|
|
149
140
|
"""Mock function to get weather."""
|
|
150
141
|
return f"Temperature in {location}: 22°C"
|
|
151
142
|
|
|
143
|
+
|
|
152
144
|
async def main():
|
|
153
145
|
# Define tool
|
|
154
146
|
weather_function = {
|
|
@@ -156,14 +148,9 @@ async def main():
|
|
|
156
148
|
"description": "Gets the current weather for a given location.",
|
|
157
149
|
"parameters": {
|
|
158
150
|
"type": "object",
|
|
159
|
-
"properties": {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"description": "The city name"
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
"required": ["location"]
|
|
166
|
-
}
|
|
151
|
+
"properties": {"location": {"type": "string", "description": "The city name"}},
|
|
152
|
+
"required": ["location"],
|
|
153
|
+
},
|
|
167
154
|
}
|
|
168
155
|
|
|
169
156
|
client = AutoLLMClient(model="gpt-5.5")
|
|
@@ -172,11 +159,8 @@ async def main():
|
|
|
172
159
|
# User asks about weather
|
|
173
160
|
events = []
|
|
174
161
|
async for event in client.streaming_response_stateful(
|
|
175
|
-
message={
|
|
176
|
-
|
|
177
|
-
"content_items": [{"type": "text", "text": "What's the weather in London?"}]
|
|
178
|
-
},
|
|
179
|
-
config=config
|
|
162
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "What's the weather in London?"}]},
|
|
163
|
+
config=config,
|
|
180
164
|
):
|
|
181
165
|
events.append(event)
|
|
182
166
|
|
|
@@ -203,14 +187,15 @@ async def main():
|
|
|
203
187
|
{
|
|
204
188
|
"type": "tool_result",
|
|
205
189
|
"text": result,
|
|
206
|
-
"tool_call_id": tool_call["tool_call_id"] # Required for tool responses
|
|
190
|
+
"tool_call_id": tool_call["tool_call_id"], # Required for tool responses
|
|
207
191
|
}
|
|
208
|
-
]
|
|
192
|
+
],
|
|
209
193
|
},
|
|
210
|
-
config=config
|
|
194
|
+
config=config,
|
|
211
195
|
):
|
|
212
196
|
print(event)
|
|
213
197
|
|
|
198
|
+
|
|
214
199
|
asyncio.run(main())
|
|
215
200
|
```
|
|
216
201
|
|
|
@@ -224,8 +209,13 @@ asyncio.run(main())
|
|
|
224
209
|
"content_items": [
|
|
225
210
|
{"type": "text", "text": "Hello"},
|
|
226
211
|
{"type": "image_url", "image_url": "https://..."},
|
|
227
|
-
{
|
|
228
|
-
|
|
212
|
+
{
|
|
213
|
+
"type": "tool_call",
|
|
214
|
+
"name": "get_weather",
|
|
215
|
+
"arguments": {"location": "London"},
|
|
216
|
+
"tool_call_id": "call_abc123",
|
|
217
|
+
},
|
|
218
|
+
],
|
|
229
219
|
}
|
|
230
220
|
```
|
|
231
221
|
|
|
@@ -240,9 +230,9 @@ When responding to a tool call, include the `tool_call_id` in the result content
|
|
|
240
230
|
{
|
|
241
231
|
"type": "tool_result",
|
|
242
232
|
"text": "London is 22°C today.",
|
|
243
|
-
"tool_call_id": "call_abc123" # From tool_call event
|
|
233
|
+
"tool_call_id": "call_abc123", # From tool_call event
|
|
244
234
|
}
|
|
245
|
-
]
|
|
235
|
+
],
|
|
246
236
|
}
|
|
247
237
|
```
|
|
248
238
|
|
|
@@ -260,7 +250,7 @@ config = {
|
|
|
260
250
|
"tool_choice": "auto", # "auto", "required", "none", or ["tool_name"]
|
|
261
251
|
"system_prompt": "You are a helpful assistant",
|
|
262
252
|
"prompt_caching": PromptCaching.ENABLE,
|
|
263
|
-
"trace_id": "agent1/conversation_001" # Optional: save conversation trace
|
|
253
|
+
"trace_id": "agent1/conversation_001", # Optional: save conversation trace
|
|
264
254
|
}
|
|
265
255
|
```
|
|
266
256
|
|
|
@@ -279,8 +269,7 @@ client = AutoLLMClient(model="gpt-5.5")
|
|
|
279
269
|
config = {"trace_id": "agent1/conversation_001"}
|
|
280
270
|
|
|
281
271
|
async for event in client.streaming_response_stateful(
|
|
282
|
-
message={"role": "user", "content_items": [{"type": "text", "text": "Hello"}]},
|
|
283
|
-
config=config
|
|
272
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "Hello"}]}, config=config
|
|
284
273
|
):
|
|
285
274
|
pass # Conversation is automatically saved
|
|
286
275
|
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright 2025 Prism Shadow. and/or its affiliates
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from .client import AntMessagesClient
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
__all__ = ["AntMessagesClient"]
|