generated from coulomb/repo-seed
Complete activity-core LLM endpoint handoff (LLM-WP-0006)
Switch the custodian triage default from anthropic/claude-sonnet-4 to google/gemini-2.5-flash, which advertises structured-output support on OpenRouter. Tighten the OpenRouter adapter to send strict JSON schema requests and set provider.require_parameters=true so routing only hits providers that honor the requested response_format. Update Kubernetes deploy docs and config for the verified coulombcore handoff: Containerfile build path, image-pull-policy=Never for smoke pods, credential-routing notes, and live smoke evidence. Mark LLM-WP-0006 finished with closure notes from 2026-06-18.
This commit is contained in:
@@ -15,6 +15,8 @@ STRUCTURED_SCHEMA = {
|
||||
"required": ["summary", "recommendations"],
|
||||
}
|
||||
|
||||
OPENROUTER_STRUCTURED_MODEL = "google/gemini-2.5-flash"
|
||||
|
||||
|
||||
SMOKE_CONFIG = RunConfig(
|
||||
model_name="gpt-4",
|
||||
@@ -54,7 +56,7 @@ def test_openrouter_structured_output_payload_and_model_routing(monkeypatch):
|
||||
|
||||
monkeypatch.setattr("llm_connect.openrouter.post_json", fake_post_json)
|
||||
adapter = OpenRouterAdapter(
|
||||
model="anthropic/claude-sonnet-4",
|
||||
model=OPENROUTER_STRUCTURED_MODEL,
|
||||
api_key="or-test",
|
||||
api_base="https://openrouter.example/api/v1",
|
||||
)
|
||||
@@ -62,15 +64,58 @@ def test_openrouter_structured_output_payload_and_model_routing(monkeypatch):
|
||||
response = adapter.execute_prompt("Return JSON.", SMOKE_CONFIG)
|
||||
payload = captured["payload"]
|
||||
|
||||
assert response.model == "anthropic/claude-sonnet-4"
|
||||
assert payload["model"] == "anthropic/claude-sonnet-4"
|
||||
assert response.model == OPENROUTER_STRUCTURED_MODEL
|
||||
assert payload["model"] == OPENROUTER_STRUCTURED_MODEL
|
||||
assert payload["response_format"]["json_schema"]["schema"] == STRUCTURED_SCHEMA
|
||||
assert payload["response_format"]["json_schema"]["strict"] is False
|
||||
assert payload["response_format"]["json_schema"]["strict"] is True
|
||||
assert payload["provider"]["require_parameters"] is True
|
||||
assert "reasoning_effort" not in payload
|
||||
assert "max_depth" not in payload
|
||||
assert "json_schema" not in payload
|
||||
|
||||
|
||||
def test_openrouter_structured_output_preserves_provider_options(monkeypatch):
|
||||
captured: dict[str, object] = {}
|
||||
|
||||
def fake_post_json(url, payload, headers=None, timeout=300): # noqa: ANN001
|
||||
captured["payload"] = payload
|
||||
return {
|
||||
"id": "or-response",
|
||||
"model": payload["model"],
|
||||
"choices": [
|
||||
{
|
||||
"message": {
|
||||
"content": json.dumps({"summary": "ok", "recommendations": []})
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
}
|
||||
],
|
||||
"usage": {"prompt_tokens": 1, "completion_tokens": 2, "total_tokens": 3},
|
||||
}
|
||||
|
||||
config = RunConfig(
|
||||
model_name="gpt-4",
|
||||
temperature=0.1,
|
||||
max_tokens=300,
|
||||
model_params={
|
||||
"json_schema": STRUCTURED_SCHEMA,
|
||||
"provider": {"order": ["Anthropic"]},
|
||||
},
|
||||
)
|
||||
monkeypatch.setattr("llm_connect.openrouter.post_json", fake_post_json)
|
||||
adapter = OpenRouterAdapter(
|
||||
model=OPENROUTER_STRUCTURED_MODEL,
|
||||
api_key="or-test",
|
||||
api_base="https://openrouter.example/api/v1",
|
||||
)
|
||||
|
||||
adapter.execute_prompt("Return JSON.", config)
|
||||
payload = captured["payload"]
|
||||
|
||||
assert payload["provider"]["order"] == ["Anthropic"]
|
||||
assert payload["provider"]["require_parameters"] is True
|
||||
|
||||
|
||||
def test_openai_structured_output_payload(monkeypatch):
|
||||
captured: dict[str, object] = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user