이 페이지에서는 Vertex AI RAG 엔진의 출력의 각 필드를 설명합니다.
retrieveContexts
이 섹션에서는 retrieveContexts
API에 정의된 각 필드를 설명하고 샘플 코드에서 필드를 사용합니다.
필드
필드 이름 | 설명 |
---|---|
source_uri |
RAG로 가져오기 전의 원본 소스 파일입니다. 파일이 Cloud Storage 또는 Google Drive에서 가져온 경우 source_uri 는 Cloud Storage 또는 Drive의 원본 파일 URI입니다. 파일이 업로드되면 source_uri 은 파일의 표시 이름입니다. |
source_display_name |
파일의 표시 이름입니다. |
text |
쿼리와 관련된 텍스트 청크입니다. |
score |
쿼리와 텍스트 청크 간의 유사성 또는 거리입니다.
유사성 또는 거리는 선택한 vectorDB 에 따라 다릅니다. ragManagedDB 의 경우 점수는 COSINE_DISTANCE 입니다. |
샘플 출력
이 코드 샘플은 필드를 사용하여 샘플 출력을 생성하는 방법을 보여줍니다.
contexts {
source_uri: "gs://sample_folder/hello_world.txt"
source_display_name: "hello_world.txt"
text: "Hello World!"
score: 0.60545359030757784
}
generateContent
generateContent
API에 정의된 대부분의 필드는 응답 본문에서 찾을 수 있습니다.
필드
이 섹션에서는 generateContent
API의 grounding_metadata
부분에 정의된 각 필드를 설명하고 샘플 코드에서 필드를 사용합니다.
필드 이름 | 설명 |
---|---|
text |
Gemini에서 생성한 대답입니다. |
grounding_chunks |
Vertex AI RAG 엔진에서 반환하는 청크입니다. |
retrieved_context |
생성된 콘텐츠를 기반으로 하는 데 사용되는 청크를 0개 이상 포함할 수 있는 반복되는 필드입니다. |
|
|
|
|
|
|
grounding_supports |
생성된 콘텐츠와 접지 청크 간의 관계입니다. 반복되는 필드입니다. 각 grounding_supports 필드는 생성된 컨텍스트의 텍스트 세그먼트 하나와 RAG에서 가져온 텍스트 청크 하나 이상 간의 관계를 보여줍니다. |
segment |
생성된 텍스트의 근거가 되는 텍스트 세그먼트입니다. |
|
|
|
|
|
|
grounding_chunk_indices |
텍스트 세그먼트를 접지하는 데 사용되는 청크입니다. 텍스트를 접지하는 데 사용되는 청크는 두 개 이상일 수 있습니다. 색인은 grounding_chunks 필드의 첫 번째 청크를 나타내는 0 에서 시작합니다. 지형이 전체 청크에 있습니다. 응답의 근거가 되는 청크 부분이 지정되지 않았습니다. |
confidence_scores |
특정 청크에서 텍스트를 접지하는 데 사용되는 점수입니다. 가능한 가장 높은 점수는 1 이며 점수가 높을수록 신뢰도가 높습니다. 각 점수는 각 grounding_chunk_indices 와 일치합니다. 신뢰도 점수가 0.6 이상인 청크만 출력에 포함됩니다. |
샘플 출력
이 코드 샘플은 필드를 사용하여 샘플 출력을 생성하는 방법을 보여줍니다.
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
}
}
}
다음 단계
- API 참조에서 RAG 컨텍스트에 관해 자세히 알아보려면 컨텍스트를 참고하세요.
- RAG에 대해 자세히 알아보려면 Vertex AI RAG 엔진 개요를 참고하세요.