可靠的引用有助於建立信任,也方便讀者核實回應內容。本指南說明如何準備可引用的資料,以及如何在提示詞中使用 OpenAI 模型熟悉的格式,讓模型正確標註來源。
設計引用系統時,你需要決定哪些資料可以引用、清楚呈現這些資料、指示模型如何引用,並在向使用者顯示回應前驗證引用結果。
本指南涵蓋五個與模型直接相關的要素:
可引用單位:定義模型可以引用哪些內容。
資料呈現方式:以清楚、有結構的格式呈現來源資料。
引用格式:明確指定模型應使用的引用格式。
提示詞指示:告訴模型何時需要引用,以及如何正確標註來源。
引用解析:從模型回應中擷取引用,供後續處理使用。
撰寫提示詞前,請先明確定義模型可以引用哪些內容。常見選項如下:
可引用單位
適用情境
限制
範例
文件
只需指出答案出自哪份文件。
精確度較低。
如果只需指出哪份文件支持某項說法,可以引用整本員工手冊。
區塊/片段
需要兼顧簡易性與精確度。
無法精確到行。
引用含有該條款的合約段落,或檢索到的對應片段。
行範圍
需要指出作為依據的確切原文。
對模型而言難度較高。
當使用者需要核對特定段落時,引用 L42-L47。
理想的可引用單位應具備以下特性:
識別方式一致:每次執行時,同一來源都應保有相同的 ID。
容易查閱:讀者應能閱讀該單位的內容並理解其上下文。
大小適中:內容要足以表達完整意思,範圍也要夠小,才能精確指出依據。
對大多數系統而言,預設以區塊為單位最合適。與逐行標註相比,模型通常更容易引用區塊。與引用整份文件相比,引用區塊也更方便使用者查閱。
如果資料呈現得不夠清楚,模型就無法引用。無論資料由工具傳回,還是直接加入提示詞,都請確保資料包含以下項目:
穩定的來源 ID:使用一致的識別碼,例如 file1 或 block1。
易讀的文字:以清楚的格式呈現來源內容。
中繼資料(選用):網址、時間戳記、標題等有助於理解上下文的資訊。
可引用資料範例 Citation Marker: {CITATION_START}cite{CITATION_DELIMITER}file0{CITATION_STOP}
Title: Employee Handbook
URL: https://company.example/handbook
Updated: 2026-03-01
[L1] Employees may work remotely up to three days per week.
[L2] Additional remote days require manager approval.
[L3] Exceptions may apply for approved accommodations.
來源 ID 與定位資訊: 來源 ID 是由模型產生的穩定識別碼,例如 block1。定位資訊則指出使用者介面中要醒目標示的確切位置,例如 lines L8-L13 或
Paragraph 21。一般而言,模型應輸出來源 ID,由系統解析定位資訊或標示對應位置。太早將兩者混用,容易增加格式錯誤。
你需要明確定義模型應產生的引用格式。格式應清楚、一致,讓模型能穩定地重現。
下表列出建議的引用格式與標記。我們強烈建議採用這些標記,因為它們與模型訓練時使用的標記非常接近。如果選擇其他標記值,請盡量維持相似的整體引用格式。
組成項目
用途
建議值
CITATION_START
表示引用標記的開頭。
\ue200
引用類別
指出引用類型。所有支援的來源一律使用 cite。
cite
CITATION_DELIMITER
分隔標記內的欄位。
\ue202
來源 ID
識別引用的單位。turn# 是回合編號,item# 則代表特定檔案、區塊或網址。
turn0file1, turn0block1, turn0url1
定位資訊(選用)
將引用範圍縮小到特定片段。
L8-L13
CITATION_STOP
表示引用標記的結尾。
\ue201
每呼叫一次工具,turnN 就遞增一次。同一次呼叫傳回多筆結果時,編號只遞增一次,各個來源以 file0、file1 等後綴區分。在只產生一次回應的系統中,只有當模型在回答前恰好呼叫一次工具時,所有引用的來源 ID 才都會以
turn0… 開頭。如果模型多次呼叫工具,你可能會看到 turn0fileX、turn1fileX 等來源 ID。
{CITATION_START}<citation_family>{CITATION_DELIMITER}<source_id>{CITATION_DELIMITER}<locator>{CITATION_STOP}
{CITATION_START}cite{CITATION_DELIMITER}turn0file1{CITATION_DELIMITER}L8-L13{CITATION_STOP}
如果系統不使用定位資訊,請省略該欄位:
{CITATION_START}cite{CITATION_DELIMITER}turn0file1{CITATION_STOP}
為了讓引用盡可能準確,請使用模型熟悉的引用格式。自訂或不熟悉的格式會增加模型的認知負擔,導致引用錯誤,尤其是在以下情況:
推理投入較低時,模型能用來修正格式錯誤的推理預算較少。
任務複雜度高時,模型會將大部分推理預算用於解決任務本身,只剩少量預算可用來修正引用語法。
以下建議的引用格式接近模型熟悉的格式。你可以直接採用,也可以依系統需求調整。
如果要自行撰寫提示詞,請明確說明:
標記的確切語法。
引用應放在哪裡。
何時應引用、何時不應引用。
有多個來源支持同一說法時,應如何引用。
禁止使用哪些格式。
缺乏依據時該如何處理。
建議的提示詞指示 請使用下列格式,向模型提供明確指示:
## 引用
結果由「tool_1」傳回。 `tool_1` 傳回的每則訊息都稱為一個「來源」。請在訊息中找出第一個符合 【turn\d+\w+\d+】 格式的字串,例如 【turn2file1】。括號內的「turn2file1」就是這個來源的參照 ID。
引用用來指出回應的依據來自 `tool_1` 的哪些來源。一個引用可以指向單一來源,也可以指向多個來源。
引用單一來源時,必須寫成 {CITATION_START}cite{CITATION_DELIMITER}turn\d+\w+\d+{CITATION_STOP}(例如 {CITATION_START}cite{CITATION_DELIMITER}turn2file5{CITATION_STOP})。
引用多個來源時,必須在同一個引用標記內依序列出各來源的參照 ID,格式為 {CITATION_START}cite{CITATION_DELIMITER}turn\d+\w+\d+{CITATION_DELIMITER}turn\d+\w+\d+{CITATION_DELIMITER}...{CITATION_STOP}(例如 {CITATION_START}cite{CITATION_DELIMITER}turn2file5{CITATION_DELIMITER}turn2file1{CITATION_DELIMITER}...{CITATION_STOP})。
引用必須放在 Markdown 粗體、斜體或圍欄式程式碼區塊之外,否則無法正確顯示。引用放在程式碼區塊外時,不得與區塊的結束標記位於同一行。
在回應正文中寫出符合 turn\d+\w+\d+ 格式的參照 ID 時,必須將它放在 {CITATION_START}...{CITATION_STOP} 之間。
- 除非使用者指定引用位置,否則請將引用放在段落末尾。如果段落較長,也可以在段落中就近標註。
- 引用必須放在標點符號之後。
- 不得將所有引用集中放在回應末尾。
- 不得讓引用單獨占一行或一段。 如果希望模型也輸出定位資訊,例如行範圍(L1-L22),請在提示詞中明確指定:
只有具備對應引用標記的工具結果才能引用。凡是採用這個工具傳回且具備標記的結果,都*必須*使用下列格式引用:
`\ue200cite\ue202turn0file0\ue202L8-L13\ue201`。
請勿嘗試引用沒有對應引用標記的項目,這些項目並非供引用之用。
引用中務必包含行範圍。
提升接地品質的選用指示 如果需要提升模型回應的接地品質,通常值得加入以下規則。請依使用情境的需求調整這些指示。
1 2 3 4 5 6 7 8 9 10 11 12 13 < extra_considerations_for_citations >
- **相關性:** 只納入能支持回應中相應敘述的搜尋結果與引用。無關的來源會對使用者的信任造成永久損害。
- **多樣性:** 回答時必須採用來自不同網域的來源,並標註各項說法的出處。
- **可信度:** 為了讓回應值得信賴,必須依據高品質網站的資料。除非是唯一來源,否則應忽略信譽較差的網站所提供的資訊。
- **忠實呈現:** 每一處引用都必須準確反映來源內容,不得斷章取義。
判斷網站或來源的品質時,請考慮具體情境。
- 如果有多種觀點,請引用涵蓋各方意見的來源,兼顧平衡與完整性。
- 如果可靠來源的說法不一致,每個主要觀點都至少要引用一個高品質來源。
- 超過半數的引用必須來自在該主題上公認具有權威性的出版機構或媒體。
- 對於有爭議的議題,每個主要觀點都至少要引用一個能代表該觀點的可靠來源。
- 不得僅因相關來源的品質較低,就忽略其內容。
</ extra_considerations_for_citations >
模型輸出引用後,你需要從回應文字中擷取引用,才能在向使用者顯示答案前解析來源 ID、顯示連結或移除原始標記。
你可以將下列輔助函式直接複製到應用程式中。這些函式可解析單一來源或多個來源的引用,以及選用的行範圍定位資訊,同時保留原文中的字元偏移量。
此範例僅支援以行號定位。如果系統採用其他定位格式,請調整範例。
後處理範例 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 const CITATION_START = "\uE200";
const CITATION_DELIMITER = "\uE202";
const CITATION_STOP = "\uE201";
const SOURCE_ID_RE = /^[A-Za-z0-9_-]+$/;
const LINE_LOCATOR_RE = /^L\d+(?:-L\d+)?$/;
// Extract citations such as:
//
// {CITATION_START}cite{CITATION_DELIMITER}turn0file0{CITATION_STOP}
// {CITATION_START}cite{CITATION_DELIMITER}turn0file0{CITATION_DELIMITER}L8-L13{CITATION_STOP}
// {CITATION_START}cite{CITATION_DELIMITER}turn0search0{CITATION_DELIMITER}turn1news2{CITATION_STOP}
function extractCitations(text: string, { families = ["cite"] } = {}) {
if (families.length === 0) {
return [];
}
const familyPattern = families
.map((family) => family.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
.join("|");
const tokenRe = new RegExp(
`${CITATION_START}(?<family>${familyPattern})${CITATION_DELIMITER}(?<body>[\\s\\S]*?)${CITATION_STOP}`,
"g"
);
const citations = [];
for (const match of text.matchAll(tokenRe)) {
const body = match.groups?.body ?? "";
const parts = body
.split(CITATION_DELIMITER)
.map((part: string) => part.trim())
.filter(Boolean);
if (parts.length === 0) {
continue;
}
let locator = null;
const lastPart = parts[parts.length - 1];
if (LINE_LOCATOR_RE.test(lastPart)) {
locator = parts.pop() ?? null;
}
if (
parts.length === 0 ||
parts.some((part: string) => !SOURCE_ID_RE.test(part))
) {
continue;
}
citations.push({
raw: match[0],
family: match.groups?.family ?? "",
source_ids: parts,
locator,
start: match.index ?? 0,
end: (match.index ?? 0) + match[0].length,
});
}
return citations;
}
function stripCitations(
text: string,
citations: ReturnType<typeof extractCitations>
) {
let cleanText = text;
const sortedCitations = Array.from(citations).sort(
(left, right) => right.start - left.start
);
for (const citation of sortedCitations) {
cleanText =
cleanText.slice(0, citation.start) + cleanText.slice(citation.end);
}
return cleanText;
} 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87 import re
from collections.abc import Iterable
from typing import TypedDict
CITATION_START = " \ue200 "
CITATION_DELIMITER = " \ue202 "
CITATION_STOP = " \ue201 "
SOURCE_ID_RE = re.compile( r " ^[A-Za-z0-9_-] + $ " )
LINE_LOCATOR_RE = re.compile( r " ^ L \d + (?: -L \d + ) ? $ " )
class Citation ( TypedDict ):
raw: str
family: str
source_ids: list[ str ]
locator: str | None
start: int
end: int
def extract_citations (
text: str ,
* ,
families: tuple[ str , ... ] = ( "cite" ,),
) -> list[Citation]:
"""
Extract citations such as:
{CITATION_START}cite{CITATION_DELIMITER}turn0file0{CITATION_STOP}
{CITATION_START}cite{CITATION_DELIMITER}turn0file0{CITATION_DELIMITER}L8-L13{CITATION_STOP}
{CITATION_START}cite{CITATION_DELIMITER}turn0search0{CITATION_DELIMITER}turn1news2{CITATION_STOP}
"""
if not families:
return []
family_pattern = "|" .join(re.escape(family) for family in families)
token_re = re.compile(
rf " { re.escape( CITATION_START ) } "
rf "(?P<family> { family_pattern } )"
rf " { re.escape( CITATION_DELIMITER ) } "
rf "(?P<body>.*?)"
rf " { re.escape( CITATION_STOP ) } " ,
re. DOTALL ,
)
citations: list[Citation] = []
for match in token_re.finditer(text):
parts = [part.strip() for part in match.group( "body" ).split( CITATION_DELIMITER )]
parts = [part for part in parts if part]
if not parts:
continue
locator = None
if LINE_LOCATOR_RE .fullmatch(parts[ - 1 ]):
locator = parts.pop()
if not parts or any ( not SOURCE_ID_RE .fullmatch(part) for part in parts):
continue
citations.append(
{
"raw" : match.group( 0 ),
"family" : match.group( "family" ),
"source_ids" : parts,
"locator" : locator,
"start" : match.start(),
"end" : match.end(),
}
)
return citations
def strip_citations (text: str , citations: Iterable[Citation]) -> str :
"""
Remove raw citation markers from text using offsets returned by
extract_citations().
"""
clean_text = text
for citation in sorted (citations, key =lambda item: item[ "start" ], reverse = True ):
clean_text = clean_text[: citation[ "start" ]] + clean_text[citation[ "end" ] :]
return clean_text 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 // Start and End are UTF-8 byte offsets, suitable for Go string slicing.
type Citation struct {
Raw, Family string
SourceIDs []string
Locator string
Start, End int
}
var sourceID = regexp.MustCompile(`^[A-Za-z0-9_-]+$`)
var lineLocator = regexp.MustCompile(`^L\d+(?:-L\d+)?$`)
func extractCitations(text string, families []string) []Citation {
citations := []Citation{}
if len(families) == 0 {
return citations
}
escaped := make([]string, len(families))
for i, family := range families {
escaped[i] = regexp.QuoteMeta(family)
}
token := regexp.MustCompile("(?s)\uE200(" + strings.Join(escaped, "|") + ")\uE202(.*?)\uE201")
for _, match := range token.FindAllStringSubmatchIndex(text, -1) {
parts := []string{}
for _, part := range strings.Split(text[match[4]:match[5]], "\uE202") {
if part = strings.TrimSpace(part); part != "" {
parts = append(parts, part)
}
}
locator := ""
if len(parts) > 0 && lineLocator.MatchString(parts[len(parts)-1]) {
locator = parts[len(parts)-1]
parts = parts[:len(parts)-1]
}
valid := len(parts) > 0
for _, part := range parts {
if !sourceID.MatchString(part) {
valid = false
break
}
}
if valid {
citations = append(citations, Citation{
text[match[0]:match[1]],
text[match[2]:match[3]],
parts,
locator,
match[0],
match[1],
})
}
}
return citations
}
func stripCitations(text string, citations []Citation) string {
sorted := append([]Citation(nil), citations...)
sort.Slice(sorted, func(i, j int) bool {
return sorted[i].Start > sorted[j].Start
})
for _, citation := range sorted {
text = text[:citation.Start] + text[citation.End:]
}
return text
} 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 import java.util.*;
import java.util.regex.Pattern;
// Java string offsets are UTF-16 code units, matching substring().
record Citation(
String raw, String family, List<String> sourceIds, String locator, int start, int end) {}
static final Pattern SOURCE_ID = Pattern.compile("^[A-Za-z0-9_-]+$");
static final Pattern LINE_LOCATOR = Pattern.compile("^L\\d+(?:-L\\d+)?$");
static List<Citation> extractCitations(String text, List<String> families) {
var citations = new ArrayList<Citation>();
if (families.isEmpty()) return citations;
var familyPattern =
families.stream().map(Pattern::quote).collect(java.util.stream.Collectors.joining("|"));
var matcher =
Pattern.compile("\uE200(" + familyPattern + ")\uE202(.*?)\uE201", Pattern.DOTALL)
.matcher(text);
while (matcher.find()) {
var parts =
new ArrayList<>(
Arrays.stream(matcher.group(2).split("\uE202"))
.map(String::strip)
.filter(s -> !s.isEmpty())
.toList());
String locator = null;
if (!parts.isEmpty() && LINE_LOCATOR.matcher(parts.get(parts.size() - 1)).matches())
locator = parts.remove(parts.size() - 1);
if (parts.isEmpty() || parts.stream().anyMatch(s -> !SOURCE_ID.matcher(s).matches()))
continue;
citations.add(
new Citation(
matcher.group(),
matcher.group(1),
List.copyOf(parts),
locator,
matcher.start(),
matcher.end()));
}
return citations;
}
static String stripCitations(String text, List<Citation> citations) {
var sorted = new ArrayList<>(citations);
sorted.sort(Comparator.comparingInt(Citation::start).reversed());
for (var citation : sorted)
text = text.substring(0, citation.start()) + text.substring(citation.end());
return text;
} 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 CITATION_START = "\u{E200}"
CITATION_DELIMITER = "\u{E202}"
CITATION_STOP = "\u{E201}"
SOURCE_ID_RE = /\A[A-Za-z0-9_-]+\z/
LINE_LOCATOR_RE = /\AL\d+(?:-L\d+)?\z/
def extract_citations(text, families: ["cite"])
return [] if families.empty?
family_pattern = families.map { |family| Regexp.escape(family) }.join("|")
token_re = Regexp.new(
"#{Regexp.escape(CITATION_START)}" \
"(?<family>#{family_pattern})" \
"#{Regexp.escape(CITATION_DELIMITER)}" \
"(?<body>.*?)" \
"#{Regexp.escape(CITATION_STOP)}",
Regexp::MULTILINE
)
text.enum_for(:scan, token_re).map do
match = Regexp.last_match
next unless match
body = match[:body]
next unless body
parts = body.split(CITATION_DELIMITER).map(&:strip).reject(&:empty?)
locator = parts.pop if parts.last&.match?(LINE_LOCATOR_RE)
next if parts.empty? || parts.any? { |part| !part.match?(SOURCE_ID_RE) }
{
raw: match[0],
family: match[:family],
source_ids: parts,
locator: locator,
start: match.begin(0),
end: match.end(0)
}
end.compact
end
def strip_citations(text, citations)
citations.sort_by { |citation| -citation.fetch(:start) }.each_with_object(text.dup) do |citation, clean|
clean[citation.fetch(:start)...citation.fetch(:end)] = ""
end
end
如果你的系統使用不同格式的來源 ID,請更新 SOURCE_ID_RE 以符合該格式。
以下範例示範兩種常見的引用方式:
透過工具檢索上下文:工具傳回可引用的資料及其 ID。
注入上下文:直接在提示詞中提供可引用的區塊。
如果模型透過工具檢索上下文,並在答案中引用檢索到的內容,請使用這種方式。
請依使用情境所需的精確度選擇可引用單位。以下範例示範幾種可能的工具輸出。
以下是幾種建議的工具輸出格式。不同應用程式使用的工具可能不同,最重要的是採用如範例所示的清楚、一致的結構來呈現輸出。
以行為單位的範例 以下是工具呼叫傳回的結果範例:
Citation Marker: {CITATION_START}cite{CITATION_DELIMITER}turn0file0{CITATION_STOP}
[L1] The service agreement states that termination for convenience requires thirty (30) days’ written notice, unless superseded by a customer-specific addendum.
[L2] In practice, renewal terms auto-extend for successive one-year periods when no written non-renewal notice is received before the deadline.
[L3] Appendix B further clarifies that pricing exceptions must be approved in writing by both Finance and the account owner.
Citation Marker: {CITATION_START}cite{CITATION_DELIMITER}turn0file1{CITATION_STOP}
... 在這個範例中,turn0file0 是穩定的來源 ID,行號則是定位資訊。
以區塊為單位的範例 以下是工具呼叫傳回的結果範例:
Citation Marker: {CITATION_START}cite{CITATION_DELIMITER}turn0file0{CITATION_STOP}
[Block1]
The service agreement states that termination for convenience requires thirty (30) days’ written notice, unless superseded by a customer-specific addendum.
In practice, renewal terms auto-extend for successive one-year periods when no written non-renewal notice is received before the deadline.
Appendix B further clarifies that pricing exceptions must be approved in writing by both Finance and the account owner.
Citation Marker: {CITATION_START}cite{CITATION_DELIMITER}turn0file1{CITATION_STOP}
[Block2]
... 如果想改以區塊為單位引用,建議為每個檢索到的區塊指定獨立且穩定的來源 ID,並沿用相同的雙欄位引用格式,例如 {CITATION_START}cite{CITATION_DELIMITER}turn0file0{CITATION_STOP},無須另外設計全新的引用類別。
## 引用
結果由「tool_1」傳回。 `tool_1` 傳回的每則訊息都稱為一個「來源」。訊息中第一個符合 `turn\\d+file\\d+` 格式的字串就是該來源的參照 ID(例如 `turn0file0` 或 `turn2file1` )。在這個例子中,字串 `turn0file0` 就是來源的參照 ID。
引用用來指出回應的依據來自 `tool_1` 的哪些來源。你可以引用單一來源,也可以引用多個來源。
引用單一來源時,必須使用以下格式:
{CITATION_START}cite{CITATION_DELIMITER}turn\d+file\d+{CITATION_STOP}
如果系統支援以行為單位的引用,引用特定行範圍時必須使用以下格式:
{CITATION_START}cite{CITATION_DELIMITER}turn\d+file\d+{CITATION_DELIMITER}L\d+-L\d+{CITATION_STOP}
引用多個來源時,必須為每個提供依據的來源各輸出一個獨立的引用標記。
在回應正文中寫出 `turn0file0` 這類參照 ID 時,必須將它放在 {CITATION_START}...{CITATION_STOP} 之間。
- 將引用放在有來源支持的句子末尾。如果句子較長,且有多個子句各有依據,也可以在句中就近標註。
- 引用必須放在標點符號之後。
- 只能引用檢索到且能直接支持相應敘述的來源。
- 不得自行編造工具未傳回的來源 ID、行範圍或區塊定位資訊。
- 如果檢索到的多個來源都為同一項說法提供實質依據,必須全部引用。
- 如果檢索到的來源說法不一致,請引用說法相互衝突的來源,並準確說明分歧之處。
輸出範例:
The on-call handoff process is documented in the weekly support sync notes. \ue200cite\ue202turn0file0\ue202L8-L13\ue201
如果你會事先檢索或準備上下文,再將內容直接加入提示詞,請使用這種方式。
注入上下文時,常見做法是使用帶有穩定參照 ID 的明確標籤,將各個來源片段包在標籤內。
1 2 3 4 5 6 7 8 9 10 < BLOCK id = "block1" >
The service agreement states that termination for convenience requires thirty (30) days’ written notice, unless superseded by a customer-specific addendum.
In practice, renewal terms auto-extend for successive one-year periods when no written non-renewal notice is received before the deadline.
Appendix B further clarifies that pricing exceptions must be approved in writing by both Finance and the account owner.
</ BLOCK >
< BLOCK id = "block2" >
Syllabus
</ BLOCK >
...
這樣能清楚界定每個可引用單位,方便模型引用。
## 引用
提示詞將作為依據的上下文劃分為可引用單位,直接提供給你。每個單位的參照 ID 取自該單位的標籤首次出現時所帶的 `id` 屬性值。例如,在 `<BLOCK id="block5"> ... </BLOCK>` 中,來源的參照 ID 是 `block5` 。
這種方式不會呼叫工具,因此沒有需要遞增的工具回合計數器,引用標記也無須使用 `turn#` 前綴。如果系統其他部分採用 `turn0block5` 這類 ID,你可以沿用該格式,也可以使用本例中的 `block5` 這類簡單 ID。每個引用標記中的 ID 都必須與注入上下文中的對應 ID 完全相符。
引用指向提示詞提供的可引用單位。你可以引用單一來源,也可以引用多個來源。
引用單一來源時,必須使用以下格式:
{CITATION_START}cite{CITATION_DELIMITER}<block_id>{CITATION_STOP}
例如:
{CITATION_START}cite{CITATION_DELIMITER}block5{CITATION_STOP}
引用多個來源時,必須為每個提供依據的區塊各輸出一個獨立的引用標記。
在回應正文中寫出區塊 ID 時,必須將它放在 {CITATION_START}...{CITATION_STOP} 之間。
- 將引用放在有來源支持的句子末尾。如果句子較長,且有多個子句各有依據,也可以在句中就近標註。
- 引用必須放在標點符號之後。
- 只能引用所提供的上下文中實際出現的區塊。
- 不得自行編造新的區塊 ID。
- 不得引用外部知識或外部權威來源。
- 如果多個區塊都為同一項說法提供實質依據,必須全部引用。
- 如果提供的區塊內容相互衝突,請引用這些區塊,並準確說明衝突之處。
輸出範例:
The Court held that the District Court lacked personal jurisdiction over the petitioner. \ue200cite\ue202block5\ue201