Magisterium AI

引用

Magisterium AI APIはOpenAI APIに準拠しており、レスポンスオブジェクトにいくつかの追加があります。1つの追加はcitationsフィールドです。

json
{
  "object": "chat.completion",
  "created": 1630000000,
  "model": "magisterium-1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "カトリック教会の信仰と道徳に関する教えは、聖書に深く根ざしています[...]",
      },
      "finish_reason": "stop",
    },
  ],
  "citations": [
    {
      "cited_text": "34. 道徳的問題に関する教会の教えは、理性や論拠だけでなく、聖書やキリスト教の伝統にも基づいています[...]",
      "document_title": "命を大切にすること",
      "document_index": 0,
      "document_author": "イギリス・ウェールズのカトリック司教会議",
      "document_reference": "34"
    }
  ]
  // 他のフィールド ...
}

ストリーミング

citationsフィールドは、ストリームが有効なときにも含まれますが、finish_reasonが含まれる最後のチャンクのみで一度だけです。

例えば:

json
{
  "object": "chat.completion.chunk",
  "choices": [
    {
      "index": 0,
      "delta": {},
      "finish_reason": "stop",
    },
  ],
  "citations": [
    {
      "cited_text": "34. 道徳的問題に関する教会の教えは、理性や論拠だけでなく、聖書やキリスト教の伝統にも基づいています[...]",
      "document_title": "命を大切にすること",
      "document_index": 0,
      "document_author": "イギリス・ウェールズのカトリック司教会議",
      "document_reference": "34"
    }
  ]
  // 他のフィールド ...
}

スキーマ

citationsフィールドは以下のフィールドを持つオブジェクトの配列です:

フィールド名タイプ説明
cited_textstring引用されたテキスト。
cited_text_headingstring / null与えられた引用の最も近い見出し。
document_titlestring / nullドキュメントのタイトル。
document_indexintegerレスポンスオブジェクト内のドキュメントのインデックス。インデックスはゼロベースであり、インライン脚注の番号付けは1ベースです。
document_authorstring / nullドキュメントの著者。
document_yearstring / nullドキュメントが発行された年。
document_referencestring / null引用の参照番号。
source_urlstringソースURL。