agenthub-python 0.4.0__tar.gz → 0.4.2__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.0 → agenthub_python-0.4.2}/PKG-INFO +30 -41
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/README.md +29 -40
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/__init__.py +8 -1
- agenthub_python-0.4.2/agenthub/ant_messages/__init__.py +18 -0
- {agenthub_python-0.4.0/agenthub/claude4_6 → agenthub_python-0.4.2/agenthub/ant_messages}/client.py +117 -146
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/auto_client.py +37 -23
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/claude5/client.py +30 -5
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/deepseek_v4/client.py +15 -4
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/errors.py +14 -0
- {agenthub_python-0.4.0/agenthub/claude4_6 → agenthub_python-0.4.2/agenthub/gemini3_7}/__init__.py +2 -2
- {agenthub_python-0.4.0/agenthub/gemini3 → agenthub_python-0.4.2/agenthub/gemini3_7}/client.py +103 -16
- {agenthub_python-0.4.0/agenthub/gpt5_5 → agenthub_python-0.4.2/agenthub/glm5_3}/__init__.py +2 -2
- {agenthub_python-0.4.0/agenthub/glm5_1 → agenthub_python-0.4.2/agenthub/glm5_3}/client.py +61 -15
- {agenthub_python-0.4.0/agenthub/openai → agenthub_python-0.4.2/agenthub/gpt5_6}/__init__.py +2 -2
- {agenthub_python-0.4.0/agenthub/gpt5_5 → agenthub_python-0.4.2/agenthub/gpt5_6}/client.py +54 -38
- {agenthub_python-0.4.0/agenthub/glm5_1 → agenthub_python-0.4.2/agenthub/kimi_k3}/__init__.py +2 -2
- {agenthub_python-0.4.0/agenthub/kimi_k2_6 → agenthub_python-0.4.2/agenthub/kimi_k3}/client.py +51 -14
- {agenthub_python-0.4.0/agenthub/gemini3 → agenthub_python-0.4.2/agenthub/minimax_m3}/__init__.py +2 -2
- agenthub_python-0.4.2/agenthub/minimax_m3/client.py +315 -0
- agenthub_python-0.4.2/agenthub/openai_chat/__init__.py +18 -0
- {agenthub_python-0.4.0/agenthub/openai → agenthub_python-0.4.2/agenthub/openai_chat}/client.py +8 -3
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/openai_embedding/client.py +6 -0
- agenthub_python-0.4.2/agenthub/openai_responses/__init__.py +18 -0
- agenthub_python-0.4.2/agenthub/openai_responses/client.py +374 -0
- agenthub_python-0.4.2/agenthub/registry.py +635 -0
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/types.py +3 -0
- agenthub_python-0.4.2/pyproject.toml +85 -0
- agenthub_python-0.4.0/pyproject.toml → agenthub_python-0.4.2/pyproject.toml.orig +1 -1
- agenthub_python-0.4.0/agenthub/kimi_k2_6/__init__.py +0 -18
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/abort_signal.py +0 -0
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/base_client.py +0 -0
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/claude5/__init__.py +0 -0
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/deepseek_v4/__init__.py +0 -0
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/integration/__init__.py +0 -0
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/integration/playground.py +0 -0
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/integration/tracer.py +0 -0
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/agenthub/openai_embedding/__init__.py +0 -0
- {agenthub_python-0.4.0 → agenthub_python-0.4.2}/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.2
|
|
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
|
|
@@ -68,20 +68,16 @@ Stateless method that requires passing the full message history on each call:
|
|
|
68
68
|
import asyncio
|
|
69
69
|
from agenthub import AutoLLMClient
|
|
70
70
|
|
|
71
|
+
|
|
71
72
|
async def main():
|
|
72
73
|
client = AutoLLMClient(model="gpt-5.5")
|
|
73
74
|
|
|
74
75
|
async for event in client.streaming_response(
|
|
75
|
-
messages=[
|
|
76
|
-
{
|
|
77
|
-
"role": "user",
|
|
78
|
-
"content_items": [{"type": "text", "text": "Hello!"}]
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
config={}
|
|
76
|
+
messages=[{"role": "user", "content_items": [{"type": "text", "text": "Hello!"}]}], config={}
|
|
82
77
|
):
|
|
83
78
|
print(event)
|
|
84
79
|
|
|
80
|
+
|
|
85
81
|
asyncio.run(main())
|
|
86
82
|
```
|
|
87
83
|
|
|
@@ -93,29 +89,23 @@ Stateful method that maintains conversation history internally:
|
|
|
93
89
|
import asyncio
|
|
94
90
|
from agenthub import AutoLLMClient
|
|
95
91
|
|
|
92
|
+
|
|
96
93
|
async def main():
|
|
97
94
|
client = AutoLLMClient(model="gpt-5.5")
|
|
98
95
|
|
|
99
96
|
# First message
|
|
100
97
|
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={}
|
|
98
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "My name is Alice"}]}, config={}
|
|
106
99
|
):
|
|
107
100
|
print(event)
|
|
108
101
|
|
|
109
102
|
# Second message - history is maintained automatically
|
|
110
103
|
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={}
|
|
104
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "What's my name?"}]}, config={}
|
|
116
105
|
):
|
|
117
106
|
print(event)
|
|
118
107
|
|
|
108
|
+
|
|
119
109
|
asyncio.run(main())
|
|
120
110
|
```
|
|
121
111
|
|
|
@@ -169,10 +159,12 @@ import asyncio
|
|
|
169
159
|
import json
|
|
170
160
|
from agenthub import AutoLLMClient
|
|
171
161
|
|
|
162
|
+
|
|
172
163
|
def get_weather(location: str) -> str:
|
|
173
164
|
"""Mock function to get weather."""
|
|
174
165
|
return f"Temperature in {location}: 22°C"
|
|
175
166
|
|
|
167
|
+
|
|
176
168
|
async def main():
|
|
177
169
|
# Define tool
|
|
178
170
|
weather_function = {
|
|
@@ -180,14 +172,9 @@ async def main():
|
|
|
180
172
|
"description": "Gets the current weather for a given location.",
|
|
181
173
|
"parameters": {
|
|
182
174
|
"type": "object",
|
|
183
|
-
"properties": {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"description": "The city name"
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
"required": ["location"]
|
|
190
|
-
}
|
|
175
|
+
"properties": {"location": {"type": "string", "description": "The city name"}},
|
|
176
|
+
"required": ["location"],
|
|
177
|
+
},
|
|
191
178
|
}
|
|
192
179
|
|
|
193
180
|
client = AutoLLMClient(model="gpt-5.5")
|
|
@@ -196,11 +183,8 @@ async def main():
|
|
|
196
183
|
# User asks about weather
|
|
197
184
|
events = []
|
|
198
185
|
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
|
|
186
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "What's the weather in London?"}]},
|
|
187
|
+
config=config,
|
|
204
188
|
):
|
|
205
189
|
events.append(event)
|
|
206
190
|
|
|
@@ -227,14 +211,15 @@ async def main():
|
|
|
227
211
|
{
|
|
228
212
|
"type": "tool_result",
|
|
229
213
|
"text": result,
|
|
230
|
-
"tool_call_id": tool_call["tool_call_id"] # Required for tool responses
|
|
214
|
+
"tool_call_id": tool_call["tool_call_id"], # Required for tool responses
|
|
231
215
|
}
|
|
232
|
-
]
|
|
216
|
+
],
|
|
233
217
|
},
|
|
234
|
-
config=config
|
|
218
|
+
config=config,
|
|
235
219
|
):
|
|
236
220
|
print(event)
|
|
237
221
|
|
|
222
|
+
|
|
238
223
|
asyncio.run(main())
|
|
239
224
|
```
|
|
240
225
|
|
|
@@ -248,8 +233,13 @@ asyncio.run(main())
|
|
|
248
233
|
"content_items": [
|
|
249
234
|
{"type": "text", "text": "Hello"},
|
|
250
235
|
{"type": "image_url", "image_url": "https://..."},
|
|
251
|
-
{
|
|
252
|
-
|
|
236
|
+
{
|
|
237
|
+
"type": "tool_call",
|
|
238
|
+
"name": "get_weather",
|
|
239
|
+
"arguments": {"location": "London"},
|
|
240
|
+
"tool_call_id": "call_abc123",
|
|
241
|
+
},
|
|
242
|
+
],
|
|
253
243
|
}
|
|
254
244
|
```
|
|
255
245
|
|
|
@@ -264,9 +254,9 @@ When responding to a tool call, include the `tool_call_id` in the result content
|
|
|
264
254
|
{
|
|
265
255
|
"type": "tool_result",
|
|
266
256
|
"text": "London is 22°C today.",
|
|
267
|
-
"tool_call_id": "call_abc123" # From tool_call event
|
|
257
|
+
"tool_call_id": "call_abc123", # From tool_call event
|
|
268
258
|
}
|
|
269
|
-
]
|
|
259
|
+
],
|
|
270
260
|
}
|
|
271
261
|
```
|
|
272
262
|
|
|
@@ -284,7 +274,7 @@ config = {
|
|
|
284
274
|
"tool_choice": "auto", # "auto", "required", "none", or ["tool_name"]
|
|
285
275
|
"system_prompt": "You are a helpful assistant",
|
|
286
276
|
"prompt_caching": PromptCaching.ENABLE,
|
|
287
|
-
"trace_id": "agent1/conversation_001" # Optional: save conversation trace
|
|
277
|
+
"trace_id": "agent1/conversation_001", # Optional: save conversation trace
|
|
288
278
|
}
|
|
289
279
|
```
|
|
290
280
|
|
|
@@ -303,8 +293,7 @@ client = AutoLLMClient(model="gpt-5.5")
|
|
|
303
293
|
config = {"trace_id": "agent1/conversation_001"}
|
|
304
294
|
|
|
305
295
|
async for event in client.streaming_response_stateful(
|
|
306
|
-
message={"role": "user", "content_items": [{"type": "text", "text": "Hello"}]},
|
|
307
|
-
config=config
|
|
296
|
+
message={"role": "user", "content_items": [{"type": "text", "text": "Hello"}]}, config=config
|
|
308
297
|
):
|
|
309
298
|
pass # Conversation is automatically saved
|
|
310
299
|
```
|
|
@@ -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
|
```
|
|
@@ -13,15 +13,22 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
from .auto_client import AutoLLMClient
|
|
16
|
-
from .errors import AgentHubError, EmptyResponseError, ToolCallArgumentParseError
|
|
16
|
+
from .errors import AgentHubError, EmptyResponseError, ToolCallArgumentParseError, UnsupportedParameterError
|
|
17
|
+
from .registry import Currency, Modality, ModelPricing, SupportedModel, list_supported_models
|
|
17
18
|
from .types import PromptCaching, ThinkingLevel
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
__all__ = [
|
|
21
22
|
"AgentHubError",
|
|
22
23
|
"AutoLLMClient",
|
|
24
|
+
"Currency",
|
|
23
25
|
"EmptyResponseError",
|
|
26
|
+
"Modality",
|
|
27
|
+
"ModelPricing",
|
|
24
28
|
"PromptCaching",
|
|
29
|
+
"SupportedModel",
|
|
25
30
|
"ThinkingLevel",
|
|
26
31
|
"ToolCallArgumentParseError",
|
|
32
|
+
"UnsupportedParameterError",
|
|
33
|
+
"list_supported_models",
|
|
27
34
|
]
|
|
@@ -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"]
|