Class OpenAiTool
java.lang.Object
com.sap.ai.sdk.foundationmodels.openai.OpenAiTool
Represents an OpenAI tool that can be used to define a function call in an OpenAI Chat Completion
request. This tool generates a JSON schema based on the provided class representing the
function's request structure.
- Since:
- 1.8.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCreates a new OpenAiTool instance with the specified function and input class.static interfaceCreates a new OpenAiTool instance with the specified name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <InputT> OpenAiTool.Builder1<InputT> forFunction(Function<InputT, ?> function) Instantiates a OpenAiTool builder instance on behalf of an executable function.inthashCode()toString()withDescription(String description) An optional description of the function.withFunctionExecutor(Function<String, Object> functionExecutor) The function to execute a string argument to tool result object.The name of the function.withSchema(com.fasterxml.jackson.databind.node.ObjectNode schema) schema to be used for the function call.withStrict(Boolean strict) An optional flag indicating whether the function parameters should be treated strictly.
-
Method Details
-
forFunction
@Nonnull public static <InputT> OpenAiTool.Builder1<InputT> forFunction(@Nonnull Function<InputT, ?> function) Instantiates a OpenAiTool builder instance on behalf of an executable function.- Type Parameters:
InputT- the type of the function input-argument class.- Parameters:
function- the function to be executed.- Returns:
- an OpenAiTool builder instance.
-
equals
-
hashCode
public int hashCode() -
toString
-
withName
The name of the function.- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withFunctionExecutor
The function to execute a string argument to tool result object.- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withSchema
schema to be used for the function call.- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withDescription
An optional description of the function.- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withStrict
An optional flag indicating whether the function parameters should be treated strictly.- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-