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:
@@ -25,10 +25,14 @@ class FakeClock:
|
||||
|
||||
|
||||
def make_source(name: str = "s1", **overrides) -> SourceConfig:
|
||||
base = dict(
|
||||
name=name, provider="openai", base_url="https://gw.example/v1",
|
||||
api_key="sk-test", model="m", timeout_s=10.0,
|
||||
)
|
||||
base = {
|
||||
"name": name,
|
||||
"provider": "openai",
|
||||
"base_url": "https://gw.example/v1",
|
||||
"api_key": "sk-test",
|
||||
"model": "m",
|
||||
"timeout_s": 10.0,
|
||||
}
|
||||
base.update(overrides)
|
||||
return SourceConfig(**base)
|
||||
|
||||
@@ -44,8 +48,11 @@ def limiter_factory(request, clock):
|
||||
|
||||
def make(sources: list[SourceConfig], global_limits: GlobalLimits, lease_ttl_s: float = 100.0):
|
||||
return InMemoryLimiter(
|
||||
scope="llm", sources={s.name: s for s in sources},
|
||||
global_limits=global_limits, lease_ttl_s=lease_ttl_s, now=clock,
|
||||
scope="llm",
|
||||
sources={s.name: s for s in sources},
|
||||
global_limits=global_limits,
|
||||
lease_ttl_s=lease_ttl_s,
|
||||
now=clock,
|
||||
)
|
||||
|
||||
return make
|
||||
|
||||
Reference in New Issue
Block a user