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 failing tests

Ishaan Jafferd31d5b84864a
diff --git a/license_cache.json b/license_cache.json
new file mode 100644
index 00000000000..575554c49b4
--- /dev/null
+++ b/license_cache.json
@@ -0,0 +1,9 @@
+{
+ "tornado:6.5.3": "Apache-2.0",
+ "redisvl:0.4.1": "MIT",
+ "google-cloud-iam:2.19.1": "Apache 2.0",
+ "google-genai:1.37.0": "Apache-2.0",
+ "azure-keyvault:4.2.0": "MIT License",
+ "soundfile:0.12.1": "BSD 3-Clause License",
+ "openapi-core:0.21.0": "BSD-3-Clause"
+}
\ No newline at end of file
diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.py
index b1d571343cf..125f2585a33 100644
--- a/litellm/litellm_core_utils/prompt_templates/common_utils.py
+++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py
@@ -1136,6 +1136,7 @@ def add_system_prompt_to_messages(
if merge_with_first_system and messages and messages[0].get("role") == "system":
first = dict(messages[0])
existing_content = first.get("content", "")
+ merged_content: Union[str, List[Dict[str, str]]]
if isinstance(existing_content, str):
merged_content = f"{system_prompt.strip()}\n\n{existing_content}"
elif isinstance(existing_content, list):
diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py
index f2effa95f8b..a230c2e9336 100644
--- a/litellm/proxy/management_endpoints/key_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py
@@ -1071,6 +1071,7 @@ async def generate_key_fn(
- team_id: Optional[str] - The team id of the key
- user_id: Optional[str] - The user id of the key
- organization_id: Optional[str] - The organization id of the key. If not set, and team_id is set, the organization id will be the same as the team id. If conflict, an error will be raised.
+ - project_id: Optional[str] - The project id of the key. When set, models and max_budget are validated against the project's limits.
- budget_id: Optional[str] - The budget id associated with the key. Created by calling `/budget/new`.
- models: Optional[list] - Model_name's a user is allowed to call. (if empty, key is allowed to call all models)
- aliases: Optional[dict] - Any alias mappings, on top of anything in the config.yaml model list. - https://docs.litellm.ai/docs/proxy/virtual_keys#managing-auth---upgradedowngrade-models
diff --git a/tests/documentation_tests/test_env_keys.py b/tests/documentation_tests/test_env_keys.py
index 4fed84d0431..f9bf1341916 100644
--- a/tests/documentation_tests/test_env_keys.py
+++ b/tests/documentation_tests/test_env_keys.py
@@ -35,8 +35,23 @@ EXCLUDED_TERMINAL_VARS = {
"ALACRITTY_SOCKET",
}
+# Directories to skip (dependencies, venvs, caches) - only scan litellm source
+SKIP_DIRS = {
+ ".venv",
+ "venv",
+ "__pycache__",
+ ".git",
+ "node_modules",
+ "site-packages",
+ ".eggs",
+ "dist",
+ "build",
+}
+
# Walk through all files in the litellm repo to find references of os.getenv() and litellm.get_secret()
for root, dirs, files in os.walk(repo_base):
+ # Skip dependency/venv directories - prevents picking up env vars from installed packages
+ dirs[:] = [d for d in dirs if d not in SKIP_DIRS]
for file in files:
if file.endswith(".py"): # Only process Python files
file_path = os.path.join(root, file)
@@ -83,12 +98,13 @@ try:
)
print(f"general_settings_section: {general_settings_section}")
if general_settings_section:
- # Extract the table rows, which contain the documented keys
+ # Extract the table rows - only first column (key name) from each row
table_content = general_settings_section.group(1)
- doc_key_pattern = re.compile(
- r"\|\s*([^\|]+?)\s*\|"
- ) # Capture the key from each row of the table
- documented_keys.update(doc_key_pattern.findall(table_content))
+ for line in table_content.split("\n"):
+ # Match | KEY_NAME | description | - capture first column only
+ match = re.match(r"^\|\s*([A-Z_][A-Z0-9_]*)\s*\|", line)
+ if match:
+ documented_keys.add(match.group(1).strip())
except Exception as e:
raise Exception(
f"Error reading documentation: {e}, \n repo base - {os.listdir(repo_base)}"