Magisterium AI

Citas

La API de Magisterium AI se ajusta a la API de OpenAI, con algunas adiciones en el objeto de respuesta. Una de ellas es el campo citations.

json
{
  "object": "chat.completion",
  "created": 1630000000,
  "model": "magisterium-1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The Catholic Church's teaching on faith and morals is deeply rooted in Scripture [...]",
      },
      "finish_reason": "stop",
    },
  ],
  "citations": [
    {
      "cited_text": "34. Church teaching on moral matters is founded not only on reason and argument, but also on Scripture and the Christian tradition [...]",
      "document_title": "Cherishing Life",
      "document_index": 0,
      "document_author": "Catholic Bishops' Conference of England and Wales",
      "document_reference": "34"
    }
  ]
  // other fields ...
}

Streaming

El campo citations también se incluye cuando el streaming está activado, pero solo en un fragmento: el último que incluye finish_reason.

Por ejemplo:

json
{
  "object": "chat.completion.chunk",
  "choices": [
    {
      "index": 0,
      "delta": {},
      "finish_reason": "stop",
    },
  ],
  "citations": [
    {
      "cited_text": "34. Church teaching on moral matters is founded not only on reason and argument, but also on Scripture and the Christian tradition [...]",
      "document_title": "Cherishing Life",
      "document_index": 0,
      "document_author": "Catholic Bishops' Conference of England and Wales",
      "document_reference": "34"
    }
  ]
  // other fields ...
}

Esquema

El campo citations es un array de objetos con los siguientes campos:

CampoTipoDescripción
cited_textstringEl texto citado.
cited_text_headingstring / nullEl encabezado más próximo de la cita.
document_titlestring / nullEl título del documento.
document_indexintegerÍndice del documento en el objeto de respuesta. El índice es base cero; las notas al pie son base uno.
document_authorstring / nullEl autor del documento.
document_yearstring / nullEl año de publicación del documento.
document_referencestring / nullEl número de referencia de la cita.
source_urlstringLa URL de la fuente.