Class TruncationObject

java.lang.Object
com.azure.ai.openai.assistants.models.TruncationObject
All Implemented Interfaces:
com.azure.json.JsonSerializable<TruncationObject>

public final class TruncationObject extends Object implements com.azure.json.JsonSerializable<TruncationObject>
Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of TruncationObject class.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of TruncationObject from the JsonReader.
    Get the lastMessages property: The number of most recent messages from the thread when constructing the context for the run.
    Get the type property: The truncation strategy to use for the thread.
    setLastMessages(Integer lastMessages)
    Set the lastMessages property: The number of most recent messages from the thread when constructing the context for the run.
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.azure.json.JsonSerializable

    toJson, toJson, toJsonBytes, toJsonString
  • Constructor Details

    • TruncationObject

      public TruncationObject(TruncationStrategy type)
      Creates an instance of TruncationObject class.
      Parameters:
      type - the type value to set.
  • Method Details

    • getType

      public TruncationStrategy getType()
      Get the type property: The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
      Returns:
      the type value.
    • getLastMessages

      public Integer getLastMessages()
      Get the lastMessages property: The number of most recent messages from the thread when constructing the context for the run.
      Returns:
      the lastMessages value.
    • setLastMessages

      public TruncationObject setLastMessages(Integer lastMessages)
      Set the lastMessages property: The number of most recent messages from the thread when constructing the context for the run.
      Parameters:
      lastMessages - the lastMessages value to set.
      Returns:
      the TruncationObject object itself.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<TruncationObject>
      Throws:
      IOException
    • fromJson

      public static TruncationObject fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of TruncationObject from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of TruncationObject if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the TruncationObject.