Skip to content

Commit 7b47dff

Browse files
authored
Merge pull request BerriAI#26375 from BerriAI/litellm_internal_staging
[Infra] Promote internal staging to main
2 parents 0f50d13 + 1f6ce45 commit 7b47dff

86 files changed

Lines changed: 7881 additions & 846 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 186 additions & 542 deletions
Large diffs are not rendered by default.

.github/workflows/check_duplicate_issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
if: github.event.action == 'opened'
4040
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
4141
with:
42-
python-version: "3.11"
42+
python-version: "3.12"
4343

4444
- name: Auto-close if high-confidence duplicate
4545
if: github.event.action == 'opened'
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Create Release Branch
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Release tag (e.g. v1.83.0-stable) — branch will be named release/<tag>"
8+
required: true
9+
type: string
10+
commit_hash:
11+
description: "Full 40-char commit SHA the branch should point to"
12+
required: true
13+
type: string
14+
workflow_call:
15+
inputs:
16+
tag:
17+
description: "Release tag"
18+
required: true
19+
type: string
20+
commit_hash:
21+
description: "Full 40-char commit SHA the branch should point to"
22+
required: true
23+
type: string
24+
25+
permissions: {}
26+
27+
jobs:
28+
create-branch:
29+
name: Create Release Branch
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: write
33+
steps:
34+
- name: Validate inputs
35+
env:
36+
TAG: ${{ inputs.tag }}
37+
COMMIT_HASH: ${{ inputs.commit_hash }}
38+
run: |
39+
if ! echo "${COMMIT_HASH}" | grep -qE '^[0-9a-f]{40}$'; then
40+
echo "::error::commit_hash must be a full 40-character commit SHA"
41+
exit 1
42+
fi
43+
if ! echo "${TAG}" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+'; then
44+
echo "::error::tag must start with vX.Y.Z"
45+
exit 1
46+
fi
47+
48+
- name: Create release branch
49+
env:
50+
TAG: ${{ inputs.tag }}
51+
COMMIT_HASH: ${{ inputs.commit_hash }}
52+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
53+
with:
54+
script: |
55+
const tag = process.env.TAG;
56+
const commitHash = process.env.COMMIT_HASH;
57+
const branchName = `release/${tag}`;
58+
59+
await github.rest.git.createRef({
60+
owner: context.repo.owner,
61+
repo: context.repo.repo,
62+
ref: `refs/heads/${branchName}`,
63+
sha: commitHash,
64+
});
65+
core.info(`Created branch ${branchName} at ${commitHash}`);

.github/workflows/create-release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ jobs:
102102
body: updatedBody,
103103
draft: false,
104104
});
105+
105106
} catch (error) {
106107
core.setFailed(error.message);
107108
}
109+
110+
create-branch:
111+
name: Create Release Branch
112+
needs: release
113+
permissions:
114+
contents: write
115+
uses: ./.github/workflows/create-release-branch.yml
116+
with:
117+
tag: ${{ inputs.tag }}
118+
commit_hash: ${{ inputs.commit_hash }}

.github/workflows/llm-translation-testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Set up Python
3030
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
3131
with:
32-
python-version: "3.11"
32+
python-version: "3.12"
3333

3434
- name: Set up uv
3535
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7

.github/workflows/scan_duplicate_issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Set up Python
3030
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
3131
with:
32-
python-version: "3.13"
32+
python-version: "3.12"
3333

3434
- name: Scan for duplicate issues
3535
env:

docs/my-website/docs/providers/vertex.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ assert isinstance(
20612061

20622062
## Media Resolution Control (Images & Videos)
20632063

2064-
For Gemini 3+ models, LiteLLM supports per-part media resolution control using OpenAI's `detail` parameter. This allows you to specify different resolution levels for individual images and videos in your request, whether using `image_url` or `file` content types.
2064+
LiteLLM supports per-part media resolution control using OpenAI's `detail` parameter for all Gemini models. This allows you to specify different resolution levels for individual images and videos in your request, whether using `image_url` or `file` content types.
20652065

20662066
**Supported `detail` values:**
20672067
- `"low"` - Maps to `media_resolution: "low"` (280 tokens for images, 70 tokens per frame for videos)
@@ -2146,12 +2146,12 @@ response = completion(
21462146
</Tabs>
21472147

21482148
:::info
2149-
**Per-Part Resolution:** Each image or video in your request can have its own `detail` setting, allowing mixed-resolution requests (e.g., a high-res chart alongside a low-res icon). This feature works with both `image_url` and `file` content types, and is only available for Gemini 3+ models.
2149+
**Per-Part Resolution:** Each image or video in your request can have its own `detail` setting, allowing mixed-resolution requests (e.g., a high-res chart alongside a low-res icon). This feature works with both `image_url` and `file` content types across all Gemini models.
21502150
:::
21512151

21522152
## Video Metadata Control
21532153

2154-
For Gemini 3+ models, LiteLLM supports fine-grained video processing control through the `video_metadata` field. This allows you to specify frame extraction rates and time ranges for video analysis.
2154+
LiteLLM supports fine-grained video processing control through the `video_metadata` field for all Gemini models (1.x, 2.x, 3+). This allows you to specify frame extraction rates and time ranges for video analysis.
21552155

21562156
**Supported `video_metadata` parameters:**
21572157

@@ -2168,8 +2168,11 @@ For Gemini 3+ models, LiteLLM supports fine-grained video processing control thr
21682168
- `fps` remains unchanged
21692169
:::
21702170

2171+
:::tip
2172+
Video clipping (`start_offset`/`end_offset`) and frame rate control (`fps`) are supported by all Gemini models, but analysis quality is significantly higher with the **Gemini 2.5 series** (e.g., `gemini-2.5-flash`, `gemini-2.5-pro`).
2173+
:::
2174+
21712175
:::warning
2172-
- **Gemini 3+ Only:** This feature is only available for Gemini 3.0 and newer models
21732176
- **Video Files Recommended:** While `video_metadata` is designed for video files, error handling for other media types is delegated to the Vertex AI API
21742177
- **File Formats Supported:** Works with `gs://`, `https://`, and base64-encoded video files
21752178
:::

litellm/images/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ def image_generation( # noqa: PLR0915
410410
litellm.LlmProviders.RUNWAYML,
411411
litellm.LlmProviders.VERTEX_AI,
412412
litellm.LlmProviders.OPENROUTER,
413+
litellm.LlmProviders.DASHSCOPE,
413414
):
414415
if image_generation_config is None:
415416
raise ValueError(

litellm/litellm_core_utils/logging_worker.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,17 @@ async def stop(self) -> None:
370370
self._running_tasks.clear()
371371

372372
async def flush(self) -> None:
373-
"""Flush the logging queue."""
373+
"""Flush the logging queue.
374+
375+
Waits until every enqueued task has completed. ``queue.join()`` blocks
376+
on the queue's unfinished-task counter (decremented by ``task_done()``),
377+
so it correctly handles items that have been dequeued but whose
378+
callback hasn't finished yet — ``queue.empty()`` would return True in
379+
that window and cause us to skip the wait.
380+
"""
374381
if self._queue is None:
375382
return
376-
while not self._queue.empty():
377-
await self._queue.join()
383+
await self._queue.join()
378384

379385
async def clear_queue(self):
380386
"""

litellm/litellm_core_utils/prompt_templates/common_utils.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,14 @@ def update_messages_with_model_file_ids(
452452
for c in content:
453453
if c["type"] == "file":
454454
file_object = cast(ChatCompletionFileObject, c)
455-
file_object_file_field = file_object["file"]
455+
file_object_file_field = file_object.get("file")
456+
if not isinstance(file_object_file_field, dict):
457+
# Content block has `type: "file"` but not the
458+
# OpenAI Chat Completions shape (e.g. a LangChain
459+
# v1 standardized file block, or a provider-native
460+
# shape that also uses `type: "file"`). Nothing to
461+
# remap here, so skip instead of crashing.
462+
continue
456463
file_id = file_object_file_field.get("file_id")
457464
format = file_object_file_field.get(
458465
"format", get_format_from_file_id(file_id)
@@ -1060,7 +1067,12 @@ def get_file_ids_from_messages(messages: List[AllMessageValues]) -> List[str]:
10601067
for c in content:
10611068
if c["type"] == "file":
10621069
file_object = cast(ChatCompletionFileObject, c)
1063-
file_object_file_field = file_object["file"]
1070+
file_object_file_field = file_object.get("file")
1071+
if not isinstance(file_object_file_field, dict):
1072+
# Content block has `type: "file"` but not the
1073+
# OpenAI Chat Completions shape. No file_id to
1074+
# extract, so skip instead of raising KeyError.
1075+
continue
10641076
file_id = file_object_file_field.get("file_id")
10651077
if file_id:
10661078
file_ids.append(file_id)

0 commit comments

Comments
 (0)