Set each ``litellm:`` key verbatim onto the litellm module (process-wide globals, so they reach every LiteLLM call). Skips with a warning a key the installed litellm doesn't define, or one that is a litellm function (e.g. ``completion``) since overwriting it would break later calls. Appl
(settings: dict)
| 109 | |
| 110 | |
| 111 | def _apply_litellm_settings(settings: dict) -> None: |
| 112 | """Set each ``litellm:`` key verbatim onto the litellm module (process-wide |
| 113 | globals, so they reach every LiteLLM call). Skips with a warning a key the |
| 114 | installed litellm doesn't define, or one that is a litellm function (e.g. |
| 115 | ``completion``) since overwriting it would break later calls. Applied, never |
| 116 | reset — the values persist for the life of the process. |
| 117 | """ |
| 118 | for key, value in settings.items(): |
| 119 | if not hasattr(litellm, key): |
| 120 | logger.warning( |
| 121 | "config: LiteLLM has no setting %r — ignoring it " |
| 122 | "(check the spelling or your installed litellm version).", |
| 123 | key, |
| 124 | ) |
| 125 | continue |
| 126 | if callable(getattr(litellm, key)): |
| 127 | logger.warning( |
| 128 | "config: 'litellm.%s' is a LiteLLM function, not a setting — " |
| 129 | "refusing to overwrite it from the litellm: config block.", |
| 130 | key, |
| 131 | ) |
| 132 | continue |
| 133 | setattr(litellm, key, value) |
| 134 | |
| 135 | |
| 136 | def _setup_llm_key(kb_dir: Path | None = None) -> None: |
no outgoing calls