agenthub-python 0.4.12__tar.gz → 0.4.14__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 (39) hide show
  1. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/PKG-INFO +1 -1
  2. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/deepseek_v4/client.py +10 -3
  3. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/gpt6/client.py +10 -3
  4. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/openai_chat/client.py +16 -3
  5. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/pyproject.toml +1 -1
  6. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/pyproject.toml.orig +1 -1
  7. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/README.md +0 -0
  8. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/__init__.py +0 -0
  9. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/abort_signal.py +0 -0
  10. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/ant_messages/__init__.py +0 -0
  11. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/ant_messages/client.py +0 -0
  12. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/auto_client.py +0 -0
  13. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/base_client.py +0 -0
  14. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/claude5/__init__.py +0 -0
  15. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/claude5/client.py +0 -0
  16. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/deepseek_v4/__init__.py +0 -0
  17. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/errors.py +0 -0
  18. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/gemini3_8/__init__.py +0 -0
  19. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/gemini3_8/client.py +0 -0
  20. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/glm5_3/__init__.py +0 -0
  21. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/glm5_3/client.py +0 -0
  22. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/gpt6/__init__.py +0 -0
  23. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/integration/__init__.py +0 -0
  24. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/integration/playground.py +0 -0
  25. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/integration/tracer.py +0 -0
  26. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/kimi_k3/__init__.py +0 -0
  27. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/kimi_k3/client.py +0 -0
  28. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/minimax_m3/__init__.py +0 -0
  29. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/minimax_m3/client.py +0 -0
  30. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/openai_chat/__init__.py +0 -0
  31. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/openai_chat_vllm_adapter/__init__.py +0 -0
  32. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/openai_chat_vllm_adapter/client.py +0 -0
  33. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/openai_embedding/__init__.py +0 -0
  34. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/openai_embedding/client.py +0 -0
  35. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/openai_responses/__init__.py +0 -0
  36. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/openai_responses/client.py +0 -0
  37. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/registry.py +0 -0
  38. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/types.py +0 -0
  39. {agenthub_python-0.4.12 → agenthub_python-0.4.14}/agenthub/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agenthub-python
3
- Version: 0.4.12
3
+ Version: 0.4.14
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
@@ -201,16 +201,23 @@ class DeepSeekV4Client(LLMClient):
201
201
  raise ValueError("tool_call_id is required for tool result.")
202
202
 
203
203
  # NOTE: tool results are input items
204
- tool_result = [{"type": "input_text", "text": item["text"]}]
204
+ image_parts = []
205
205
  if "images" in item:
206
206
  if not supports_image:
207
207
  raise ValueError(f"DeepSeek {self._model} does not support images in tool results.")
208
208
 
209
209
  for image_url in item["images"]:
210
- tool_result.append({"type": "input_image", "image_url": image_url})
210
+ image_parts.append({"type": "input_image", "image_url": image_url})
211
+
212
+ # a plain string is the form the Responses API documents for a text result and the
213
+ # one every endpoint that fronts this model accepts; the content-part list is
214
+ # reserved for results carrying images
215
+ output = (
216
+ [{"type": "input_text", "text": item["text"]}, *image_parts] if image_parts else item["text"]
217
+ )
211
218
 
212
219
  input_list.append(
213
- {"type": "function_call_output", "call_id": item["tool_call_id"], "output": tool_result}
220
+ {"type": "function_call_output", "call_id": item["tool_call_id"], "output": output}
214
221
  )
215
222
  else:
216
223
  raise ValueError(f"Unknown item: {item}")
@@ -212,13 +212,20 @@ class GPT6Client(LLMClient):
212
212
  raise ValueError("tool_call_id is required for tool result.")
213
213
 
214
214
  # NOTE: tool results are input items
215
- tool_result = [{"type": "input_text", "text": item["text"]}]
215
+ image_parts = []
216
216
  if "images" in item:
217
217
  for image_url in item["images"]:
218
- tool_result.append(self._convert_image_url(image_url))
218
+ image_parts.append(self._convert_image_url(image_url))
219
+
220
+ # a plain string is the form the Responses API documents for a text result and the
221
+ # one every endpoint that fronts this model accepts; the content-part list is
222
+ # reserved for results carrying images
223
+ output = (
224
+ [{"type": "input_text", "text": item["text"]}, *image_parts] if image_parts else item["text"]
225
+ )
219
226
 
220
227
  input_list.append(
221
- {"type": "function_call_output", "call_id": item["tool_call_id"], "output": tool_result}
228
+ {"type": "function_call_output", "call_id": item["tool_call_id"], "output": output}
222
229
  )
223
230
  else:
224
231
  raise ValueError(f"Unknown item: {item}")
@@ -143,6 +143,14 @@ class OpenaiChatClient(LLMClient):
143
143
  List of OpenAI Chat Completions message dictionaries
144
144
  """
145
145
  openai_messages = []
146
+ # The reasoning field this upstream has produced so far, if any. A turn the model
147
+ # answered without thinking still has to carry that field, empty, when it made tool
148
+ # calls: DeepSeek stops thinking part-way through a long tool chain, and then rejects
149
+ # the replay of that turn with "the reasoning_content in the thinking mode must be
150
+ # passed back to the API". It waives that only for tool_call ids it issued itself,
151
+ # which a relay that reissues ids takes away. A conversation that never produced a
152
+ # reasoning field never receives one.
153
+ replay_fields: set[str | None] = set()
146
154
 
147
155
  for msg in messages:
148
156
  content_parts = [] # may be empty for tool results
@@ -158,6 +166,8 @@ class OpenaiChatClient(LLMClient):
158
166
  elif item["type"] == "thinking":
159
167
  thinking += item["thinking"]
160
168
  thinking_fields.add((item.get("fidelity") or {}).get("reasoning_field"))
169
+ if item["thinking"]:
170
+ replay_fields.add((item.get("fidelity") or {}).get("reasoning_field"))
161
171
  elif item["type"] == "tool_call":
162
172
  tool_calls.append(
163
173
  {
@@ -201,12 +211,15 @@ class OpenaiChatClient(LLMClient):
201
211
  if tool_calls:
202
212
  message["tool_calls"] = tool_calls
203
213
 
204
- if thinking:
214
+ # This turn's own fidelity when it thought; otherwise the field the upstream has
215
+ # produced, with `thinking` still "" — the empty value keeps the turn replayable.
216
+ fields = thinking_fields if thinking else replay_fields
217
+ if thinking or (tool_calls and replay_fields):
205
218
  # send thinking back through the exact field the upstream produced (recorded
206
219
  # in the item fidelity); servers may reject the spelling they did not emit
207
- if thinking_fields == {"reasoning_content"}:
220
+ if fields == {"reasoning_content"}:
208
221
  message["reasoning_content"] = thinking
209
- elif thinking_fields == {"reasoning"}:
222
+ elif fields == {"reasoning"}:
210
223
  message["reasoning"] = thinking
211
224
  else:
212
225
  message["reasoning_content"] = thinking # vLLM & siliconflow compatibility
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agenthub-python"
3
- version = "0.4.12"
3
+ version = "0.4.14"
4
4
  description = "AgentHub is the LLM API Hub for the Agent era, built for high-precision autonomous agents."
5
5
  keywords = [
6
6
  "agent",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agenthub-python"
3
- version = "0.4.12"
3
+ version = "0.4.14"
4
4
  description = "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
  readme = "README.md"