11. Video (Video) Quality Response LLM (Gemini)

Video (Video) Quality Response LLM (Gemini)

Main flow

  1. File API Upload video files using

  2. GenerateContent Request a question about the video through the request.

  3. Check the generated response.

  4. Delete the uploaded Video file.

important:

  • This tutorial File API For authentication and access API keys Use.

  • Uploaded files API key Connected to the cloud project.

Different Gemini API Unlike, API key has File API It also gives access to the data uploaded, API key Particular attention should be paid to keeping Esau safe.

Reference

API KEY issuance

  • link Get API KEY from.

  • Environment variable the user's Google API key GOOGLE_API_KEY Set to.

.env Enter it as below in the file.

Copy

Copy

Copy

Copy

Copy

Video upload

Gemini API accepts video file types directly.

Limiting

  • File API It accommodates less than 2 GB of files and can store up to 20 GB of files per project.

  • The file is kept for 2 days and in the API Undownloadable .

This example uses videos posted on the Teddy Note YouTube channel. (You can also proceed by replacing it with another video)

Copy

Enter the path of the video file below.

Copy

Next File API Upload video files using

Copy

Copy

After uploading the file, files.get You can confirm that the API has successfully completed the file by calling.

files.get Files associated with the cloud project to which the API key belongs. It allows you to check files uploaded to the API.

Copy

Copy

Copy

Copy

Copy

Below is an example of stream output. ( stream=True Add option)

Copy

Copy

Delete file

Files are automatically deleted after 2 days files.delete() You can delete it manually using

Copy

Last updated