Google Cloud Ai Platform V1 Client - Class Context (1.13.0)

Reference documentation and code samples for the Google Cloud Ai Platform V1 Client class Context.

A context of the query.

Generated from protobuf message google.cloud.aiplatform.v1.RagContexts.Context

Namespace

Google \ Cloud \ AIPlatform \ V1 \ RagContexts

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ source_uri string

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.

↳ source_display_name string

The file display name.

↳ text string

The text chunk.

↳ score float

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.

getSourceUri

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.

Returns
Type Description
string

setSourceUri

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.

Parameter
Name Description
var string
Returns
Type Description
$this

getSourceDisplayName

The file display name.

Returns
Type Description
string

setSourceDisplayName

The file display name.

Parameter
Name Description
var string
Returns
Type Description
$this

getText

The text chunk.

Returns
Type Description
string

setText

The text chunk.

Parameter
Name Description
var string
Returns
Type Description
$this

getScore

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.

Returns
Type Description
float

hasScore

clearScore

setScore

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.

Parameter
Name Description
var float
Returns
Type Description
$this