MCPcopy Create free account
hub / github.com/BerriAI/litellm / edge

Function edge

tests/code_coverage_tests/test_provider_cache.py:216–225  ·  view source on GitHub ↗

The URL a deployment registered by ``test_key`` would carry, or the bare mount URL for None, which is what a registration made outside any test gets.

(cache: CacheEdge, provider: Provider, test_key: str | None = TEST_KEY)

Source from the content-addressed store, hash-verified

214
215@contextmanager
216def edge(cache: CacheEdge, provider: Provider, test_key: str | None = TEST_KEY) -> Generator[str, None, None]:
217 """The URL a deployment registered by ``test_key`` would carry, or the bare
218 mount URL for None, which is what a registration made outside any test gets."""
219 upstream: Final = f"http://127.0.0.1:{provider.server_port}"
220 running: Final = start_provider_edge(cache, mounts={"openai": upstream})
221 base: Final = running.edge.api_base("openai")
222 try:
223 yield f"{base if test_key is None else scoped_edge_base(base, test_key)}/v1/chat/completions"
224 finally:
225 running.shutdown()
226
227
228@contextmanager

Calls 4

start_provider_edgeFunction · 0.90
scoped_edge_baseFunction · 0.90
api_baseMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected