mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
fix: strip image parts for non-vision models with provider profiles + getattr-safe _custom_providers
Original commit75e5d0f6bby hueilau targeted _build_api_kwargs in pre-refactor run_agent.py. The body now lives in agent/chat_completion_helpers.build_api_kwargs — re-applied there. Also: switch the custom_providers forward (from21078ebce) to use getattr() — tests build a bare AIAgent via __new__ and would otherwise hit AttributeError on _custom_providers. Co-authored-by: hueilau <33933019+hueilau@users.noreply.github.com>
This commit is contained in:
parent
36ad8336f9
commit
563b4d9e51
1 changed files with 6 additions and 1 deletions
|
|
@ -377,6 +377,11 @@ def build_api_kwargs(agent, api_messages: list) -> dict:
|
|||
if _ephemeral_out is not None:
|
||||
agent._ephemeral_max_output_tokens = None
|
||||
|
||||
# Strip image parts for non-vision models that have provider profiles
|
||||
# (e.g. DeepSeek, Kimi). The legacy path below already does this, but
|
||||
# registered providers with profiles were bypassing the strip.
|
||||
api_messages = agent._prepare_messages_for_non_vision_model(api_messages)
|
||||
|
||||
return _ct.build_kwargs(
|
||||
model=agent.model,
|
||||
messages=api_messages,
|
||||
|
|
@ -850,7 +855,7 @@ def try_activate_fallback(agent, reason: "FailoverReason | None" = None) -> bool
|
|||
agent.model, base_url=agent.base_url,
|
||||
api_key=agent.api_key, provider=agent.provider,
|
||||
config_context_length=getattr(agent, "_config_context_length", None),
|
||||
custom_providers=agent._custom_providers,
|
||||
custom_providers=getattr(agent, "_custom_providers", None),
|
||||
)
|
||||
agent.context_compressor.update_model(
|
||||
model=agent.model,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue