11. Video (Video) Quality Response LLM (Gemini)
Video (Video) Quality Response LLM (Gemini)
Main flow
File APIUpload video files usingGenerateContentRequest a question about the video through the request.Check the generated response.
Delete the uploaded Video file.
important:
This tutorial
File APIFor authentication and accessAPI keysUse.Uploaded files
API keyConnected 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_KEYSet 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 APIIt 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