Class FunctionObject

java.lang.Object
com.sap.ai.sdk.prompt.registry.model.FunctionObject

public class FunctionObject extends Object
FunctionObject
  • Constructor Details

    • FunctionObject

      protected FunctionObject()
      Default constructor for FunctionObject.
  • Method Details

    • description

      @Nonnull public FunctionObject description(@Nullable String description)
      Set the description of this FunctionObject instance and return the same instance.
      Parameters:
      description - A description of what the function does, used by the model to choose when and how to call the function.
      Returns:
      The same instance of this FunctionObject class
    • getDescription

      @Nonnull public String getDescription()
      A description of what the function does, used by the model to choose when and how to call the function.
      Returns:
      description The description of this FunctionObject instance.
    • setDescription

      public void setDescription(@Nullable String description)
      Set the description of this FunctionObject instance.
      Parameters:
      description - A description of what the function does, used by the model to choose when and how to call the function.
    • name

      @Nonnull public FunctionObject name(@Nonnull String name)
      Set the name of this FunctionObject instance and return the same instance.
      Parameters:
      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.
      Returns:
      The same instance of this FunctionObject class
    • getName

      @Nonnull public String getName()
      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.
      Returns:
      name The name of this FunctionObject instance.
    • setName

      public void setName(@Nonnull String name)
      Set the name of this FunctionObject instance.
      Parameters:
      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.
    • parameters

      @Nonnull public FunctionObject parameters(@Nullable Map<String,Object> parameters)
      Set the parameters of this FunctionObject instance and return the same instance.
      Parameters:
      parameters - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting `parameters` defines a function with an empty parameter list.
      Returns:
      The same instance of this FunctionObject class
    • putparametersItem

      @Nonnull public FunctionObject putparametersItem(@Nonnull String key, @Nullable Object parametersItem)
      Put one parameters instance to this FunctionObject instance.
      Parameters:
      key - The String key of this parameters instance
      parametersItem - The parameters that should be added under the given key
      Returns:
      The same instance of type FunctionObject
    • getParameters

      @Nonnull public Map<String,Object> getParameters()
      The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting `parameters` defines a function with an empty parameter list.
      Returns:
      parameters The parameters of this FunctionObject instance.
    • setParameters

      public void setParameters(@Nullable Map<String,Object> parameters)
      Set the parameters of this FunctionObject instance.
      Parameters:
      parameters - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting `parameters` defines a function with an empty parameter list.
    • strict

      @Nonnull public FunctionObject strict(@Nullable Boolean strict)
      Set the strict of this FunctionObject instance and return the same instance.
      Parameters:
      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 when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
      Returns:
      The same instance of this FunctionObject class
    • isStrict

      @Nullable public Boolean isStrict()
      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 when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
      Returns:
      strict The strict of this FunctionObject instance.
    • setStrict

      public void setStrict(@Nullable Boolean strict)
      Set the strict of this FunctionObject instance.
      Parameters:
      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 when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
    • getCustomFieldNames

      @Nonnull public Set<String> getCustomFieldNames()
      Get the names of the unrecognizable properties of the FunctionObject.
      Returns:
      The set of properties names
    • getCustomField

      @Nullable @Deprecated public Object getCustomField(@Nonnull String name) throws NoSuchElementException
      Deprecated.
      Use toMap() instead.
      Get the value of an unrecognizable property of this FunctionObject instance.
      Parameters:
      name - The name of the property
      Returns:
      The value of the property
      Throws:
      NoSuchElementException - If no property with the given name could be found.
    • toMap

      @Nonnull public Map<String,Object> toMap()
      Get the value of all properties of this FunctionObject instance including unrecognized properties.
      Returns:
      The map of all properties
    • setCustomField

      public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue)
      Set an unrecognizable property of this FunctionObject instance. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
      Parameters:
      customFieldName - The name of the property
      customFieldValue - The value of the property
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object
    • create

      public static FunctionObject.Builder create()
      Create a type-safe, fluent-api builder object to construct a new FunctionObject instance with all required arguments.