"""CompletionChunkObject class.
"""
from databricks_genai_inference.api.abstract.foundation_model_object import FoundationModelObject


class CompletionChunkObject(FoundationModelObject):
    """
    A class representing a chunk of completed text generated by the model, when `stream` is set True.
    """

    @property
    def text(self):
        """
        Returns the text content from the chat completion API response.

        Returns:
            str: The text content.
        """
        return self.response['choices'][0]['text']
