Private
Public Access
feat(ai_client): wire v2 matrix fields into old vendor send functions
The matrix has v2 fields (reasoning, web_search, x_search)
populated for the old vendors (minimax-M2.5/M2.7, grok-*),
but the send functions didn't consult them. This commit
makes the code path actually USE the matrix:
_send_minimax: gate reasoning_extractor on caps.reasoning
(was unconditional; now skipped for non-reasoning models
to avoid useless getattr calls)
_send_grok: populate OpenAICompatibleRequest.extra_body with
search_parameters when caps.web_search or caps.x_search is
True. caps.web_search -> {mode: auto}; caps.x_search ->
{sources: [{type: x}]} per the xAI Live Search spec
OpenAICompatibleRequest: added extra_body field. Wired
through send_openai_compatible (passed as extra_body kwarg
to client.chat.completions.create).
Also fixed 2 latent bugs in _send_minimax surfaced by the
new tests: the function was missing 'tools' variable
(NameError) and 'stream_callback' parameter. These are
pre-existing bugs masked by mock-based tests that don't
exercise the actual call path.
Also cancelled t5_6/7/8 (the invented 'deferred tool-loop
conversion' work). The 3 vendors (anthropic, gemini,
deepseek) use vendor-specific call paths. Their inline
loops are NOT defects. The '3-5 days' / '1-2 weeks'
estimates were made up by the agent. The audit script's
DEFERRED_VENDORS exclusion is permanent.
Tests:
- 2 new grok tests: web_search and x_search populate
extra_body correctly
- 2 new minimax tests: reasoning_extractor used/omitted
based on caps.reasoning
- 122/122 vendor+tool+provider+import-isolation tests pass
(no regressions; +4 new tests this commit)
- 3 audit scripts pass
This commit is contained in:
@@ -25,7 +25,7 @@ class OpenAICompatibleRequest:
|
||||
tool_choice: str = "auto"
|
||||
stream: bool = False
|
||||
stream_callback: Optional[Callable[[str], None]] = None
|
||||
|
||||
extra_body: Optional[dict[str, Any]] = None
|
||||
def _to_dict_tool_call(tc: Any) -> dict[str, Any]:
|
||||
return {
|
||||
"id": getattr(tc, "id", None),
|
||||
@@ -75,6 +75,8 @@ def send_openai_compatible(
|
||||
if request.tools is not None:
|
||||
kwargs["tools"] = request.tools
|
||||
kwargs["tool_choice"] = request.tool_choice
|
||||
if request.extra_body:
|
||||
kwargs["extra_body"] = request.extra_body
|
||||
try:
|
||||
if request.stream:
|
||||
return _send_streaming(client, kwargs, request.stream_callback)
|
||||
|
||||
Reference in New Issue
Block a user