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:
| Campo | Tipo | Descripción |
|---|---|---|
| cited_text | string | El texto citado. |
| cited_text_heading | string / null | El encabezado más próximo de la cita. |
| document_title | string / null | El título del documento. |
| document_index | integer | Índice del documento en el objeto de respuesta. El índice es base cero; las notas al pie son base uno. |
| document_author | string / null | El autor del documento. |
| document_year | string / null | El año de publicación del documento. |
| document_reference | string / null | El número de referencia de la cita. |
| source_url | string | La URL de la fuente. |