feat: add backup integrity verification
This commit is contained in:
@@ -289,7 +289,7 @@ async def _format_tool_output_via_llm(
|
||||
if config and config.get("configured"):
|
||||
try:
|
||||
llm = ChatOpenAI(
|
||||
http_client=get_shared_http_client(),
|
||||
http_async_client=get_shared_http_client(),
|
||||
**chat_openai_kwargs(
|
||||
model=config.get("default_model", "gpt-4o-mini"),
|
||||
base_url=config.get("base_url", "https://api.openai.com/v1"),
|
||||
|
||||
@@ -134,7 +134,7 @@ async def create_agent(tools: list, env_id: str | None = None, interrupt_before:
|
||||
raise RuntimeError("No LLM provider configured in backend. Configure one via Settings → AI Providers in the web UI.")
|
||||
logger.reason("Creating LangGraph agent", payload={"model": model, "tools_count": len(tools), "env_id": env_id}, extra={"src": "AgentChat.LangGraph.Setup"})
|
||||
llm = ChatOpenAI(
|
||||
http_client=get_shared_http_client(),
|
||||
http_async_client=get_shared_http_client(),
|
||||
**chat_openai_kwargs(model=model, base_url=base_url, api_key=api_key, max_tokens=2048),
|
||||
)
|
||||
prompt = (
|
||||
|
||||
@@ -156,7 +156,7 @@ class TestFormatToolOutput:
|
||||
]))
|
||||
|
||||
with patch("ss_tools.agent.langgraph_setup._fetch_llm_config") as mock_cfg, \
|
||||
patch("ss_tools.agent._confirmation.ChatOpenAI", return_value=fake_llm):
|
||||
patch("ss_tools.agent._confirmation.ChatOpenAI", return_value=fake_llm) as mock_chat:
|
||||
mock_cfg.return_value = {
|
||||
"configured": True,
|
||||
"api_key": "sk-test",
|
||||
@@ -173,6 +173,9 @@ class TestFormatToolOutput:
|
||||
assert data[2]["content"] == " окружения."
|
||||
for d in data:
|
||||
assert d["metadata"]["type"] == "stream_token"
|
||||
call_kwargs = mock_chat.call_args.kwargs
|
||||
assert "http_async_client" in call_kwargs
|
||||
assert "http_client" not in call_kwargs
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_fallback_when_llm_unavailable(self):
|
||||
|
||||
@@ -62,6 +62,8 @@ class TestCreateAgent:
|
||||
assert call_kwargs["api_key"] == "sk-api-config"
|
||||
assert call_kwargs["base_url"] == "https://custom.api.com/v1"
|
||||
assert call_kwargs["model"] == "gpt-4o-mini"
|
||||
assert "http_async_client" in call_kwargs
|
||||
assert "http_client" not in call_kwargs
|
||||
ls._llm_config = None
|
||||
|
||||
@pytest.mark.anyio
|
||||
|
||||
Reference in New Issue
Block a user