mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-09-27 07:46:22 +00:00
LLM - Disable by default the fetching of price mappings from GitHub on startup
This commit is contained in:
@@ -77,6 +77,24 @@ if 'MALLOC_ARENA_MAX' not in os.environ:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def configure_litellm_pricing_source():
|
||||
# On first import litellm fetches its model pricing/context-window map from GitHub's 'main'
|
||||
# branch: an outbound request nobody asked for, up to a 5s stall on offline installs, and
|
||||
# unpinned data. Default to the map bundled with the installed litellm instead.
|
||||
# LITELLM_FETCH_PRICING_FROM_GITHUB=true opts back in; an explicit LITELLM_LOCAL_MODEL_COST_MAP
|
||||
# (litellm's own switch) always wins. Must run before the first 'import litellm'.
|
||||
try:
|
||||
fetch_from_github = strtobool(os.getenv('LITELLM_FETCH_PRICING_FROM_GITHUB', 'false'))
|
||||
except ValueError:
|
||||
# Runs at package import, so a typo must not stop the app from starting
|
||||
logger.warning("LITELLM_FETCH_PRICING_FROM_GITHUB is not a valid true/false value, using false")
|
||||
fetch_from_github = False
|
||||
os.environ.setdefault('LITELLM_LOCAL_MODEL_COST_MAP', 'False' if fetch_from_github else 'True')
|
||||
|
||||
|
||||
configure_litellm_pricing_source()
|
||||
|
||||
# Set spawn as global default (safety net - all our code uses explicit contexts anyway)
|
||||
# Skip in tests to avoid breaking pytest-flask's LiveServer fixture (uses unpicklable local functions)
|
||||
if 'pytest' not in sys.modules:
|
||||
|
||||
@@ -89,6 +89,10 @@ services:
|
||||
# In Ollama: run `ollama run <model>` then `/set parameter num_ctx 8192`
|
||||
# - LLM_RESTOCK_MAX_CONTENT_CHARS=15000
|
||||
#
|
||||
# Fetch the latest LLM model pricing (used for the estimated cost counter) from GitHub, default false.
|
||||
# When false the pricing list that ships with this version is used, so no outbound request is made. (Off by default for privacy)
|
||||
# - LITELLM_FETCH_PRICING_FROM_GITHUB=false
|
||||
#
|
||||
# A valid timezone name to run as (for scheduling watch checking) see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
# - TZ=America/Los_Angeles
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user