Skip to content

Commit 09be61e

Browse files
authored
docs(genai): Update Video Samples to follow recommended practices (#13183)
1 parent f128b23 commit 09be61e

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

genai/text_generation/textgen_with_local_video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def generate_content() -> str:
2929
response = client.models.generate_content(
3030
model=model_id,
3131
contents=[
32-
"Write a short and engaging blog post based on this video.",
3332
Part.from_bytes(data=video_content, mime_type="video/mp4"),
33+
"Write a short and engaging blog post based on this video.",
3434
],
3535
)
3636

genai/text_generation/textgen_with_mute_video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ def generate_content() -> str:
2222
response = client.models.generate_content(
2323
model="gemini-2.0-flash-001",
2424
contents=[
25-
"What is in the video?",
2625
Part.from_uri(
2726
file_uri="gs://cloud-samples-data/generative-ai/video/ad_copy_from_video.mp4",
2827
mime_type="video/mp4",
2928
),
29+
"What is in the video?",
3030
],
3131
)
3232
print(response.text)

genai/text_generation/textgen_with_video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ def generate_content() -> str:
2727
response = client.models.generate_content(
2828
model="gemini-2.0-flash-001",
2929
contents=[
30-
prompt,
3130
Part.from_uri(
3231
file_uri="gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
3332
mime_type="video/mp4",
3433
),
34+
prompt,
3535
],
3636
)
3737

genai/text_generation/textgen_with_youtube_video.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@ def generate_content() -> str:
2323
client = genai.Client(http_options=HttpOptions(api_version="v1"))
2424
model_id = "gemini-2.0-flash-001"
2525

26-
# You can include text, PDF documents, images, audio and video in your prompt requests and get text or code responses.
27-
video = Part.from_uri(
28-
file_uri="https://www.youtube.com/watch?v=3KtWfp0UopM",
29-
mime_type="video/mp4",
30-
)
31-
3226
response = client.models.generate_content(
3327
model=model_id,
3428
contents=[
35-
video,
29+
Part.from_uri(
30+
file_uri="https://www.youtube.com/watch?v=3KtWfp0UopM",
31+
mime_type="video/mp4",
32+
),
3633
"Write a short and engaging blog post based on this video.",
3734
],
3835
)

0 commit comments

Comments
 (0)