Class FunctionDefinition.Builder
-
- All Implemented Interfaces:
public final class FunctionDefinition.Builder
A builder for FunctionDefinition.
-
-
Method Summary
-
-
Method Detail
-
name
final FunctionDefinition.Builder name(String name)
The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
name
final FunctionDefinition.Builder name(JsonField<String> name)
Sets Builder.name to an arbitrary JSON value.
You should usually call Builder.name with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
description
final FunctionDefinition.Builder description(String description)
A description of what the function does, used by the model to choose when and how to call the function.
-
description
final FunctionDefinition.Builder description(JsonField<String> description)
Sets Builder.description to an arbitrary JSON value.
You should usually call Builder.description with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
parameters
final FunctionDefinition.Builder parameters(FunctionParameters parameters)
The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parameters
defines a function with an empty parameter list.
-
parameters
final FunctionDefinition.Builder parameters(JsonField<FunctionParameters> parameters)
Sets Builder.parameters to an arbitrary JSON value.
You should usually call Builder.parameters with a well-typed FunctionParameters value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
strict
final FunctionDefinition.Builder strict(Boolean strict)
Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parameters
field. Only a subset of JSON Schema is supported whenstrict
istrue
. Learn more about Structured Outputs in the docs/guides/function-calling.
-
strict
final FunctionDefinition.Builder strict(Boolean strict)
Alias for Builder.strict.
This unboxed primitive overload exists for backwards compatibility.
-
strict
final FunctionDefinition.Builder strict(Optional<Boolean> strict)
Alias for calling Builder.strict with
strict.orElse(null)
.
-
strict
final FunctionDefinition.Builder strict(JsonField<Boolean> strict)
Sets Builder.strict to an arbitrary JSON value.
You should usually call Builder.strict with a well-typed Boolean value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final FunctionDefinition.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final FunctionDefinition.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final FunctionDefinition.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final FunctionDefinition.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final FunctionDefinition.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final FunctionDefinition build()
Returns an immutable instance of FunctionDefinition.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.name()
-
-
-
-