public sealed class RagContexts.Types.Context : IMessage<RagContexts.Types.Context>, IEquatable<RagContexts.Types.Context>, IDeepCloneable<RagContexts.Types.Context>, IBufferMessage, IMessage
Reference documentation and code samples for the Vertex AI v1beta1 API class RagContexts.Types.Context.
According to the underlying Vector DB and the selected metric type, the
score can be either the distance or the similarity between the query and
the context and its range depends on the metric type.
For example, if the metric type is COSINE_DISTANCE, it represents the
distance between the query and the context. The larger the distance, the
less relevant the context is to the query. The range is [0, 2], while 0
means the most relevant and 2 means the least relevant.
If the file is imported from Cloud Storage or Google Drive, source_uri
will be original file URI in Cloud Storage or Google Drive; if file is
uploaded, source_uri will be file display name.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["\u003cp\u003eThis document provides reference documentation for the \u003ccode\u003eRagContexts.Types.Context\u003c/code\u003e class within the Vertex AI v1beta1 API, which is used to define a context of a query.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRagContexts.Types.Context\u003c/code\u003e class implements several interfaces including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, allowing for various operations such as message handling, equality checks, and deep cloning.\u003c/p\u003e\n"],["\u003cp\u003eKey properties of the \u003ccode\u003eRagContexts.Types.Context\u003c/code\u003e class include \u003ccode\u003eDistance\u003c/code\u003e, \u003ccode\u003eScore\u003c/code\u003e, \u003ccode\u003eSourceDisplayName\u003c/code\u003e, \u003ccode\u003eSourceUri\u003c/code\u003e, \u003ccode\u003eSparseDistance\u003c/code\u003e, and \u003ccode\u003eText\u003c/code\u003e, which are used to define information about the context like the distance or similarity of a query and context text, the source URI, and the text chunk of the context.\u003c/p\u003e\n"],["\u003cp\u003eThe document details the constructors available for the class such as \u003ccode\u003eContext()\u003c/code\u003e, and \u003ccode\u003eContext(Context)\u003c/code\u003e for instantiating the \u003ccode\u003eRagContexts.Types.Context\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eScore\u003c/code\u003e property can vary, such as the distance or similarity of the query, depending on the selected metric type, with it's range being between 0 to 2 if using \u003ccode\u003eCOSINE_DISTANCE\u003c/code\u003e, with 0 being most relevant and 2 being the least.\u003c/p\u003e\n"]]],[],null,[]]