Share via


TruncationObject Class

  • java.lang.Object
    • com.azure.ai.agents.persistent.models.TruncationObject

Implements

public final class TruncationObject
implements 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

Constructor Description
TruncationObject(TruncationStrategy type)

Creates an instance of TruncationObject class.

Method Summary

Modifier and Type Method and Description
static TruncationObject fromJson(JsonReader jsonReader)

Reads an instance of TruncationObject from the JsonReader.

Integer getLastMessages()

Get the lastMessages property: The number of most recent messages from the thread when constructing the context for the run.

TruncationStrategy getType()

Get the type property: The truncation strategy to use for the thread.

TruncationObject setLastMessages(Integer lastMessages)

Set the lastMessages property: The number of most recent messages from the thread when constructing the context for the run.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

TruncationObject

public TruncationObject(TruncationStrategy type)

Creates an instance of TruncationObject class.

Parameters:

type - the type value to set.

Method Details

fromJson

public static TruncationObject fromJson(JsonReader jsonReader)

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:

IOException

- If the deserialized JSON object was missing any required properties.

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.

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.

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 JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to