You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -246,6 +246,68 @@ public class GenerateContentWithImageInput {
246
246
}
247
247
```
248
248
249
+
##### with text input and files api
250
+
You can use the Files API to upload a media file. Always use the Files API when the total request size (including the files, text prompt, system instructions, etc.) is larger than 20 MB.
251
+
```java
252
+
<your package name>;
253
+
254
+
importcom.google.genai.Client;
255
+
importcom.google.genai.Pager;
256
+
importcom.google.genai.types.*;
257
+
258
+
importjava.util.List;
259
+
260
+
261
+
publicclassMain {
262
+
publicstaticvoidmain(String[] args) {
263
+
Client client =Client
264
+
.builder()
265
+
.build();
266
+
267
+
// Upload a file to gemini servers. It remains in the cloud for 48 hours
0 commit comments