Coverage for src/lilbee/app/agent_configs/litellm.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-08-14 11:46 +0000

1"""LiteLLM proxy config.yaml snippet (https://docs.litellm.ai/docs/proxy/configs).""" 

2 

3from __future__ import annotations 

4 

5import yaml 

6 

7from lilbee.app.endpoints import OPENAI_PATH 

8 

9 

10def litellm_config( 

11 *, 

12 base_url: str, 

13 api_key: str, 

14 model_refs: list[str], 

15) -> str: 

16 """Return a LiteLLM `config.yaml` snippet with one entry per chat model.""" 

17 entries = [ 

18 { 

19 "model_name": f"lilbee/{ref}", 

20 "litellm_params": { 

21 "model": f"openai/{ref}", 

22 "api_base": f"{base_url}{OPENAI_PATH}", 

23 "api_key": api_key, 

24 }, 

25 } 

26 for ref in sorted(model_refs) 

27 ] 

28 return yaml.safe_dump({"model_list": entries}, sort_keys=False)