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 interface
static final record
static final record
static final record
static final record
static final record
static final record
static interface
static final record
static final record
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
Indicates whether to include the `stream_options` field in the JSON output.static final String
static final String
static final String
static final ConstructingObjectParser
<UnifiedCompletionRequest, Void> static final String
static final String
static final String
static final String
Fields 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 aUnifiedCompletionRequest
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.static List
<NamedWriteableRegistry.Entry> final int
hashCode()
Returns a hash code value for this object.Returns the value of themaxCompletionTokens
record component.messages()
Returns the value of themessages
record component.model()
Returns the value of themodel
record component.static UnifiedCompletionRequest
of
(List<UnifiedCompletionRequest.Message> messages) stop()
Returns the value of thestop
record component.Returns the value of thetemperature
record component.Returns the value of thetoolChoice
record component.tools()
Returns the value of thetools
record component.topP()
Returns the value of thetopP
record component.final String
toString()
Returns a string representation of this record class.toXContent
(XContentBuilder builder, ToXContent.Params params) static ToXContent.Params
withMaxCompletionTokensTokens
(String modelId, ToXContent.Params params) Creates aToXContent.Params
that causes ToXContent to include the key values: - Key:MODEL_FIELD
, Value: modelId - Key:MAX_COMPLETION_TOKENS_FIELD
, Value:maxCompletionTokens()
static ToXContent.Params
Creates aToXContent.Params
that causes ToXContent to include the key values: - Key:MAX_COMPLETION_TOKENS_FIELD
, Value:maxCompletionTokens()
static ToXContent.Params
withMaxTokens
(String modelId, ToXContent.Params params) Creates aToXContent.Params
that causes ToXContent to include the key values: - Key:MODEL_FIELD
, Value: modelId - Key:MAX_TOKENS_FIELD
, Value:maxCompletionTokens()
static ToXContent.Params
withMaxTokensAndSkipStreamOptionsField
(String modelId, ToXContent.Params params) Creates aToXContent.Params
that 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"void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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 aUnifiedCompletionRequest
record class.- Parameters:
messages
- the value for themessages
record componentmodel
- the value for themodel
record componentmaxCompletionTokens
- the value for themaxCompletionTokens
record componentstop
- the value for thestop
record componenttemperature
- the value for thetemperature
record componenttoolChoice
- the value for thetoolChoice
record componenttools
- the value for thetools
record componenttopP
- the value for thetopP
record component
-
-
Method Details
-
withMaxTokens
Creates aToXContent.Params
that 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.Params
that 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" -
withMaxCompletionTokensTokens
public static ToXContent.Params withMaxCompletionTokensTokens(String modelId, ToXContent.Params params) Creates aToXContent.Params
that causes ToXContent to include the key values: - Key:MODEL_FIELD
, Value: modelId - Key:MAX_COMPLETION_TOKENS_FIELD
, Value:maxCompletionTokens()
-
withMaxCompletionTokensTokens
Creates aToXContent.Params
that causes ToXContent to include the key values: - Key:MAX_COMPLETION_TOKENS_FIELD
, Value:maxCompletionTokens()
-
getNamedWriteables
-
of
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in 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 themessages
record component.- Returns:
- the value of the
messages
record component
-
model
Returns the value of themodel
record component.- Returns:
- the value of the
model
record component
-
maxCompletionTokens
Returns the value of themaxCompletionTokens
record component.- Returns:
- the value of the
maxCompletionTokens
record component
-
stop
Returns the value of thestop
record component.- Returns:
- the value of the
stop
record component
-
temperature
Returns the value of thetemperature
record component.- Returns:
- the value of the
temperature
record component
-
toolChoice
Returns the value of thetoolChoice
record component.- Returns:
- the value of the
toolChoice
record component
-
tools
Returns the value of thetools
record component.- Returns:
- the value of the
tools
record component
-
topP
Returns the value of thetopP
record component.- Returns:
- the value of the
topP
record component
-