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
ConstructorsConstructorDescriptionCreates an instance of TruncationObject class. -
Method Summary
Modifier and TypeMethodDescriptionstatic TruncationObject
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.getType()
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
Creates an instance of TruncationObject class.- Parameters:
type
- the type value to set.
-
-
Method Details
-
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
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
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
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<TruncationObject>
- Throws:
IOException
-
fromJson
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.
-