googleapis / googleapis/python-genai

[Interactions API] `interactions.get` with `include_input=True` returns `None` for user input during `requires_action` state

Aperta
#2,823 1 commento 0 reazioni 1 assegnatario Rivendicata da @Venkaiahbabuneelam Vedi su GitHub
priority: p2 type: bug
Lingua principale
Python
Stelle
4k
Fork
1k
Merge medio
2g 12h
PR unite (30g)
41

Descrizione

### Bug Description
The `interactions.get(id="...", include_input=True)` method completely omits the initial user prompt and fails to return any `user_input` fields or steps if the interaction stopped at a `requires_action` (function call) state. This contradicts the official documentation which states: *"The stored resource (retrieved via interactions.get) also includes user_input steps for full context"*.

### To Reproduce
1. Call `client.interactions.create()` with a text input and a `tools` declaration.
2. The model correctly returns a `function_call` step, setting the interaction status to `requires_action`.
3. Call `client.interactions.get(id=..., include_input=True)` on that exact interaction ID.

### Code Example
```python
from google import genai

light_tool = {
"type": "function",
"name": "set_light_values",
"description": "Sets the brightness of a light.",
"parameters": {
"type": "object",
"properties": {"brightness": {"type": "integer"}},
"required": ["brightness"]
}
}

client = genai.Client()

# 1. Create interaction that triggers a function call
interaction = client.interactions.create(
model="gemini-3.5-flash-lite",
input="Turn the lights down to 20%",
tools=[light_tool],
)

# 2. Fetch the interaction with include_input=True
fetched = client.interactions.get(id=interaction.id, include_input=True)

# 3. Bug demonstration
print("Expected string, Got:", fetched.input)
# Expected: "Turn the lights down to 20%"
# Actual: None

print("Expected 'user_input' step, Got:", [s.type for s in fetched.steps])
# Expected: Includes 'user_input'
# Actual: ['thought', 'function_call']
```

### Expected Behavior
The returned payload should populate the top-level `input` string field or include a clear `user_input` step within the history timeline so developers can map the pending tool call back to the original user intent.

### Actual Behavior
The `input` attribute is strictly `None`, and the original prompt text is completely stripped/unavailable from the fetched resource until the entire lifecycle is completed.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.