Curated history keeps half a user turn when the model turn is invalid
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 62/100
Direzione di ricerca
Inizia da _extract_curated_history in chats.py, in particolare dal singolo curated_history.pop() alle righe 107-108, raggiunto tramite chats.create(history=...) alla riga 136. Leggi google/genai/tests/chats/test_get_history.py, specialmente test_history_with_consecutive_valid_user_inputs (riga 152) e test_history_with_invalid_turns (riga 401), che delimitano il comportamento previsto. Riproduci con il turno utente multi-content più il turno di modello vuoto mostrati nell'issue. Fatto significa che un turno modello non valido elimina l'intero user run precedente, non un singolo content, e la suite get-history passa.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Title: _extract_curated_history drops only the last user content when a model turn is invalid
An invalid model turn makes _extract_curated_history call curated_history.pop() once (chats.py:107-108). A user turn of two or more Content objects went in one at a time, so one pop removes part of it. The rest stays in the curated history with no model answer behind it.
The way in is chats.create(history=...), the only caller of that function (chats.py:136): a caller persisting raw exchanges stores one content per function response, and a blocked model turn as an empty content.
At 618f0aa, through the public constructor:
$ /var/tmp/p9bL16/genai/.venv/bin/python probe_hist2.py
import: /var/tmp/p9bL16/genai/google/genai/__init__.py
curated: [('user', 1)]
comprehensive: [('user', 1), ('user', 1), ('model', 0)]
hist = [
C(role="user", parts=[P(text="what is the weather")]),
C(role="user", parts=[P.from_function_response(name="get_weather", response={"c": 21})]),
C(role="model", parts=[]), # invalid model turn
]
chat = client.chats.create(model="gemini-2.0-flash", history=hist)
The question survives and the tool result behind it disappears, so the next send_message sends a user turn the model already failed on, minus its evidence.
$ python -m pytest google/genai/tests/chats/test_get_history.py -q
17 passed, 1 warning in 0.06s
# not run: the replay suites, which need recorded sessions
Two of those tests bracket the gap. test_history_with_consecutive_valid_user_inputs (test_get_history.py:152) makes back-to-back user contents supported input, and test_history_with_invalid_turns (:401) sets the intent that the whole rejected user turn goes. One pop meets that intent only where the turn is a single content.
There is no CODEOWNERS here and every merge on GitHub is the Copybara import, so @jaycee-li, I am going by your last commit on this file. Should the pop walk back over the whole user run? I can write the diff out here if that helps the internal fix.
- Lingua principale
- Python
- Stelle
- 4k
- Fork
- 1k
- Merge medio
- 1g 17h
- PR unite (30g)
- 52
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di googleapis/python-genai
-
[Bug]: Unsubscripted typing.List and typing.Dict crash convert_if_exist_pydantic_model in AFCForse già presa @chauvuusvn l’ha presa 3 giorni fa. Apertapriority: p2 type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
googleapis/python-genai#3044 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Name collision in google.genai.interactions: triggers.Interaction shadows response model Interaction in static type checkersForse già presa @Venkaiahbabuneelam l’ha presa 8 giorni fa. Apertapriority: p2 type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
googleapis/python-genai#3013 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
googleapis/python-genai#3056 ·
I maintainer di solito rispondono entro 1 giorno
-
Vertex batch embeddings (gemini-embedding-001): no way to attach billing labels; job and row labels never reach Cloud BillingForse già presa @Venkaiahbabuneelam l’ha presa 1 giorno fa. Apertapriority: p3 type: question
googleapis/python-genai#3053 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
priority: p2 type: bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
googleapis/python-genai#3031 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di googleapis/python-genai
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
FuRongJun-1999/dsh-memory#65 ·
I maintainer di solito rispondono entro 1 giorno
-
ci needs-ac
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Ikalus1988/MisakaNet#2930 ·
I maintainer di solito rispondono entro 1 giorno
-
`FakeBackendV2.run` fails with `NoiseError` on circuits with delays on qubits where T2 > 2·T1Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Qiskit/qiskit-aer#2466 ·
-
area/cli
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100