Package org.apache.flink.model.openai
Enum ContextOverflowAction
- java.lang.Object
-
- java.lang.Enum<ContextOverflowAction>
-
- org.apache.flink.model.openai.ContextOverflowAction
-
- All Implemented Interfaces:
Serializable,Comparable<ContextOverflowAction>,org.apache.flink.configuration.DescribedEnum
public enum ContextOverflowAction extends Enum<ContextOverflowAction> implements org.apache.flink.configuration.DescribedEnum
Context overflow action.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description SKIPPEDSKIPPED_LOGTRUNCATED_HEADTRUNCATED_HEAD_LOGTRUNCATED_TAILTRUNCATED_TAIL_LOG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringgetAllValuesAndDescriptions()org.apache.flink.configuration.description.InlineElementgetDescription()voidinitializeEncodingForContextLimit(String model, Integer maxContextSize)Initialize encoding for given model.StringprocessTokensWithLimit(String model, String input, Integer maxContextSize)Process tokens with given context limit.StringtoString()static ContextOverflowActionvalueOf(String name)Returns the enum constant of this type with the specified name.static ContextOverflowAction[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
TRUNCATED_TAIL
public static final ContextOverflowAction TRUNCATED_TAIL
-
TRUNCATED_TAIL_LOG
public static final ContextOverflowAction TRUNCATED_TAIL_LOG
-
TRUNCATED_HEAD
public static final ContextOverflowAction TRUNCATED_HEAD
-
TRUNCATED_HEAD_LOG
public static final ContextOverflowAction TRUNCATED_HEAD_LOG
-
SKIPPED
public static final ContextOverflowAction SKIPPED
-
SKIPPED_LOG
public static final ContextOverflowAction SKIPPED_LOG
-
-
Method Detail
-
values
public static ContextOverflowAction[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ContextOverflowAction c : ContextOverflowAction.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ContextOverflowAction valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
initializeEncodingForContextLimit
public void initializeEncodingForContextLimit(String model, @Nullable Integer maxContextSize)
Initialize encoding for given model.- Parameters:
model- The model to calculate tokens.maxContextSize- the context limit.
-
processTokensWithLimit
@Nullable public String processTokensWithLimit(String model, String input, @Nullable Integer maxContextSize)
Process tokens with given context limit.- Parameters:
model- The model to calculate tokens.input- The input string.maxContextSize- the context limit.- Returns:
- processed tokens or null if the tokens should be skipped.
-
getDescription
public org.apache.flink.configuration.description.InlineElement getDescription()
- Specified by:
getDescriptionin interfaceorg.apache.flink.configuration.DescribedEnum
-
toString
public String toString()
- Overrides:
toStringin classEnum<ContextOverflowAction>
-
getAllValuesAndDescriptions
public static String getAllValuesAndDescriptions()
-
-