fix(models): route image input by preset capability (#6651)
* fix(providers): preserve images across retries and recovery Remove destructive text-only retries and validate tool image media at the boundary. Keep image identity across native transport preparation and compaction, and stop incomplete fallback or continuation without replaying tools. Resolves NAN-442 * fix(models): route image input by preset capability Replace the expanded image recovery and tool-format changes with an explicit supportsImages preset setting, capability-aware fallback selection, and an Image input switch in model settings. Keep original messages on retry and fail on actual non-transient image errors. * docs(models): introduce image input settings positively * test(agent): align image request fixtures with preset routing Cover successful image requests and direct validation errors when attributing model responses. Configure the image-capability check for the existing text-only provider mocks so governance and override-reuse tests exercise their scripted primary/fallback paths.
This commit is contained in:
1 parent
6a24b17629
commit
3f65a8f86c
36 files changed
+483
-444
No files matched your search
@@ -718,6 +718,7 @@ class OpenAICompatProvider(LLMProvider):
|
||||
clean["tool_call_id"] = map_tool_result_id(clean["tool_call_id"])
|
||||
if (
|
||||
force_string_content
|
||||
and not self._contains_image_content(clean.get("content"))
|
||||
and not (clean.get("role") == "assistant" and clean.get("tool_calls"))
|
||||
):
|
||||
clean["content"] = self._coerce_content_to_string(clean.get("content"))
|
||||
@@ -1777,18 +1778,6 @@ class OpenAICompatProvider(LLMProvider):
|
||||
except Exception as e:
|
||||
return self._handle_error(e, spec=self._spec, api_base=self.api_base)
|
||||
|
||||
async def _retry_without_images(
|
||||
self,
|
||||
call: Callable[..., Awaitable[LLMResponse]],
|
||||
kw: dict[str, Any],
|
||||
original_messages: list[dict[str, Any]],
|
||||
response: LLMResponse,
|
||||
) -> LLMResponse:
|
||||
# Neither a callback nor a cleanup failure indicates image incompatibility.
|
||||
if response.error_kind in {"callback", "cleanup"}:
|
||||
return response
|
||||
return await super()._retry_without_images(call, kw, original_messages, response)
|
||||
|
||||
def get_default_model(self) -> str:
|
||||
return self.default_model
|
||||
|
||||
|
||||
Reference in new issue
Block a user