agenthub-python 0.4.6__tar.gz → 0.4.7__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 (37) hide show
  1. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/PKG-INFO +1 -1
  2. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/gemini3_7/client.py +26 -1
  3. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/pyproject.toml +1 -1
  4. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/pyproject.toml.orig +1 -1
  5. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/README.md +0 -0
  6. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/__init__.py +0 -0
  7. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/abort_signal.py +0 -0
  8. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/ant_messages/__init__.py +0 -0
  9. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/ant_messages/client.py +0 -0
  10. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/auto_client.py +0 -0
  11. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/base_client.py +0 -0
  12. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/claude5/__init__.py +0 -0
  13. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/claude5/client.py +0 -0
  14. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/deepseek_v4/__init__.py +0 -0
  15. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/deepseek_v4/client.py +0 -0
  16. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/errors.py +0 -0
  17. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/gemini3_7/__init__.py +0 -0
  18. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/glm5_3/__init__.py +0 -0
  19. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/glm5_3/client.py +0 -0
  20. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/gpt5_6/__init__.py +0 -0
  21. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/gpt5_6/client.py +0 -0
  22. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/integration/__init__.py +0 -0
  23. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/integration/playground.py +0 -0
  24. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/integration/tracer.py +0 -0
  25. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/kimi_k3/__init__.py +0 -0
  26. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/kimi_k3/client.py +0 -0
  27. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/minimax_m3/__init__.py +0 -0
  28. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/minimax_m3/client.py +0 -0
  29. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/openai_chat/__init__.py +0 -0
  30. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/openai_chat/client.py +0 -0
  31. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/openai_embedding/__init__.py +0 -0
  32. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/openai_embedding/client.py +0 -0
  33. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/openai_responses/__init__.py +0 -0
  34. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/openai_responses/client.py +0 -0
  35. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/registry.py +0 -0
  36. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/types.py +0 -0
  37. {agenthub_python-0.4.6 → agenthub_python-0.4.7}/agenthub/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agenthub-python
3
- Version: 0.4.6
3
+ Version: 0.4.7
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
@@ -43,6 +43,24 @@ from ..types import (
43
43
  from ..utils import is_debug_enabled
44
44
 
45
45
 
46
+ def _split_function_response_runs(parts: list[types.Part]) -> list[list[types.Part]]:
47
+ """Split parts into consecutive runs of function_response and other parts.
48
+
49
+ Vertex AI requires function responses to sit in a content of their own (see the call
50
+ site); order is preserved, and a message without function responses — or with nothing
51
+ else — comes back as one run.
52
+ """
53
+ runs: list[list[types.Part]] = []
54
+ last_is_response: bool | None = None
55
+ for part in parts:
56
+ is_response = part.function_response is not None
57
+ if is_response != last_is_response:
58
+ runs.append([])
59
+ last_is_response = is_response
60
+ runs[-1].append(part)
61
+ return runs if runs else [parts]
62
+
63
+
46
64
  class Gemini3_7Client(LLMClient):
47
65
  """Unified client for the Gemini family, named for the newest generation it serves (3.7).
48
66
 
@@ -377,7 +395,14 @@ class Gemini3_7Client(LLMClient):
377
395
  else:
378
396
  raise ValueError(f"Unknown item: {item}")
379
397
 
380
- contents.append(types.Content(role=mapping[msg["role"]], parts=parts))
398
+ # Vertex AI rejects a content that mixes function_response parts with any other
399
+ # part kind — the request fails with a misleading 400, "Requests ending with a
400
+ # model turn are not supported" (the Gemini API endpoint accepts the mix). Split
401
+ # such a message into consecutive same-role contents: each run of function
402
+ # responses becomes its own content, the surrounding parts keep theirs, and the
403
+ # part order is preserved. Homogeneous messages stay a single content.
404
+ for run_parts in _split_function_response_runs(parts):
405
+ contents.append(types.Content(role=mapping[msg["role"]], parts=run_parts))
381
406
 
382
407
  return contents
383
408
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agenthub-python"
3
- version = "0.4.6"
3
+ version = "0.4.7"
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.6"
3
+ version = "0.4.7"
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"