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 SummaryConstructors
- 
Method SummaryModifier 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.Builderself()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.WithJsonObjectBuilderBasewithJsonMethods inherited from class co.elastic.clients.util.ObjectBuilderBase_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
- 
Constructor Details- 
Builderpublic Builder()
 
- 
- 
Method Details- 
messagesRequired - A list of objects representing the conversation. Requests should generally only add new messages from the user (roleuser). The other message roles (assistant,system, ortool) should generally only be copied from the response to a previous completion request, such that the messages array is built up throughout a conversation.API name: messagesAdds all elements of listtomessages.
- 
messagesRequired - A list of objects representing the conversation. Requests should generally only add new messages from the user (roleuser). The other message roles (assistant,system, ortool) should generally only be copied from the response to a previous completion request, such that the messages array is built up throughout a conversation.API name: messagesAdds one or more values to messages.
- 
messagespublic final RequestChatCompletion.Builder messages(Function<Message.Builder, ObjectBuilder<Message>> fn) Required - A list of objects representing the conversation. Requests should generally only add new messages from the user (roleuser). The other message roles (assistant,system, ortool) should generally only be copied from the response to a previous completion request, such that the messages array is built up throughout a conversation.API name: messagesAdds a value to messagesusing a builder lambda.
- 
modelThe ID of the model to use.API name: model
- 
maxCompletionTokensThe upper bound limit for the number of tokens that can be generated for a completion request.API name: max_completion_tokens
- 
stopA sequence of strings to control when the model should stop generating additional tokens.API name: stopAdds all elements of listtostop.
- 
stopA sequence of strings to control when the model should stop generating additional tokens.API name: stopAdds one or more values to stop.
- 
temperatureThe sampling temperature to use.API name: temperature
- 
toolChoiceControls which tool is called by the model. String representation: One ofauto,none, orrequrired.autoallows the model to choose between calling tools and generating a message.nonecauses the model to not call any tools.requiredforces the model to call one or more tools. Example (object representation):{ "tool_choice": { "type": "function", "function": { "name": "get_current_weather" } } }API name: tool_choice
- 
toolChoicepublic final RequestChatCompletion.Builder toolChoice(Function<CompletionToolType.Builder, ObjectBuilder<CompletionToolType>> fn) Controls which tool is called by the model. String representation: One ofauto,none, orrequrired.autoallows the model to choose between calling tools and generating a message.nonecauses the model to not call any tools.requiredforces the model to call one or more tools. Example (object representation):{ "tool_choice": { "type": "function", "function": { "name": "get_current_weather" } } }API name: tool_choice
- 
toolsA list of tools that the model can call. Example:{ "tools": [ { "type": "function", "function": { "name": "get_price_of_item", "description": "Get the current price of an item", "parameters": { "type": "object", "properties": { "item": { "id": "12345" }, "unit": { "type": "currency" } } } } } ] }API name: toolsAdds all elements of listtotools.
- 
toolsA list of tools that the model can call. Example:{ "tools": [ { "type": "function", "function": { "name": "get_price_of_item", "description": "Get the current price of an item", "parameters": { "type": "object", "properties": { "item": { "id": "12345" }, "unit": { "type": "currency" } } } } } ] }API name: toolsAdds one or more values to tools.
- 
toolspublic final RequestChatCompletion.Builder tools(Function<CompletionTool.Builder, ObjectBuilder<CompletionTool>> fn) A list of tools that the model can call. Example:{ "tools": [ { "type": "function", "function": { "name": "get_price_of_item", "description": "Get the current price of an item", "parameters": { "type": "object", "properties": { "item": { "id": "12345" }, "unit": { "type": "currency" } } } } } ] }API name: toolsAdds a value to toolsusing a builder lambda.
- 
topPNucleus sampling, an alternative to sampling with temperature.API name: top_p
- 
self- Specified by:
- selfin class- WithJsonObjectBuilderBase<RequestChatCompletion.Builder>
 
- 
buildBuilds aRequestChatCompletion.- Specified by:
- buildin interface- ObjectBuilder<RequestChatCompletion>
- Throws:
- NullPointerException- if some of the required fields are null.
 
 
-