Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion servidor-guia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ página ni en una variable `VITE_*`, porque Vite las copia al código que descar
## Cómo decide

1. La persona escribe su caso («mi hijo tiene asma») al final de la entrada guiada.
2. Claude (`claude-opus-5-5`, esfuerzo bajo, salida estructurada estricta) solo puede devolver valores de un
2. Claude (`claude-sonnet-5-5`, esfuerzo bajo, salida estructurada estricta) solo puede devolver valores de un
**catálogo cerrado** (`viz/src/lib/caso.ts`): una de las tres variables, uno de los cinco grados, indicadores
y temas no medidos de una lista fija. Cada ajuste trae la frase del caso que lo justifica.
3. El servidor y la página descartan todo lo que no está en el catálogo y todo ajuste cuya frase **no aparece en
Expand Down
2 changes: 1 addition & 1 deletion servidor-guia/claude.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test('interpretarCaso asks Claude for strict JSON with the closed schema, low ef
await interpretarCaso(cliente, pedido)
const p = pedidos[0] as Record<string, any>
assert.equal(p.model, MODELO)
assert.equal(MODELO, 'claude-opus-5-5')
assert.equal(MODELO, 'claude-sonnet-5-5')
assert.equal(p.output_config.effort, 'low')
assert.equal(p.output_config.format.type, 'json_schema')
assert.deepEqual(p.output_config.format.schema.required, ['ajustes', 'indicadores', 'no_medido'])
Expand Down
6 changes: 3 additions & 3 deletions servidor-guia/claude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '../viz/src/lib/caso.ts'
import { limpiarGuia, type Guia, type PedidoGuia } from '../viz/src/lib/guia.ts'

export const MODELO = 'claude-opus-5-5'
export const MODELO = 'claude-sonnet-5-5'
/** On a policy decline the API re-runs the request on a fallback model inside the same call. */
const FALLBACK = { betas: ['server-side-fallback-2026-07-01'], fallbacks: 'default' as const }

Expand Down Expand Up @@ -57,7 +57,7 @@ function texto(r: { content: { type: string; text?: string }[] }): string {
export async function interpretarCaso(cliente: ClienteClaude, pedido: PedidoCaso, signal?: AbortSignal): Promise<Interpretacion | null> {
const r = await cliente.beta.messages.create({
model: MODELO,
max_tokens: 4000,
max_tokens: 16000, // adaptive thinking also spends from this cap; only used tokens are billed
...FALLBACK,
// A classification: low effort is enough, and the schema keeps the output in the catalog.
output_config: { effort: 'low', format: { type: 'json_schema', schema: ESQUEMA_INTERPRETACION } },
Expand Down Expand Up @@ -105,7 +105,7 @@ export function validarPedidoGuia(raw: unknown): PedidoGuia | null {
export async function redactarGuia(cliente: ClienteClaude, pedido: PedidoGuia, signal?: AbortSignal): Promise<Guia | null> {
const r = await cliente.beta.messages.create({
model: MODELO,
max_tokens: 2000,
max_tokens: 16000,
...FALLBACK,
output_config: { effort: 'low' },
system: [{ type: 'text', text: INSTRUCCIONES_GUIA, cache_control: { type: 'ephemeral' } }],
Expand Down
Loading