Class RequestChatCompletion.Builder
java.lang.Object
co.elastic.clients.util.ObjectBuilderBase
co.elastic.clients.util.WithJsonObjectBuilderBase<RequestChatCompletion.Builder>
co.elastic.clients.elasticsearch.inference.RequestChatCompletion.Builder
- All Implemented Interfaces:
WithJson<RequestChatCompletion.Builder>
,ObjectBuilder<RequestChatCompletion>
- Enclosing class:
- RequestChatCompletion
public static class RequestChatCompletion.Builder
extends WithJsonObjectBuilderBase<RequestChatCompletion.Builder>
implements ObjectBuilder<RequestChatCompletion>
Builder for
RequestChatCompletion
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds aRequestChatCompletion
.maxCompletionTokens
(Long value) The upper bound limit for the number of tokens that can be generated for a completion request.Required - A list of objects representing the conversation.Required - A list of objects representing the conversation.Required - A list of objects representing the conversation.The ID of the model to use.protected RequestChatCompletion.Builder
self()
A sequence of strings to control when the model should stop generating additional tokens.A sequence of strings to control when the model should stop generating additional tokens.temperature
(Float value) The sampling temperature to use.toolChoice
(CompletionToolType value) Controls which tool is called by the model.Controls which tool is called by the model.tools
(CompletionTool value, CompletionTool... values) A list of tools that the model can call.A list of tools that the model can call.tools
(List<CompletionTool> list) A list of tools that the model can call.Nucleus sampling, an alternative to sampling with temperature.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJson
Methods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
messages
Required - A list of objects representing the conversation.API name:
messages
Adds all elements of
list
tomessages
. -
messages
Required - A list of objects representing the conversation.API name:
messages
Adds one or more values to
messages
. -
messages
public final RequestChatCompletion.Builder messages(Function<Message.Builder, ObjectBuilder<Message>> fn) Required - A list of objects representing the conversation.API name:
messages
Adds a value to
messages
using a builder lambda. -
model
The ID of the model to use.API name:
model
-
maxCompletionTokens
The upper bound limit for the number of tokens that can be generated for a completion request.API name:
max_completion_tokens
-
stop
A sequence of strings to control when the model should stop generating additional tokens.API name:
stop
Adds all elements of
list
tostop
. -
stop
A sequence of strings to control when the model should stop generating additional tokens.API name:
stop
Adds one or more values to
stop
. -
temperature
The sampling temperature to use.API name:
temperature
-
toolChoice
Controls which tool is called by the model.API name:
tool_choice
-
toolChoice
public final RequestChatCompletion.Builder toolChoice(Function<CompletionToolType.Builder, ObjectBuilder<CompletionToolType>> fn) Controls which tool is called by the model.API name:
tool_choice
-
tools
A list of tools that the model can call.API name:
tools
Adds all elements of
list
totools
. -
tools
A list of tools that the model can call.API name:
tools
Adds one or more values to
tools
. -
tools
public final RequestChatCompletion.Builder tools(Function<CompletionTool.Builder, ObjectBuilder<CompletionTool>> fn) A list of tools that the model can call.API name:
tools
Adds a value to
tools
using a builder lambda. -
topP
Nucleus sampling, an alternative to sampling with temperature.API name:
top_p
-
self
- Specified by:
self
in classWithJsonObjectBuilderBase<RequestChatCompletion.Builder>
-
build
Builds aRequestChatCompletion
.- Specified by:
build
in interfaceObjectBuilder<RequestChatCompletion>
- Throws:
NullPointerException
- if some of the required fields are null.
-