mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-05 02:31:47 +00:00
fix(gemini): pass base_url into chat transport
This commit is contained in:
parent
c5a5e586d7
commit
2e991770fc
2 changed files with 31 additions and 0 deletions
|
|
@ -8266,6 +8266,7 @@ class AIAgent:
|
||||||
model=self.model,
|
model=self.model,
|
||||||
messages=_msgs_for_chat,
|
messages=_msgs_for_chat,
|
||||||
tools=self.tools,
|
tools=self.tools,
|
||||||
|
base_url=self.base_url,
|
||||||
timeout=self._resolved_api_call_timeout(),
|
timeout=self._resolved_api_call_timeout(),
|
||||||
max_tokens=self.max_tokens,
|
max_tokens=self.max_tokens,
|
||||||
ephemeral_max_output_tokens=_ephemeral_out,
|
ephemeral_max_output_tokens=_ephemeral_out,
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,36 @@ class TestBuildApiKwargsOpenRouter:
|
||||||
assert messages[1]["tool_calls"][0]["response_item_id"] == "fc_123"
|
assert messages[1]["tool_calls"][0]["response_item_id"] == "fc_123"
|
||||||
assert "codex_reasoning_items" in messages[1]
|
assert "codex_reasoning_items" in messages[1]
|
||||||
|
|
||||||
|
def test_gemini_native_passes_base_url_for_top_level_thinking_config(self, monkeypatch):
|
||||||
|
agent = _make_agent(
|
||||||
|
monkeypatch,
|
||||||
|
"gemini",
|
||||||
|
base_url="https://generativelanguage.googleapis.com/v1beta",
|
||||||
|
model="gemini-3-flash-preview",
|
||||||
|
)
|
||||||
|
agent.reasoning_config = {"enabled": True, "effort": "high"}
|
||||||
|
kwargs = agent._build_api_kwargs([{"role": "user", "content": "hi"}])
|
||||||
|
assert kwargs["extra_body"]["thinking_config"] == {
|
||||||
|
"includeThoughts": True,
|
||||||
|
"thinkingLevel": "high",
|
||||||
|
}
|
||||||
|
assert "extra_body" not in kwargs["extra_body"]
|
||||||
|
|
||||||
|
def test_gemini_openai_compat_passes_base_url_for_nested_google_thinking_config(self, monkeypatch):
|
||||||
|
agent = _make_agent(
|
||||||
|
monkeypatch,
|
||||||
|
"gemini",
|
||||||
|
base_url="https://generativelanguage.googleapis.com/v1beta/openai",
|
||||||
|
model="gemini-3.1-pro-preview",
|
||||||
|
)
|
||||||
|
agent.reasoning_config = {"enabled": True, "effort": "high"}
|
||||||
|
kwargs = agent._build_api_kwargs([{"role": "user", "content": "hi"}])
|
||||||
|
assert "thinking_config" not in kwargs["extra_body"]
|
||||||
|
assert kwargs["extra_body"]["extra_body"]["google"]["thinking_config"] == {
|
||||||
|
"include_thoughts": True,
|
||||||
|
"thinking_level": "high",
|
||||||
|
}
|
||||||
|
|
||||||
def test_should_sanitize_tool_calls_codex_vs_chat(self, monkeypatch):
|
def test_should_sanitize_tool_calls_codex_vs_chat(self, monkeypatch):
|
||||||
"""Codex API should NOT sanitize, all other APIs should sanitize."""
|
"""Codex API should NOT sanitize, all other APIs should sanitize."""
|
||||||
# Codex mode should NOT need sanitization
|
# Codex mode should NOT need sanitization
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue