-
Notifications
You must be signed in to change notification settings - Fork 781
Open
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- Programming language: Python
- OS: Windows 11
- Language runtime version: 3.10
- Package version: google-genai==1.64.0
Steps to reproduce
I’m trying to reuse an existing interaction_id by passing it as previous_interaction_id to client.interactions.create, but every call returns a new interaction.id instead of continuing the same interaction.
Minimal repro:
from google import genai
client = genai.Client(api_key="YOUR_API_KEY")
def get_expression_analysis(user_text: str, interaction_id: str | None = None):
interaction = client.interactions.create(
model="gemini-2.5-flash",
input=user_text,
previous_interaction_id=interaction_id,
response_mime_type="application/json",
)
print("sent previous_interaction_id =", interaction_id)
print("got interaction.id =", interaction.id)
return interaction.id, interaction.outputs[-1].text
# 1) First call – no previous interaction id
first_id, out1 = get_expression_analysis("Hi, how are you?", interaction_id=None)
# 2) Second call – pass previous interaction id from first call
second_id, out2 = get_expression_analysis("Follow-up message", interaction_id=first_id)
print("first_id :", first_id)
print("second_id:", second_id)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.