Class MotorContentPartText

java.lang.Object
com.chatmotorapi.api.vision.MotorContentPartText
All Implemented Interfaces:
MotorMessage

public class MotorContentPartText
extends Object
implements MotorMessage
Represents a text-based content part within the ChatMotor messaging framework, specifically tailored for integration with OpenAI's vision API. This class implements the MotorMessage interface, allowing it to be used interchangeably with other message types within the system. Instances of MotorContentPartText hold plain text data. This design ensures that each text message has associated content that is not null, enforcing data integrity and facilitating reliable processing in contexts where text data is analyzed or displayed. The primary utility of this class is to encapsulate text data in a format that is easy to manage and compatible with systems that require textual input, such as natural language processing or text analysis tools, especially those associated with AI-driven technologies like OpenAI's vision API. Example usage:
 MotorContentPartText textPart = new MotorContentPartText("Here is some example text for processing.");
 
This example shows how to create an instance of MotorContentPartText with a string of text. This text can then be retrieved via the getContent() method, maintaining consistency across different types of content parts and allowing seamless integration into larger data processing workflows.
  • Constructor Details

    • MotorContentPartText

      public MotorContentPartText​(String text)
      Constructs a new text content part with the specified text. This constructor enforces a non-null text value to ensure data integrity.
      Parameters:
      text - the text of the content part, must not be null
  • Method Details

    • getContent

      public String getContent()
      Retrieves the text content of this message part. This method provides a uniform interface to access the content of the message, as specified by the MotorMessage interface.
      Specified by:
      getContent in interface MotorMessage
      Returns:
      the text stored in this content part