FunctionTool Class

public final class FunctionTool
extends Tool

Function Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling).

Constructor Summary

Constructor Description
FunctionTool(String name, Map<String,BinaryData> parameters, Boolean strict)

Creates an instance of FunctionTool class.

Method Summary

Modifier and Type Method and Description
static FunctionTool fromJson(JsonReader jsonReader)

Reads an instance of FunctionTool from the JsonReader.

String getDescription()

Get the description property: The description property.

String getName()

Get the name property: The name of the function to call.

Map<String,BinaryData> getParameters()

Get the parameters property: The parameters property.

ToolType getType()

Get the type property: The type property.

Boolean isDeferLoading()

Get the deferLoading property: Whether this function is deferred and loaded via tool search.

Boolean isStrict()

Get the strict property: The strict property.

FunctionTool setDeferLoading(Boolean deferLoading)

Set the deferLoading property: Whether this function is deferred and loaded via tool search.

FunctionTool setDescription(String description)

Set the description property: The description property.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from Tool

Methods inherited from java.lang.Object

Constructor Details

FunctionTool

public FunctionTool(String name, Map<String,BinaryData> parameters, Boolean strict)

Creates an instance of FunctionTool class.

Parameters:

name - the name value to set.
parameters - the parameters value to set.
strict - the strict value to set.

Method Details

fromJson

public static FunctionTool fromJson(JsonReader jsonReader)

Reads an instance of FunctionTool from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of FunctionTool if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getDescription

public String getDescription()

Get the description property: The description property.

Returns:

the description value.

getName

public String getName()

Get the name property: The name of the function to call.

Returns:

the name value.

getParameters

public Map<String,BinaryData> getParameters()

Get the parameters property: The parameters property.

Returns:

the parameters value.

getType

public ToolType getType()

Get the type property: The type property.

Overrides:

FunctionTool.getType()

Returns:

the type value.

isDeferLoading

public Boolean isDeferLoading()

Get the deferLoading property: Whether this function is deferred and loaded via tool search.

Returns:

the deferLoading value.

isStrict

public Boolean isStrict()

Get the strict property: The strict property.

Returns:

the strict value.

setDeferLoading

public FunctionTool setDeferLoading(Boolean deferLoading)

Set the deferLoading property: Whether this function is deferred and loaded via tool search.

Parameters:

deferLoading - the deferLoading value to set.

Returns:

the FunctionTool object itself.

setDescription

public FunctionTool setDescription(String description)

Set the description property: The description property.

Parameters:

description - the description value to set.

Returns:

the FunctionTool object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

FunctionTool.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to