Hello,
I am new to this forum so I hope this is the right place for this query (and hello everyone).
I have used the Gemini API to create an internal AI studio where everyone in the company I work for has a to sign in and select a project for every generation so we can offset the cost and use it responsibly. I have a full database that saves the chat history, media generation cost history and I have linked it to the Files API, all that stuff. We are on Tier 2.
It is really successful so far, but I am currently using contentGeneration.
I have switched a local version to the Interactions API and it all works (chat, nano banana, tools, files API chat, file search chat etc.). I have done this to save token cost on sending the full chat history every query and it has better cross model integration (as I understand). I also want to add Omni.
I am currently looking to integrate it into my studio version with the database and instead of saving the full chat history, I want to save the previous_interaction_id.
I have run into a few problems if anyone can help. Firstly, I thought about linking the chain of previous_interaction_id’s and populating the chat history, similarly to how I have populated the chat history using the database. This would essentially reduce my database chat history to just one string. I can retrieve the previous interaction id output but it doesn’t seem possible to retrieve the input.
In the logs, the previous_interaction_id is in the input and I cannot retrieve this. Is this not possible for security reasons?
I could save the full history as well as the previous_interaction_id and just use the previous_interaction_id to continue the chat, but then it will all unlink after the 55 day cache removal period. I could look to send full history if the previous_interaction_id isn’t available, but the latest chat interaction might still be live, but the interaction 7 responses ago might have been deleted.
So, has anyone managed to retrieve the previous interaction input? Is it possible to get the previous_interaction_id of the previous_interaction_id?
Thank you for the long read and I am open to any ideas or responses.