Module org.elasticsearch.server
Package org.elasticsearch.inference
Record Class UnifiedCompletionRequest
java.lang.Object
java.lang.Record
org.elasticsearch.inference.UnifiedCompletionRequest
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentFragment
public record UnifiedCompletionRequest(List<UnifiedCompletionRequest.Message> messages, String model, Long maxCompletionTokens, List<String> stop, Float temperature, UnifiedCompletionRequest.ToolChoice toolChoice, List<UnifiedCompletionRequest.Tool> tools, Float topP)
extends Record
implements Writeable, ToXContentFragment
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic interfacestatic final recordstatic final recordNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringIndicates whether to include the `stream_options` field in the JSON output.static final Stringstatic final Stringstatic final Stringstatic final ConstructingObjectParser<UnifiedCompletionRequest, Void> static final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionUnifiedCompletionRequest(List<UnifiedCompletionRequest.Message> messages, String model, Long maxCompletionTokens, List<String> stop, Float temperature, UnifiedCompletionRequest.ToolChoice toolChoice, List<UnifiedCompletionRequest.Tool> tools, Float topP) Creates an instance of aUnifiedCompletionRequestrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static List<NamedWriteableRegistry.Entry> final inthashCode()Returns a hash code value for this object.Returns the value of themaxCompletionTokensrecord component.messages()Returns the value of themessagesrecord component.model()Returns the value of themodelrecord component.static UnifiedCompletionRequestof(List<UnifiedCompletionRequest.Message> messages) stop()Returns the value of thestoprecord component.Returns the value of thetemperaturerecord component.Returns the value of thetoolChoicerecord component.tools()Returns the value of thetoolsrecord component.topP()Returns the value of thetopPrecord component.final StringtoString()Returns a string representation of this record class.toXContent(XContentBuilder builder, ToXContent.Params params) static ToXContent.ParamswithMaxCompletionTokens(String modelId, ToXContent.Params params) Creates aToXContent.Paramsthat causes ToXContent to include the key values: - Key:MODEL_FIELD, Value: modelId - Key:MAX_COMPLETION_TOKENS_FIELD, Value:maxCompletionTokens()static ToXContent.ParamsCreates aToXContent.Paramsthat causes ToXContent to include the key values: - Key:MAX_COMPLETION_TOKENS_FIELD, Value:maxCompletionTokens()static ToXContent.ParamswithMaxTokens(String modelId, ToXContent.Params params) Creates aToXContent.Paramsthat causes ToXContent to include the key values: - Key:MODEL_FIELD, Value: modelId - Key:MAX_TOKENS_FIELD, Value:maxCompletionTokens()static ToXContent.ParamswithMaxTokensAndSkipStreamOptionsField(String modelId, ToXContent.Params params) Creates aToXContent.Paramsthat causes ToXContent to include the key values: - Key:MODEL_FIELD, Value: modelId - Key:MAX_TOKENS_FIELD, Value:MAX_TOKENS_FIELD- Key:INCLUDE_STREAM_OPTIONS_PARAM, Value: "false"voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
NAME_FIELD
- See Also:
-
TOOL_CALL_ID_FIELD
- See Also:
-
TOOL_CALLS_FIELD
- See Also:
-
ID_FIELD
- See Also:
-
FUNCTION_FIELD
- See Also:
-
ARGUMENTS_FIELD
- See Also:
-
DESCRIPTION_FIELD
- See Also:
-
PARAMETERS_FIELD
- See Also:
-
STRICT_FIELD
- See Also:
-
TOP_P_FIELD
- See Also:
-
MESSAGES_FIELD
- See Also:
-
INCLUDE_STREAM_OPTIONS_PARAM
Indicates whether to include the `stream_options` field in the JSON output. Some providers do not support this field. In such cases, this parameter should be set to "false", and the `stream_options` field will be excluded from the output. For providers that do support stream options, this parameter is left unset (default behavior), which implicitly includes the `stream_options` field in the output.- See Also:
-
PARSER
-
-
Constructor Details
-
UnifiedCompletionRequest
- Throws:
IOException
-
UnifiedCompletionRequest
public UnifiedCompletionRequest(List<UnifiedCompletionRequest.Message> messages, @Nullable String model, @Nullable Long maxCompletionTokens, @Nullable List<String> stop, @Nullable Float temperature, @Nullable UnifiedCompletionRequest.ToolChoice toolChoice, @Nullable List<UnifiedCompletionRequest.Tool> tools, @Nullable Float topP) Creates an instance of aUnifiedCompletionRequestrecord class.- Parameters:
messages- the value for themessagesrecord componentmodel- the value for themodelrecord componentmaxCompletionTokens- the value for themaxCompletionTokensrecord componentstop- the value for thestoprecord componenttemperature- the value for thetemperaturerecord componenttoolChoice- the value for thetoolChoicerecord componenttools- the value for thetoolsrecord componenttopP- the value for thetopPrecord component
-
-
Method Details
-
withMaxTokens
Creates aToXContent.Paramsthat causes ToXContent to include the key values: - Key:MODEL_FIELD, Value: modelId - Key:MAX_TOKENS_FIELD, Value:maxCompletionTokens() -
withMaxTokensAndSkipStreamOptionsField
public static ToXContent.Params withMaxTokensAndSkipStreamOptionsField(String modelId, ToXContent.Params params) Creates aToXContent.Paramsthat causes ToXContent to include the key values: - Key:MODEL_FIELD, Value: modelId - Key:MAX_TOKENS_FIELD, Value:MAX_TOKENS_FIELD- Key:INCLUDE_STREAM_OPTIONS_PARAM, Value: "false" -
withMaxCompletionTokens
Creates aToXContent.Paramsthat causes ToXContent to include the key values: - Key:MODEL_FIELD, Value: modelId - Key:MAX_COMPLETION_TOKENS_FIELD, Value:maxCompletionTokens() -
withMaxCompletionTokensTokens
Creates aToXContent.Paramsthat causes ToXContent to include the key values: - Key:MAX_COMPLETION_TOKENS_FIELD, Value:maxCompletionTokens() -
getNamedWriteables
-
of
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
messages
Returns the value of themessagesrecord component.- Returns:
- the value of the
messagesrecord component
-
model
Returns the value of themodelrecord component.- Returns:
- the value of the
modelrecord component
-
maxCompletionTokens
Returns the value of themaxCompletionTokensrecord component.- Returns:
- the value of the
maxCompletionTokensrecord component
-
stop
Returns the value of thestoprecord component.- Returns:
- the value of the
stoprecord component
-
temperature
Returns the value of thetemperaturerecord component.- Returns:
- the value of the
temperaturerecord component
-
toolChoice
Returns the value of thetoolChoicerecord component.- Returns:
- the value of the
toolChoicerecord component
-
tools
Returns the value of thetoolsrecord component.- Returns:
- the value of the
toolsrecord component
-
topP
Returns the value of thetopPrecord component.- Returns:
- the value of the
topPrecord component
-