Skip to content

Commit 0b4d13b

Browse files
authored
Merge branch 'main' into mme_optimizations
2 parents 432c783 + dc55c12 commit 0b4d13b

File tree

12 files changed

+59
-16
lines changed

12 files changed

+59
-16
lines changed

microservices/audio-analyzer/docker/compose-minio.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
minio:
3-
image: minio/minio:latest
3+
image: chainguard/minio@sha256:cb84dfa704c648c4b14858aa288576bb1cf756a9b326112a0934db00e87d0bb8
44
ports:
55
- "9000:9000"
66
- "9001:9001"
@@ -11,7 +11,7 @@ services:
1111
- MINIO_ROOT_PASSWORD=${MINIO_SECRET_KEY}
1212
command: server /data --console-address ":9001"
1313
healthcheck:
14-
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
14+
test: [ "CMD-SHELL", "echo > /dev/tcp/127.0.0.1/80 && exit 0 || exit 1" ]
1515
interval: 30s
1616
timeout: 10s
1717
retries: 3

microservices/visual-data-preparation-for-retrieval/vdms/docker/compose-with-embedding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
services:
55
minio-server:
6-
image: minio/minio:RELEASE.2025-02-07T23-21-09Z
6+
image: chainguard/minio@sha256:cb84dfa704c648c4b14858aa288576bb1cf756a9b326112a0934db00e87d0bb8
77
environment:
88
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
99
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}

microservices/visual-data-preparation-for-retrieval/vdms/docker/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33
services:
44
minio-server:
5-
image: minio/minio:RELEASE.2025-02-07T23-21-09Z
5+
image: chainguard/minio@sha256:cb84dfa704c648c4b14858aa288576bb1cf756a9b326112a0934db00e87d0bb8
66
environment:
77
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
88
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}

microservices/visual-data-preparation-for-retrieval/vdms/src/common/schema.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,25 @@ class VideoSummaryRequest(BaseModel):
157157
bucket_name: Annotated[
158158
str, Field(description="The Minio bucket name where the referenced video is stored")
159159
]
160+
video_id: Annotated[
161+
str, Field(description="The video ID (directory) containing the referenced video")
162+
]
163+
video_summary: Annotated[
164+
str, Field(description="The text summary for the video to be embedded")
165+
]
166+
video_start_time: Annotated[
167+
float, Field(description="Start timestamp in seconds for the video or video chunk")
168+
]
169+
video_end_time: Annotated[
170+
float, Field(description="End timestamp in seconds for the video or video chunk")
171+
]
172+
tags: Annotated[
173+
Optional[List[str]],
174+
Field(
175+
default_factory=list,
176+
description="List of tags to be associated with the video. Useful for filtering the search.",
177+
),
178+
]
160179

161180

162181
class TelemetryStageTiming(BaseModel):

microservices/visual-data-preparation-for-retrieval/vdms/src/endpoints/document_processing/process_text.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Copyright (C) 2025 Intel Corporation
22
# SPDX-License-Identifier: Apache-2.0
33

4+
import datetime
45
from http import HTTPStatus
56
from typing import Annotated, List
67

78
from fastapi import APIRouter, Body, HTTPException
9+
from tzlocal import get_localzone
810

911
from src.common import DataPrepException, Strings, logger
1012
from src.common.schema import DataPrepResponse, VideoSummaryRequest
@@ -114,6 +116,13 @@ async def process_video_summary(
114116
bucket_name, video_id, video_start_time, video_end_time, video_summary, tags
115117
)
116118

119+
local_timezone = get_localzone()
120+
created_at = (
121+
datetime.datetime.now(datetime.timezone.utc)
122+
.astimezone(local_timezone)
123+
.isoformat()
124+
)
125+
117126
# Create metadata for summary text
118127
text_metadata = {
119128
"bucket_name": bucket_name,
@@ -124,6 +133,7 @@ async def process_video_summary(
124133
"content_type": "text",
125134
"timestamp": video_start_time,
126135
"tags": comma_separated_tags,
136+
"created_at": created_at,
127137
}
128138

129139
logger.info(f"Text metadata for summary: {text_metadata}")

sample-applications/document-summarization/app/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ CORS_ALLOW_ORIGINS="*"
55
CORS_ALLOW_METHODS="*"
66
CORS_ALLOW_HEADERS="*"
77
LLM_ENDPOINT_URL="http://ovms-service"
8-
CHUNK_SIZE=1024
8+
CHUNK_SIZE=4096

sample-applications/document-summarization/app/server.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@
7575
)
7676

7777
# Update OpenAILike configuration with proper timeout and retry settings
78+
7879
model = OpenAILike(
7980
api_base="{}/v3".format(LLM_INFERENCE_URL),
8081
model=model_name,
8182
is_chat_model=True,
8283
is_function_calling_model=False,
83-
timeout=120, # Increase timeout to 120 seconds
84-
max_retries=2, # Limit number of retries
84+
timeout=600, # Increased timeout for long responses
85+
max_retries=10, # Allow more retries for transient failures
8586
api_key="not-needed" # Some implementations require a non-empty API key
8687
)
8788

@@ -198,8 +199,8 @@ async def stream_data_endpoint(file: UploadFile = File(...), query: str = "Summa
198199
try:
199200
logger.info("Loading documents")
200201
if file.filename.endswith(".txt"):
201-
logger.info("Chunking TXT file before summarization")
202-
documents = chunk_text_file(file_location, max_chars=2000)
202+
logger.info(f"Chunking TXT file before summarization with chunk size: {config.CHUNK_SIZE}")
203+
documents = chunk_text_file(file_location, max_chars=config.CHUNK_SIZE)
203204
else:
204205
documents = SimpleDirectoryReader(input_files=[file_location]).load_data()
205206

sample-applications/document-summarization/app/simple_summary_pack/llama_index/packs/simple_summary/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def __init__(
4949
Settings.embed_model = None
5050
Settings.llm = llm
5151
self.verbose = verbose
52-
self.splitter = SentenceSplitter(chunk_size=config.CHUNK_SIZE or 1024)
52+
self.splitter = SentenceSplitter(chunk_size=config.CHUNK_SIZE or 4096)
5353

5454
self.response_synthesizer = get_response_synthesizer(
5555
response_mode="tree_summarize", use_async=True)

sample-applications/document-summarization/docs/user-guide/troubleshooting.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ A: Summaries are not stored by default; they are returned in the response.
2222

2323
A: Edit the `.env` file in the project root and restart the services.
2424

25+
### Q: How do I configure the chunk size for document processing?
26+
27+
A: The chunk size determines how large documents are split for processing. You can configure it by setting the `CHUNK_SIZE` environment variable in the `.env` file located in `app/.env`.
28+
29+
**Default value:** 4096 characters per chunk
30+
31+
**Recommended values based on file size:**
32+
- **Small documents (<100 KB):** 1024-2048 characters
33+
- **Medium documents (100-200 KB):** 4096-6144 characters
34+
- **Large documents (>200 KB):** 8192-16384 characters
35+
36+
**Note:** These values are suggestive guidelines. Smaller chunk sizes create more chunks, which increases processing time and may cause timeouts for large files. Larger chunk sizes reduce the number of chunks but require more memory per chunk. **Experiment with different values** to find the optimal setting for your specific use case, file types, and system resources.
37+
2538
### Q: What is the ideal time for services or pods to become ready when deployed via Helm?
2639

2740
A: The typical initialization time for services and pods deployed using Helm is approximately 6 to 8 minutes, depending on the system resources and network conditions.

sample-applications/video-search-and-summarization/chart/subchart/minio-server/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ name: minio-server
2323
claimSize: ""
2424

2525
image:
26-
repository: minio/minio
27-
tag: RELEASE.2025-02-07T23-21-09Z-cpuv1
26+
repository: chainguard/minio@sha256
27+
tag: cb84dfa704c648c4b14858aa288576bb1cf756a9b326112a0934db00e87d0bb8
2828
pullPolicy: IfNotPresent
2929

3030
containerApiPortName: api-port # Optional name to refer apiPort

0 commit comments

Comments
 (0)