Issue with lab of Generative AI Challenge lab GSP515

I have performed the challenge lab ( Explore Generative AI with the Gemini API in Vertex AI: Challenge Lab ) but the last task is not accepting progress after completing it properly 

Anyone has any idea about this, please let me know

Solved Solved
1 8 244
1 ACCEPTED SOLUTION

Do not change code of gemini-explorer-challenge-v2.0.0.ipynb .

Code is different from earlier version, There is new version from 29th April 25.

Please replace carefully below information. and run code. After running code save notebook. last task will take little time complete. Use check tasks against Tasks, not yellow one on right. it takes more time. Keep learning. All the best. It worked for me after different combinations. If it works for you mark this Post as solution.

----------------------------------------------------------------------

# Task 3.1

replace <<INSERT CORRECT MODEL NAME HERE>> with
gemini-2.0-flash-001
------------------
# Task 3.2
replace INSERT CORRECT CLASSNAME with
FunctionDeclaration
---------------------
# Task 3.3
replace INSERT CORRECT CLASSNAME with
Tool
------------------------------
# Task 3.4
replace INSERT TOOL TO USE with
weather_tool
----------------------------
# Task 4.1
replace <<INSERT CORRECT MODEL NAME HERE>> with
gemini-2.0-flash-001
-------------------------------
# Task 4.2 Generate a video description
replace INPUT CORRECT CLASSNAME with
Part
+++++++++++++++++++++
replace INSERT VIDEO URI with
gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4
+++++++++++++++++++++++
replace INSERT CORRECT METHOD NAME with
generate_content_stream
-----------------------------

View solution in original post

8 REPLIES 8

There is no problem with lab or config. Lab is recently updated . old YouTube scripts won't work. you need to use knowledge from other labs in this course to complete challenge lab.

All the best

Everything I have done with my knowledge a got solution on 3rd attempt but it's not taking as complete in progress in the last task, and showing 60% completed

If It can helps, you have to look carefully at the documentation provided in 4th task in Jupyter Lab (4.3 cell, above the Video URI reference), you have to pay attention at each class name needed there.

Do not change code of gemini-explorer-challenge-v2.0.0.ipynb .

Code is different from earlier version, There is new version from 29th April 25.

Please replace carefully below information. and run code. After running code save notebook. last task will take little time complete. Use check tasks against Tasks, not yellow one on right. it takes more time. Keep learning. All the best. It worked for me after different combinations. If it works for you mark this Post as solution.

----------------------------------------------------------------------

# Task 3.1

replace <<INSERT CORRECT MODEL NAME HERE>> with
gemini-2.0-flash-001
------------------
# Task 3.2
replace INSERT CORRECT CLASSNAME with
FunctionDeclaration
---------------------
# Task 3.3
replace INSERT CORRECT CLASSNAME with
Tool
------------------------------
# Task 3.4
replace INSERT TOOL TO USE with
weather_tool
----------------------------
# Task 4.1
replace <<INSERT CORRECT MODEL NAME HERE>> with
gemini-2.0-flash-001
-------------------------------
# Task 4.2 Generate a video description
replace INPUT CORRECT CLASSNAME with
Part
+++++++++++++++++++++
replace INSERT VIDEO URI with
gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4
+++++++++++++++++++++++
replace INSERT CORRECT METHOD NAME with
generate_content_stream
-----------------------------

Thanks @RAOKS. Finally, it's done in 5th attempt

generate_content_stream this was my mistake, one word

I was happy I could help you to solve your problem. I want you to explore different options so that you learn. well tried. we all learn when we face errors.

From above solution posted by me , I am happy as you have identified why Task #4 check task is not completing earlier and now its given Green tick . I really appreciate your effort. You are right generate_content_stream . With generarate_content ,  it's throwing  print related errors, So for a day I have tried different print options which has given same output as generate_content_stream .

As check task is more concentrating on this particular command execution than output. Task #4 was giving error.

Then I have diagnosed and  found generate_content_stream execution is expected by lab for #Task #4

Keep learning. All the best.

It is not working 

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[37], line 13
      1 # Task 4.2 Generate a video description
      2 # In this cell, update the prompt to ask Gemini to describe the video URL referenced.
      3 # You can use the documentation at the following link to assist.
      4 # https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/sdk-for-gemini/gemini-sdk-overview-...
      5 # https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#sample-requests-text...
      6 # Video URI: gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4
      8 prompt = """
      9 What is shown in this video?
     10 Where should I go to see it?
     11 What are the top 5 places in the world that look like this?
     12 """
---> 13 video = Part.from_uri(
     14     file_uri="gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4",
     15     mime_type="video/mp4",
     16 )
     17 contents = [prompt, video]
     19 responses = client.models.generate_content_stream(
     20     model=multimodal_model,
     21     contents=contents
     22 )

TypeError: Part.from_uri() got an unexpected keyword argument 'file_uri'

# Task 4.2 Generate a video description
# In this cell, update the prompt to ask Gemini to describe the video URL referenced.
# You can use the documentation at the following link to assist.
# https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/sdk-for-gemini/gemini-sdk-overview-...
# https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#sample-requests-text...
# Video URI: gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4

prompt = """
What is shown in this video?
Where should I go to see it?
What are the top 5 places in the world that look like this?
"""
video = Part.from_uri(
file_uri="gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4",
mime_type="video/mp4",
)
contents = [prompt, video]

responses = client.models.generate_content_stream(
model=multimodal_model,
contents=contents
)

print("-------Prompt--------")
print_multimodal_prompt(contents)

print("\n-------Response--------")
for response in responses:
print(response.text, end="")

As @RAOKS Mentioned above. the lab got updated recently. You need to complete the lab by applying your skills or Read the instructions carefully and execute the solutions.

Top Labels in this Space