<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/aiplatform/v1/vertex_rag_service.proto

namespace Google\Cloud\AIPlatform\V1\RagContexts;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A context of the query.
 *
 * Generated from protobuf message <code>google.cloud.aiplatform.v1.RagContexts.Context</code>
 */
class Context extends \Google\Protobuf\Internal\Message
{
    /**
     * 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.
     *
     * Generated from protobuf field <code>string source_uri = 1;</code>
     */
    protected $source_uri = '';
    /**
     * The file display name.
     *
     * Generated from protobuf field <code>string source_display_name = 5;</code>
     */
    protected $source_display_name = '';
    /**
     * The text chunk.
     *
     * Generated from protobuf field <code>string text = 2;</code>
     */
    protected $text = '';
    /**
     * 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.
     *
     * Generated from protobuf field <code>optional double score = 6;</code>
     */
    protected $score = null;
    /**
     * Context of the retrieved chunk.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.RagChunk chunk = 7;</code>
     */
    protected $chunk = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $source_uri
     *           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.
     *     @type string $source_display_name
     *           The file display name.
     *     @type string $text
     *           The text chunk.
     *     @type float $score
     *           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.
     *     @type \Google\Cloud\AIPlatform\V1\RagChunk $chunk
     *           Context of the retrieved chunk.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Aiplatform\V1\VertexRagService::initOnce();
        parent::__construct($data);
    }

    /**
     * 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.
     *
     * Generated from protobuf field <code>string source_uri = 1;</code>
     * @return string
     */
    public function getSourceUri()
    {
        return $this->source_uri;
    }

    /**
     * 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.
     *
     * Generated from protobuf field <code>string source_uri = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setSourceUri($var)
    {
        GPBUtil::checkString($var, True);
        $this->source_uri = $var;

        return $this;
    }

    /**
     * The file display name.
     *
     * Generated from protobuf field <code>string source_display_name = 5;</code>
     * @return string
     */
    public function getSourceDisplayName()
    {
        return $this->source_display_name;
    }

    /**
     * The file display name.
     *
     * Generated from protobuf field <code>string source_display_name = 5;</code>
     * @param string $var
     * @return $this
     */
    public function setSourceDisplayName($var)
    {
        GPBUtil::checkString($var, True);
        $this->source_display_name = $var;

        return $this;
    }

    /**
     * The text chunk.
     *
     * Generated from protobuf field <code>string text = 2;</code>
     * @return string
     */
    public function getText()
    {
        return $this->text;
    }

    /**
     * The text chunk.
     *
     * Generated from protobuf field <code>string text = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setText($var)
    {
        GPBUtil::checkString($var, True);
        $this->text = $var;

        return $this;
    }

    /**
     * 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.
     *
     * Generated from protobuf field <code>optional double score = 6;</code>
     * @return float
     */
    public function getScore()
    {
        return isset($this->score) ? $this->score : 0.0;
    }

    public function hasScore()
    {
        return isset($this->score);
    }

    public function clearScore()
    {
        unset($this->score);
    }

    /**
     * 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.
     *
     * Generated from protobuf field <code>optional double score = 6;</code>
     * @param float $var
     * @return $this
     */
    public function setScore($var)
    {
        GPBUtil::checkDouble($var);
        $this->score = $var;

        return $this;
    }

    /**
     * Context of the retrieved chunk.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.RagChunk chunk = 7;</code>
     * @return \Google\Cloud\AIPlatform\V1\RagChunk|null
     */
    public function getChunk()
    {
        return $this->chunk;
    }

    public function hasChunk()
    {
        return isset($this->chunk);
    }

    public function clearChunk()
    {
        unset($this->chunk);
    }

    /**
     * Context of the retrieved chunk.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.RagChunk chunk = 7;</code>
     * @param \Google\Cloud\AIPlatform\V1\RagChunk $var
     * @return $this
     */
    public function setChunk($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\RagChunk::class);
        $this->chunk = $var;

        return $this;
    }

}


