feat: add gateway client with env-driven assembly
Includes config aggregation for multi-source env keys, from_env and from_settings factories with explicit shared-backend injection, gather_bounded, top-level exports, tightened import-linter layers with the gate removed from the Makefile, and the finalized .env.example.
This commit is contained in:
@@ -21,9 +21,19 @@ class Verdict(BaseModel):
|
||||
|
||||
def _resp(content):
|
||||
return LLMResponse(
|
||||
content=content, thinking="", model="m", provider="p", prompt_tokens=1,
|
||||
completion_tokens=2, latency_ms=10, ttft_ms=None, max_inter_token_ms=None,
|
||||
cache_hit=False, call_id="cid", source_name="s1", usage_source="measured",
|
||||
content=content,
|
||||
thinking="",
|
||||
model="m",
|
||||
provider="p",
|
||||
prompt_tokens=1,
|
||||
completion_tokens=2,
|
||||
latency_ms=10,
|
||||
ttft_ms=None,
|
||||
max_inter_token_ms=None,
|
||||
cache_hit=False,
|
||||
call_id="cid",
|
||||
source_name="s1",
|
||||
usage_source="measured",
|
||||
)
|
||||
|
||||
|
||||
@@ -43,10 +53,10 @@ class TestJsonRepairStrategy:
|
||||
@pytest.mark.parametrize(
|
||||
"dirty",
|
||||
[
|
||||
'```json\n{"answer": 1, "reason": "ok"}\n```', # 围栏
|
||||
'{"answer": 1, "reason": "ok",}', # 尾逗号
|
||||
"{'answer': 1, 'reason': 'ok'}", # 单引号
|
||||
'{"answer": 1, "reason": "ok"', # 缺右括号
|
||||
'```json\n{"answer": 1, "reason": "ok"}\n```', # 围栏
|
||||
'{"answer": 1, "reason": "ok",}', # 尾逗号
|
||||
"{'answer': 1, 'reason': 'ok'}", # 单引号
|
||||
'{"answer": 1, "reason": "ok"', # 缺右括号
|
||||
],
|
||||
)
|
||||
def test_repairs_real_world_dirt(self, dirty):
|
||||
@@ -79,7 +89,7 @@ class TestNativeSchemaStrategy:
|
||||
|
||||
|
||||
def _mw(**kwargs):
|
||||
defaults = dict(strategy=JsonRepairStrategy(), max_retries=1, escalation=None)
|
||||
defaults = {"strategy": JsonRepairStrategy(), "max_retries": 1, "escalation": None}
|
||||
defaults.update(kwargs)
|
||||
return StructuredMW(**defaults)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user