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

Function _apply_litellm_settings

openkb/cli.py:111–133  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

109
110
111def _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
136def _setup_llm_key(kb_dir: Path | None = None) -> None:

Calls

no outgoing calls