Resolve the optional ``litellm:`` mapping of LiteLLM module settings. Values are forwarded verbatim (the user owns them); only the container shape is enforced — returns ``{}`` if absent or not a mapping, and drops non-string keys. ``cli._apply_litellm_settings`` applies them.
(config: dict)
| 177 | |
| 178 | |
| 179 | def resolve_litellm_settings(config: dict) -> dict[str, Any]: |
| 180 | """Resolve the optional ``litellm:`` mapping of LiteLLM module settings. |
| 181 | |
| 182 | Values are forwarded verbatim (the user owns them); only the container shape |
| 183 | is enforced — returns ``{}`` if absent or not a mapping, and drops non-string |
| 184 | keys. ``cli._apply_litellm_settings`` applies them. |
| 185 | """ |
| 186 | raw = config.get("litellm") |
| 187 | if raw is None: |
| 188 | return {} |
| 189 | if not isinstance(raw, dict): |
| 190 | logger.warning( |
| 191 | "config: 'litellm' must be a mapping of LiteLLM settings, got %s — ignoring it.", |
| 192 | type(raw).__name__, |
| 193 | ) |
| 194 | return {} |
| 195 | settings: dict[str, Any] = {} |
| 196 | for key, value in raw.items(): |
| 197 | if not isinstance(key, str): |
| 198 | logger.warning("config: skipping 'litellm' entry with non-string key %r.", key) |
| 199 | continue |
| 200 | settings[key] = value |
| 201 | return settings |
| 202 | |
| 203 | |
| 204 | # Process-wide extra headers for LLM requests, resolved from the active KB's |