本頁面說明 Vertex AI RAG 引擎輸出內容中的欄位。輸出內容包含下列主要部分: 以下範例顯示 為 以下範例顯示
retrieveContexts
:包含從來源資料擷取的文字區塊相關資訊。generateContent
:包含生成的內容和中繼資料,顯示內容如何根據擷取的文字片段生成。retrieveContexts
retrieveContexts
回應包含下列欄位。欄位
欄位名稱
說明
source_uri
原始來源檔案的 URI。
source_display_name
檔案的顯示名稱。
text
與查詢相關的文字區塊。
score
代表查詢與文字區塊相似程度的分數。使用的指標取決於您選擇的
vectorDB
。如果是 ragManagedDB
,則分數為 COSINE_DISTANCE
。輸出範例
retrieveContexts
回應的格式:contexts {
source_uri: "gs://sample_folder/hello_world.txt"
source_display_name: "hello_world.txt"
text: "Hello World!"
score: 0.60545359030757784
}
generateContent
generateContent
API 定義的大多數欄位都位於回應主體中。欄位
grounding_metadata
物件包含下列欄位:
text
:Gemini 生成的回覆。grounding_chunks
:Vertex AI RAG 引擎傳回的文字區塊清單,與查詢相關。每個區塊物件都包含下列欄位:
retrieved_context
:物件,內含用於根據生成內容的文字區塊。其中包含下列欄位:
uri
:原始資料的 source_uri
。title
:原始檔案的 source_display_name
。text
:用於根據 Gemini 回覆內容的文字區塊。grounding_supports
:清單,說明生成的回覆片段與基礎塊之間的關係。每個項目都包含下列欄位:
segment
:這個物件會說明生成回應中以來源資料為依據的部分。其中包含下列欄位:
start_index
:已根據事實的文字片段起始字元索引。如果省略這個欄位,索引為 0
。end_index
:有根據的文字區段的結尾字元索引。text
:基礎區段的文字。grounding_chunk_indices
:索引清單,指向 grounding_chunks
中用於錨定文字片段的區塊。索引從 0
開始,一個區隔可由多個區塊做為基礎。confidence_scores
:信賴分數清單。每個分數都代表文字片段與 grounding_chunk_indices
中對應區塊的關聯強度。最高分為 1.0
分。只有可信度分數達到 0.6
以上的區塊才會納入。輸出範例
generateContent
回應的格式,重點在於 grounding_metadata
:candidates {
content {
role: "model"
parts {
text: "The rectangle is red and the background is white. The rectangle appears to be on some type of document editing software. \n"
}
}
grounding_metadata {
grounding_chunks {
retrieved_context {
uri: "a.txt"
title: "a.txt"
text: "Okay , I see a red rectangle on a white background . It looks like it\'s on some sort of document editing software. It has those small squares and circles around it, indicating that it\'s a selected object ."
}
}
grounding_chunks {
retrieved_context {
uri: "b.txt"
title: "b.txt"
text: "The video is identical to the last time I described it . It shows a blue rectangle on a white background."
}
}
grounding_chunks {
retrieved_context {
uri: "c.txt"
title: "c.txt"
text: "Okay , I remember the rectangle was blue in the past session . Now it is red.\n The red rectangle is still there . It \' s still in the same position on the white background, with the same handles around it. Nothing new is visible since last time.\n You \' re welcome . The red rectangle is still the only thing visible."
}
}
grounding_supports {
segment {
end_index: 49
text: "The rectangle is red and the background is white."
}
grounding_chunk_indices: 2
grounding_chunk_indices: 0
confidence_scores: 0.958192229
confidence_scores: 0.992316723
}
grounding_supports {
segment {
start_index: 50
end_index: 120
text: "The rectangle appears to be on some type of document editing software."
}
grounding_chunk_indices: 0
confidence_scores: 0.98374176
}
}
}
後續步驟
Vertex AI RAG 引擎的擷取和產生輸出
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-19 (世界標準時間)。