googleapis / googleapis/python-genai

Support editing the last prompt with full input options (Text, Media & Audio) in ChatSession

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

Descrizione

### Problem Statement
When editing the last sent prompt in a chat flow, the interface should support all input modes present in the main prompt bar, specifically media attachments (photos/files) and microphone/voice dictation.

Currently, users can only edit text strings, requiring them to delete or rewrite messages from scratch if they forget to attach a photo or want to correct a prompt using voice input.

### Proposed Solution
In `python-genai`, `ChatSession` should provide a native method to update the last prompt with text, media, or audio/voice inputs and regenerate the response.

### Example API Usage
```python
chat = client.chats.create(model="gemini-2.5-flash")
chat.send_message("Initial text prompt")

# Easily update the last prompt with full input options
chat.update_last_prompt(
text="Updated prompt text",
image=pil_image, # Support for photos/files
audio=audio_bytes # Support for voice/dictation
)
response = chat.regenerate_last_turn()

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.