Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: log fallback warning in blog posts endpoint and tighten test

yuneng-jiang4b1ce1ff54ac
diff --git a/litellm/proxy/public_endpoints/public_endpoints.py b/litellm/proxy/public_endpoints/public_endpoints.py
index f5bca531839..b2fb3dd0f8a 100644
--- a/litellm/proxy/public_endpoints/public_endpoints.py
+++ b/litellm/proxy/public_endpoints/public_endpoints.py
@@ -4,6 +4,7 @@ from typing import List
from fastapi import APIRouter, Depends, HTTPException
+from litellm._logging import verbose_logger
from litellm.litellm_core_utils.get_blog_posts import (
BlogPost,
BlogPostsResponse,
@@ -213,7 +214,10 @@ async def get_litellm_blog_posts():
"""
try:
posts_data = get_blog_posts()
- except Exception:
+ except Exception as e:
+ verbose_logger.warning(
+ "LiteLLM: get_litellm_blog_posts endpoint fallback triggered: %s", str(e)
+ )
posts_data = GetBlogPosts.load_local_blog_posts()
posts = [BlogPost(**p) for p in posts_data[:5]]
diff --git a/tests/proxy_unit_tests/test_blog_posts_endpoint.py b/tests/proxy_unit_tests/test_blog_posts_endpoint.py
index 1c5db4d2cfe..0f93f6f80cf 100644
--- a/tests/proxy_unit_tests/test_blog_posts_endpoint.py
+++ b/tests/proxy_unit_tests/test_blog_posts_endpoint.py
@@ -77,3 +77,4 @@ def test_get_blog_posts_returns_local_backup_on_failure(client):
# Should not 500 — returns local backup
assert response.status_code == 200
assert "posts" in response.json()
+ assert len(response.json()["posts"]) > 0