feat(models): declare request APIs per preset

Bind API support and preference to the preset's provider and model. Carry the
API declaration through factory selection, fallback chains, hot reload and
WebUI persistence. Use Copilot endpoint metadata for automatic routing and
keep reasoning replay and compaction defaults in provider capability profiles.

Consolidate Responses follow-ups from #5906, #5935, #6020, #6051 and #5834;
acknowledge equivalent contributions in #6105 and #5863.

Co-authored-by: Parman Mohammadalizadeh <prmma23@gmail.com>
Co-authored-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com>
Co-authored-by: kkkhoo <128304090+kkkhoo@users.noreply.github.com>
Co-authored-by: pei711 <199601925+pei711@users.noreply.github.com>
Co-authored-by: Steven Huang <134844631+remote-controlled-man@users.noreply.github.com>
Co-authored-by: Louis Yue <179701714+selfucker@users.noreply.github.com>
Co-authored-by: iuiuiu <92971770+iuiu-py@users.noreply.github.com>
This commit is contained in:
authored and chengyongru committed 2026-10-10 01:33:02 +08:00
1 parent 3c866d63ac
commit b5808e47de
23 files changed
+738 -63

No files matched your search

+28
View File
@@ -7,6 +7,7 @@ from unittest.mock import MagicMock, patch
import pytest
from loguru import logger
from openai.types.responses import ResponseFunctionToolCall
from nanobot.providers.base import LLMUsage
from nanobot.providers.openai_responses.converters import (
@@ -33,6 +34,33 @@ from nanobot.providers.openai_responses.state import (
responses_state_items,
)
async def test_sdk_tool_alias_survives_capture_and_next_request_replay():
item = ResponseFunctionToolCall.model_validate({
"type": "function_call", "id": "fc_alias", "call_id": "call_alias",
"name": "lookup", "arguments": "{}", "async": True,
})
events = [SimpleNamespace(
type="response.completed",
response=SimpleNamespace(status="completed", usage=None, output=[item]),
)]
async def stream():
for event in events:
yield event
capture = ResponsesStreamCapture()
await consume_sdk_stream(stream(), capture=capture)
state = build_responses_state(
provider="fixture", model="fixture", input_items=[], output_items=capture.output_items,
)
_, items, replayed = prepare_responses_input(
[], state=state, provider="fixture", model="fixture",
)
assert replayed
assert items[0]["async"] is True
assert "async_" not in items[0]
# ======================================================================
# converters - split_tool_call_id
# ======================================================================