mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
feat(providers): extend request_timeout_seconds to all client paths
Follow-up on top of mvanhorn's cherry-picked commit. Original PR only wired request_timeout_seconds into the explicit-creds OpenAI branch at run_agent.py init; router-based implicit auth, native Anthropic, and the fallback chain were still hardcoded to SDK defaults. - agent/anthropic_adapter.py: build_anthropic_client() accepts an optional timeout kwarg (default 900s preserved when unset/invalid). - run_agent.py: resolve per-provider/per-model timeout once at init; apply to Anthropic native init + post-refresh rebuild + stale/interrupt rebuilds + switch_model + _restore_primary_runtime + the OpenAI implicit-auth path + _try_activate_fallback (with immediate client rebuild so the first fallback request carries the configured timeout). - tests: cover anthropic adapter kwarg honoring; widen mock signatures to accept the new timeout kwarg. - docs/example: clarify that the knob now applies to every transport, the fallback chain, and rebuilds after credential rotation.
This commit is contained in:
parent
3143d32330
commit
f1fe29d1c3
9 changed files with 81 additions and 13 deletions
|
|
@ -214,7 +214,7 @@ class TestAgentSwitchModelDefenseInDepth:
|
|||
# client factory.
|
||||
captured = {}
|
||||
|
||||
def _fake_build_anthropic_client(api_key, base_url):
|
||||
def _fake_build_anthropic_client(api_key, base_url, **kwargs):
|
||||
captured["api_key"] = api_key
|
||||
captured["base_url"] = base_url
|
||||
return object() # placeholder client — no real calls expected
|
||||
|
|
@ -226,7 +226,7 @@ class TestAgentSwitchModelDefenseInDepth:
|
|||
class _Sentinel(Exception):
|
||||
pass
|
||||
|
||||
def _raise_after_capture(api_key, base_url):
|
||||
def _raise_after_capture(api_key, base_url, **kwargs):
|
||||
captured["api_key"] = api_key
|
||||
captured["base_url"] = base_url
|
||||
raise _Sentinel("strip verified")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue