Skip to content

fix(video): preserve frame embeddings and clean up deleted frames - #1364

Merged
Shubhamsaboo merged 1 commit into
Shubhamsaboo:mainfrom
Afloat16:fix/video-moment-ingestion-cleanup
Dec 2, 2026
Merged

Shubhamsaboo merged 1 commit into
Shubhamsaboo:mainfrom
Afloat16:fix/video-moment-ingestion-cleanup

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Why

Consolidates #1358 and #1359 into one multimodal_video_moment_finder PR, following the per-app review request.

Two correctness problems affect the video's stored frames:

  • Gemini combines a list of image Parts into one embedding. Ingesting seven frames in batches of six therefore produces two vectors for seven Chroma IDs, and Chroma rejects the upload.
  • Deleting a video removes its index rows but leaves its extracted frame directory on disk. An unknown video ID is also reported as a successful deletion.

Changes

  • Wrap each frame in its own Gemini Content, reuse the batch helper during ingestion, and require one returned vector per frame before writing Chroma rows. This follows the documented embedding aggregation contract.
  • Remove the selected video's extracted frames after successful index deletion. Return false when no indexed video exists.
  • Group coverage in one 119-line standard unittest file with a normal from video_store import VideoStore import.

Validation

cd advanced_llm_apps/multimodal_video_moment_finder/backend
python -m unittest -v test_video_store
  • Original main 14c5f8ff: 4 failing cases, 3 passing controls. The ingestion case reaches real Chroma and fails with ids: 7, embeddings: 2.
  • This change: 7 tests pass. Coverage checks frame/vector alignment over two batches, progress updates, rejection of incomplete embedding responses before index writes, empty batches, selected-directory cleanup, unknown IDs, failed index deletion and already-missing frame directories.
  • The tests use the real Google SDK request serialization and a real temporary Chroma database. A local HTTP transport returns one vector per serialized content request; frame extraction uses generated JPEG fixtures. No live model call or ffmpeg execution is claimed.
  • Python 3.12.14/Linux, google-genai 3.6.1, Chroma 1.5.9 and Pillow 13.0.0. git diff --check passes, and published files match the locally tested files.

The change is limited to video_store.py and its consolidated test file.

… frames

Group the video moment finder ingestion and deletion correctness fixes. Request one embedding per frame and validate response cardinality before writing the index; remove extracted frames only after successful index deletion and report unknown videos accurately.

Exercise normal imports, Gemini HTTP serialization and temporary Chroma storage in a single offline unittest suite.
@Shubhamsaboo
Shubhamsaboo merged commit 6fa17c8 into Shubhamsaboo:main Dec 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants