Saltar al contenido

Turn a sentence into a filter

Módulo Settings

POST/aurora/filteraurora.filter

Builds a filter on one collection from a sentence, shows it as an ADR 0003 query string and proposes a saved view (`savedViews.create`) for confirmation. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.

  • Requiere la capacidad home.dashboard.read.
  • Alcances de OAuth: home.
  • Envía el encabezado Idempotency-Key. Una repetición con la misma clave devuelve la respuesta original.
  • Estados de error: 400, 401, 409, 422, 429. Los errores son detalles de problema RFC 9457.

Cuerpo de la solicitud: AuroraFilterRequest

aurora.filter: AuroraFilterRequest
CampoTipoObligatorioDescripción
sentencestringSíThe sentence to turn into a filter.Restricciones: length 1 to 500
collectionsarray of stringSíCollections the filter may target.
time_zonestringSíTime zone the caller works in. Relative dates such as this month or overdue resolve on the org's calendar (its locale.time_zone setting), never on UTC.Restricciones: pattern ^[A-Za-z_]+(\/[A-Za-z0-9_+-]+)*$
fieldsarray of objectNoA page's own filters, offered instead of the API fields of the first collection: names, types, values and operators only, never record data. Restricted columns are never offered.
{
  "sentence": "blocked permits for Miami shows this month",
  "collections": [
    "permits"
  ],
  "time_zone": "America/New_York",
  "fields": [
    {
      "name": "overdue",
      "type": "boolean",
      "ops": [
        "eq"
      ]
    }
  ]
}

Respuesta 200: AuroraResult

aurora.filter: AuroraResult
CampoTipoObligatorioDescripción
outcome"answer" | "no_answer" | "failed"Síanswer, no_answer (the data does not support an answer; `missing` says why) or failed (the model call failed and was logged).
ai_generatedtrueSíAlways true: the content is AI-generated and is labeled so (EU AI Act Article 50).
request_idstring (uuid) | nullSíIdentifier of the logged AI request; null when no model was called.
modelstring | nullSíModel that answered.Restricciones: length 1 to 100
missingstring | nullSíWhat the data lacks, for no_answer.Restricciones: length 1 to 500
failure_codestring | nullSíWhy the request failed.Restricciones: length 1 to 64
answerobjectNoThe feature's answer for outcome answer, shaped per operation; null otherwise.
suggestionsarray of AuroraProposalSíChanges stored for confirmation.
{
  "outcome": "answer",
  "ai_generated": true,
  "request_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "model": "claude-sonnet-5-5",
  "missing": "No budget lines exist yet.",
  "failure_code": "model_error",
  "answer": {
    "text": "One permit is blocked: Fire Marshal Permit.",
    "citations": []
  },
  "suggestions": [
    {
      "suggestion_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
      "operation_id": "savedViews.create",
      "summary": "Save the view Blocked Miami Permits."
    }
  ]
}

Ejemplos de código

curl -X POST "$XOS_BASE_URL/aurora/filter" \
  -H "Authorization: Bearer $XOS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"sentence":"blocked permits for Miami shows this month","collections":["permits"],"time_zone":"America/New_York","fields":[{"name":"overdue","type":"boolean","ops":["eq"]}]}'
const { data } = await xos.aurora.filter({
    "sentence": "blocked permits for Miami shows this month",
    "collections": [
      "permits"
    ],
    "time_zone": "America/New_York",
    "fields": [
      {
        "name": "overdue",
        "type": "boolean",
        "ops": [
          "eq"
        ]
      }
    ]
  });
response = xos.aurora.filter({"sentence": "blocked permits for Miami shows this month", "collections": ["permits"], "time_zone": "America/New_York", "fields": [{"name": "overdue", "type": "boolean", "ops": ["eq"]}]})
xos aurora filter --data '{"sentence":"blocked permits for Miami shows this month","collections":["permits"],"time_zone":"America/New_York","fields":[{"name":"overdue","type":"boolean","ops":["eq"]}]}'