MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / resolve_litellm_settings

Function resolve_litellm_settings

openkb/config.py:179–201  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

177
178
179def 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

Calls 1

getMethod · 0.45