Optional
deprecatedWhether the function is deprecated or not.
If the deprecated
is true
, the function is not recommended to use.
LLM (Large Language Model) may not use the deprecated function.
Optional
descriptionDescription of the function.
For reference, the description
is very important property to teach
the purpose of the function to the LLM (Language Large Model), and
LLM actually determines which function to call by the description.
Also, when the LLM conversates with the user, the description
is
used to explain the function to the user. Therefore, the description
property has the highest priority, and you have to consider it.
Representative name of the function.
Optional
outputExpected return type.
If the function returns nothing (void
), the output
value would
be undefined
.
List of parameter types.
Optional
separatedCollection of separated parameters.
Optional
tagsCategory tags for the function.
You can fill this property by the @tag ${name}
comment tag.
Validate function of the arguments.
You know what? LLM (Large Language Model) like OpenAI takes a lot of
mistakes when composing arguments in function calling. Even though
number
like simple type is defined in the parameters schema,
LLM often fills it just by a string
typed value.
In that case, you have to give a validation feedback to the LLM by
using this validate
function. The validate
function will return
detailed information about every type errors about the arguments.
And in my experience, OpenAI's gpt-4o-mini
model tends to construct
an invalid function calling arguments at the first trial about 50% of
the time. However, if correct it through this validate
function,
the success rate soars to 99% at the second trial, and I've never failed
at the third trial.
Arguments to validate.
Validation result
LLM function metadata.
ILlmFunction
is an interface representing a function metadata, which has been used for the LLM (Language Large Model) function calling. Also, it's a function structure containing the function name, parameters and return type.If you provide this
ILlmFunction
data to the LLM provider like "OpenAI", the "OpenAI" will compose a function arguments by analyzing conversations with the user. With the LLM composed arguments, you can execute the function and get the result.By the way, do not ensure that LLM will always provide the correct arguments. The LLM of present age is not perfect, so that you would better to validate the arguments before executing the function. I recommend you to validate the arguments before execution by using
typia
library.Reference
https://platform.openai.com/docs/guides/function-calling
Author
Jeongho Nam - https://github.com/samchon