Module org.elasticsearch.xcore
Class BaseInferenceActionRequest
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.AbstractTransportRequest
org.elasticsearch.action.ActionRequest
org.elasticsearch.action.UntypedActionRequest
org.elasticsearch.xpack.core.inference.action.BaseInferenceActionRequest
- All Implemented Interfaces:
Writeable,RefCounted,TaskAwareRequest,TransportRequest
- Direct Known Subclasses:
EmbeddingAction.Request,InferenceAction.Request,RerankAction.Request,UnifiedCompletionAction.Request
Base class for inference action requests. Tracks request routing state to prevent potential routing loops
and supports both streaming and non-streaming inference operations.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TransportVersionstatic final TimeValueThe default timeout used for all task types prior toINFERENCE_REQUEST_PER_TASK_TIMEOUT_ADDEDstatic final TimeValueUsed as a non-null marker for cases where the timeout has not been determined yet.Fields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic TimeValuegetDefaultTimeoutForTaskType(TaskType taskType) Returns the default timeout based on the task type.abstract Stringabstract TaskTypeinthashCode()abstract booleanstatic TimeValueresolveTimeoutForTaskType(TaskType taskType, TimeValue existingTimeout) Returns the default timeout for the task type if the timeout has not been explicitly set.voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResult, validateMethods inherited from class org.elasticsearch.transport.AbstractTransportRequest
copyFieldsFrom, getParentTask, getRequestId, remoteAddress, remoteAddress, setParentTask, setRequestId, toStringMethods inherited from class org.elasticsearch.transport.TransportMessage
decRef, hasReferences, incRef, tryIncRefMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.core.RefCounted
decRef, hasReferences, incRef, mustIncRef, tryIncRefMethods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, createTask, getDescription, setParentTask
-
Field Details
-
INFERENCE_REQUEST_PER_TASK_TIMEOUT_ADDED
-
TIMEOUT_NOT_DETERMINED
Used as a non-null marker for cases where the timeout has not been determined yet. Safe to use in this way because a timeout of 0 would otherwise lead to requests instantly timing out, which is not a valid use case -
OLD_DEFAULT_TIMEOUT
The default timeout used for all task types prior toINFERENCE_REQUEST_PER_TASK_TIMEOUT_ADDED
-
-
Constructor Details
-
BaseInferenceActionRequest
-
BaseInferenceActionRequest
- Throws:
IOException
-
-
Method Details
-
resolveTimeoutForTaskType
public static TimeValue resolveTimeoutForTaskType(TaskType taskType, @Nullable TimeValue existingTimeout) Returns the default timeout for the task type if the timeout has not been explicitly set. If the timeout has been set (i.e. it is not equal toTIMEOUT_NOT_DETERMINEDornull) then the unmodified timeout is returned.Passing
TaskType.ANYreturnsTIMEOUT_NOT_DETERMINEDso that the appropriate timeout can be resolved after parsing the task type from the request body or model.- Parameters:
taskType- The task type for which the default timeout should be returnedexistingTimeout- The currently set timeout, which may beTIMEOUT_NOT_DETERMINEDornull
-
getDefaultTimeoutForTaskType
Returns the default timeout based on the task type.Passing
TaskType.ANYreturnsTIMEOUT_NOT_DETERMINEDso that the appropriate timeout can be resolved later after parsing the task type from the request body or model.- Parameters:
taskType- The task type for which the default timeout should be returned
-
isStreaming
public abstract boolean isStreaming() -
getTaskType
-
getInferenceEntityId
-
getContext
-
writeTo
- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classActionRequest- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-