Class MotorStrategicSummaryRequest

java.lang.Object
com.chatmotorapi.api.functional.MotorStrategicSummaryRequest

public class MotorStrategicSummaryRequest
extends Object
Handles the creation and execution of a strategi summarization requests using the ChatMotor API. It includes configuration for the text file to be The model to be used in requests can be specified with the .aiModel setter directly on the MotorSummaryRequest builder. If .aiModel is not called, the default model used is System.getenv("MOTOR_CHAT_MODEL"). If the environment variable is not set, the model used is MotorDefaultsModels.MOTOR_CHAT_MODEL

The response will be in HTML format to guarantee readability and ease of understanding.
A strategic summary is a concise and high-level synthesis of a given text, focusing on extracting the most critical information and key insights. It is designed to provide a quick understanding of the main points, trends, and actionable items within the text, making it ideal for decision-making processes and strategic planning.

Key Features
  • Concise Overview: Summarizes the text to highlight essential information.
  • Key Insights: Focuses on the main points, trends, and actionable items.
  • Decision Support: Aids in strategic planning and decision-making by providing a quick understanding of the content.

As the strategic summary is generated in HTML format, there is no executeAsStream method implemented in this class. Usage example:

 String documentPath = "/path/to/my_document.txt";
 
 // We assume that the env var MOTOR_API_KEY is set.
 ChatMotor chatMotor = ChatMotor.builder().build();
 
 MotorStrategicSummaryRequest request = MotorStrategicSummaryRequest.builder()
        .chatMotor(chatMotor)
        .file(documentFile)
        .filePath(documentPath)
        .languageCode("fr")
        .build();
 
 MotorResponse motorResponse = request.execute();
 
 if (motorResponse.isResponseOk()) {
     // Better to dump the response HTML to a file, can't be readily displayed on the console.
     String responseFilePath = "/path/to/my_document_summary.html";
     try (InputStream in = motorResponse.getInputStream()) {
          Files.copy(in, Paths.get(responseFilePath), StandardCopyOption.REPLACE_EXISTING);
       } 
 } else {
     // Treat errors
     // See the MotorResponse class for more details.
 }
 

This class uses a builder pattern to ensure a flexible and secure way to configure each summarization request.

  • Method Details

    • chatMotor

      public ChatMotor chatMotor()
      Gets the ChatMotor to be used in the request.
      Returns:
      the
    • aiOptions

      public MotorAiOptions aiOptions()
      Gets the AI options to be used in the request.
      Returns:
      the AI options to be used in the request
    • aiModel

      public String aiModel()
      Gets the AI model to be used in the request.
      Returns:
      the AI model to be used in the request
    • filePath

      public String filePath()
      Gets the file path to be used in the request.
      Returns:
      the file path to be used in the request
    • languageCode

      public String languageCode()
      Gets the language code to be used in the request.
      Returns:
      the language code to be used in the request
    • builder

      public static MotorStrategicSummaryRequest.Builder builder()
      Returns a new builder instance for creating a MotorSummaryRequest.
      Returns:
      a new MotorSummaryRequest builder
    • execute

      public MotorResponse execute()
      Executes the process of generating a strategic summary in HTML from a specified file using a GPT model. This method initializes a session with necessary configurations, reads the text file, and creates a summary based on the text content.

      Workflow:

      • Reads the text content from a file.
      • Returns a MotorResponse indicating success or failure, along with any generated data file or errors.
      Returns:
      true the MotorResponse object
      See Also:
      MotorResponse