Closed fwermus closed 7 months ago
Hi,
Gemini expects a very rigid turn based approach alternating between user and model response. Currently looking for a better way for the library to handle this so that any user content is combined in the payload. For now you can include as much prompt information into the prompt using .addDriveData(prompt, file)
. Let me know if still unclear
Thanks
I am able to use gemini ai rest api, but when I try library it fails
code: GeminiApp.init(LOCATION_ID, PROJECT_ID); const file = DriveApp.getFileById(fileId); var resp = GeminiApp.newChat() .addContent(prompt) .addDriveData("pdf file: ", file) .run();
Request to Gemini failed with response code 400 - [{ "error": { "code": 400, "message": "Please ensure that multiturn requests alternate between user and model.", "status": "INVALID_ARGUMENT" } } ]
but It works with
GeminiApp.init(LOCATION_ID, PROJECT_ID); const file = DriveApp.getFileById(fileId); var resp = GeminiApp.newChat() .addDriveData(prompt, file) .run();
need some information why the first option throws error
My escenario is that I have more than one file and a prompt. Then, I am confused where to put prompt for all those files.
thanks in advance.