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.
IHttpLlmFunction.description
is composed by below rule:
@param
tag.@security
tag.@tag
tag.@deprecated
tag is added.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.
HTTP method of the endpoint.
Representative name of the function.
The name
is a repsentative name identifying the function in the
IHttpLlmApplication. The name
value is just composed by joining the
IHttpMigrateRoute.accessor by underscore _
character.
Here is the composition rule of the IHttpMigrateRoute.accessor:
The
accessor
is composed with the following rules. At first, namespaces are composed by static directory names in the path. Parametric symbols represented by:param
or{param}
cannot be a part of the namespace.Instead, they would be a part of the function name. The function name is composed with the HTTP method and parametric symbols like
getByParam
orpostByParam
. If there are multiple path parameters, they would be concatenated byAnd
likegetByParam1AndParam2
.For refefence, if the operation's method is
delete
, the function name would be replaced toerase
instead ofdelete
. It is the reason why thedelete
is a reserved keyword in many programming languages.
- Example 1
- path:
POST /shopping/sellers/sales
- accessor:
shopping.sellers.sales.post
- Example 2
- endpoint: `GET /shoppings/sellers/sales/:saleId/reviews/:reviewId/comments/:id
- accessor:
shoppings.sellers.sales.reviews.getBySaleIdAndReviewIdAndCommentId
Get the Swagger operation metadata.
Get the Swagger operation metadata, of the source.
Swagger operation metadata.
Optional
outputExpected return type.
If the target operation returns nothing (void
), the output
would be undefined
.
List of parameter types.
If you've configured IHttpLlmApplication.IOptions.keyword as true
,
number of IHttpLlmFunction.parameters are always 1 and the first
parameter's type is always ILlmSchemaV3.IObject. The
properties' rule is:
pathParameters
: Path parameters of IHttpMigrateRoute.parametersquery
: Query parameter of IHttpMigrateRoute.querybody
: Body parameter of IHttpMigrateRoute.body{
...pathParameters,
query,
body,
}
Otherwise, the parameters would be multiple, and the sequence of the parameters are following below rules:
[
...pathParameters,
...(query ? [query] : []),
...(body ? [body] : []),
]
Path of the endpoint.
Get the migration route metadata.
Get the migration route metadata, of the source.
Migration route metadata.
Optional
separatedCollection of separated parameters.
Filled only when IHttpLlmApplication.IOptions.separate is configured.
Optional
tagsCategory tags for the function.
Same with OpenApi.IOperation.tags indicating the category of the function.
LLM function calling schema from HTTP (OpenAPI) operation.
IHttpLlmFunction
is a data structure representing a function converted from the OpenAPI operation, used for the LLM (Large Language Model) function calling. It's a typical RPC (Remote Procedure Call) structure containing the function name, parameters, and return type.If you provide this
IHttpLlmFunction
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 through LlmFetcher.execute and get the result.For reference, different between
IHttpLlmFunction
and its origin source OpenApi.IOperation is,IHttpLlmFunction
has converted every type schema information from OpenApi.IJsonSchema to ILlmSchemaV3 to escape reference types, and downgrade the version of the JSON schema to OpenAPI 3.0. It's because LLM function call feature cannot understand both reference types and OpenAPI 3.1 specification.Additionally, the properties' rule is:
pathParameters
: Path parameters of OpenApi.IOperation.parametersquery
: Query parameter of IHttpMigrateRoute.querybody
: Body parameter of IHttpMigrateRoute.bodyReference
https://platform.openai.com/docs/guides/function-calling
Author
Jeongho Nam - https://github.com/samchon