release: bump version to 0.84.0
This commit is contained in:
1 parent
3b1b9ef68c
commit
e1cc27f13d
241 files changed
+42779
-6027
No files matched your search
@@ -442,3 +442,120 @@ async def test_protocol_tools_structured_output_and_json_context(monkeypatch):
|
||||
assert captured_anth[0]["messages"][2]["content"][0]["type"] == "tool_result"
|
||||
assert anth_resp.tool_calls[0].id == "tu_1"
|
||||
assert anth_resp.tool_calls[0].arguments == {"query": "Oak Ridge"}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_anthropic_thinking_tool_choice_downgrade_dedupe_and_citations(monkeypatch):
|
||||
service = ProviderService(
|
||||
{
|
||||
"provider": "minimax",
|
||||
"provider_api": "anthropic-messages",
|
||||
"base_url": "https://api.minimaxi.com/anthropic",
|
||||
"api_key": "test-key",
|
||||
"model": "MiniMax-M3.1-Flash",
|
||||
}
|
||||
)
|
||||
captured = []
|
||||
|
||||
async def fake_post(**kwargs):
|
||||
captured.append(kwargs["request_body"])
|
||||
return {
|
||||
"stop_reason": "tool_use",
|
||||
"content": [
|
||||
{"type": "thinking", "thinking": "check host", "signature": "sig_abc"},
|
||||
{
|
||||
"type": "web_search_tool_result",
|
||||
"content": [{"type": "web_search_result", "url": "https://example.com/search-hit"}],
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Found evidence",
|
||||
"citations": [{"type": "web_search_result_location", "url": "https://example.com/cited"}],
|
||||
},
|
||||
{"type": "tool_use", "id": "tu_2", "name": "submit_location_result", "input": {"status": "located"}},
|
||||
],
|
||||
}
|
||||
|
||||
monkeypatch.setattr(service, "_post", fake_post)
|
||||
tools_spec = [
|
||||
{"name": "web_search", "description": "custom search", "parameters": {"type": "object", "properties": {}}},
|
||||
{"name": "submit_location_result", "description": "submit", "parameters": {"type": "object", "properties": {}}},
|
||||
]
|
||||
req = SituationalAnalysisRequest(
|
||||
title="Location agent step 1",
|
||||
objective="locate",
|
||||
tools=tools_spec,
|
||||
tool_choice={"type": "function", "name": "submit_location_result"},
|
||||
native_web_search=True,
|
||||
messages=[
|
||||
{"role": "user", "content": "Target context JSON"},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "",
|
||||
"thinking_blocks": [{"type": "thinking", "thinking": "prior thought", "signature": "sig_0"}],
|
||||
"tool_calls": [{"id": "tu_0", "name": "web_search", "arguments": {"query": "ISEG2"}}],
|
||||
},
|
||||
{"role": "tool", "tool_call_id": "tu_0", "content": "{}"},
|
||||
],
|
||||
)
|
||||
resp = await service.analyze(req)
|
||||
body = captured[0]
|
||||
# Adaptive thinking active -> forced tool_choice downgraded to auto
|
||||
assert body["tool_choice"] == {"type": "auto"}
|
||||
# Duplicate custom web_search deduplicated when native_web_search=True
|
||||
web_search_tools = [t for t in body["tools"] if t.get("name") == "web_search"]
|
||||
assert len(web_search_tools) == 1
|
||||
assert web_search_tools[0]["type"] == "web_search_20250305"
|
||||
# Assistant thinking_blocks preserved ahead of tool_use
|
||||
assert body["messages"][1]["content"][0] == {"type": "thinking", "thinking": "prior thought", "signature": "sig_0"}
|
||||
assert body["messages"][1]["content"][1]["type"] == "tool_use"
|
||||
# Citations extracted
|
||||
assert resp.citation_urls == ["https://example.com/search-hit", "https://example.com/cited"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_responses_tool_loop_turn1_consistency_and_citations(monkeypatch):
|
||||
service = ProviderService(
|
||||
{
|
||||
"provider": "openai",
|
||||
"provider_api": "openai-responses",
|
||||
"base_url": "https://api.openai.test/v1",
|
||||
"api_key": "test-key",
|
||||
"model": "gpt-5.6-luna",
|
||||
}
|
||||
)
|
||||
captured = []
|
||||
|
||||
async def fake_post(**kwargs):
|
||||
captured.append(kwargs["request_body"])
|
||||
return {
|
||||
"status": "completed",
|
||||
"output": [
|
||||
{
|
||||
"type": "web_search_call",
|
||||
"action": {"sources": [{"url": "https://example.com/resp-src"}]},
|
||||
},
|
||||
{
|
||||
"type": "message",
|
||||
"content": [
|
||||
{
|
||||
"type": "output_text",
|
||||
"text": "Located",
|
||||
"annotations": [{"type": "url_citation", "url": "https://example.com/resp-ann"}],
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
monkeypatch.setattr(service, "_post", fake_post)
|
||||
tools_spec = [{"name": "geocode_verify", "description": "geo", "parameters": {"type": "object", "properties": {}}}]
|
||||
req_turn1 = SituationalAnalysisRequest(
|
||||
title="step 1",
|
||||
objective="locate",
|
||||
tools=tools_spec,
|
||||
messages=[{"role": "user", "content": "RAW_USER_PROMPT"}],
|
||||
)
|
||||
resp = await service.analyze(req_turn1)
|
||||
assert captured[0]["input"] == [{"role": "user", "content": "RAW_USER_PROMPT"}]
|
||||
assert resp.citation_urls == ["https://example.com/resp-src", "https://example.com/resp-ann"]
|
||||
Reference in new issue
Block a user