Repository navigation
test(calidad): grabar y reproducir respuestas del motor - #31
Conversation
MotorGrabado guarda en SQLite la respuesta a cada pedido y la reutiliza: un cambio del post-proceso se mide gratis contra las mismas respuestas. medir_calidad.py: --grabacion, --solo-grabado y --repeticiones. Gemini cuenta los tokens que factura y la medición muestra el costo real. La hoja de revisión pregunta qué falla. Corrige un ejemplo que se colaba en cada pedido aunque la app no manda ejemplos.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ebf8c599a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def clave_del_pedido(motor: str, lote: Lote, repeticion: int = 0) -> str: | ||
| """Huella del pedido: el mismo motor, las mismas instrucciones y los mismos textos dan la misma clave.""" | ||
| datos = "\x00".join((str(repeticion), motor, sistema(lote), usuario(lote))) |
There was a problem hiding this comment.
Include the endpoint in the recording key
When --motor personalizado is run with a different --direccion but the same model and prompt, self.nombre remains personalizado:<modelo>, so this key treats both endpoints as the same engine. Reusing the recording can therefore return the first endpoint’s response instead of querying the newly configured one, or make --solo-grabado report a hit for the wrong endpoint.
Useful? React with 👍 / 👎.
| uso_antes = list(_uso(motor)) | ||
| resultados = {ambito: traductor.traducir(textos, ambito, pistas) for ambito, textos in por_ambito.items()} |
There was a problem hiding this comment.
Count review requests in the reported spend
When --revisar is enabled, this snapshot and the following _gasto calculation cover only the initial translations; revision.revisar_y_corregir makes additional motor requests afterward, but the second measurement never records their usage. The displayed real cost and total API spend are therefore understated for reviewed runs.
Useful? React with 👍 / 👎.
Ola 0 del plan de calidad máxima. Gemini no responde igual dos veces (~67 % de textos idénticos entre corridas), así que su ruido tapaba el efecto de los cambios del proceso.
Qué cambia
motores/grabadora.py(MotorGrabado): envuelve un motor y guarda en SQLite la respuesta a cada pedido, con la huella exacta del pedido.--solo-grabadonunca llama a la API.medir_calidad.py: opciones--grabacion,--solo-grabadoy--repeticiones N.usage_metadata). Cada medición muestra el costo real y el total gastado.CANTIDAD_EN_LA_APP = 0), porque el tope se miraba después de agregar el primero.Línea base grabada (Gemini 3.8 Flash, 3 repeticiones, US$ 0,42 en total)
Reproducirla da los mismos números con US$ 0.
Verificación
verificar.py --rapidoen verde.tests/test_grabadora.py, una de ellas sobre la reproducción exacta con 4 hilos.