Limit IHttpLlmFunction.description
length under 1,024.
#124
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As OpenAI (ChatGPT) does not allow over 1,024 length description property on the tool calling's function definition,
@samchon/openapi
also blocks it on theIHttpLlmApplication
composing process.In the same way,
typia.llm.application<App, Model>()
andtypia.llm.applicationOfValidate<App, Model>()
functions will block the 1,024 length over description too.This pull request includes several changes to improve the handling of descriptions and validation in the
HttpLlmApplicationComposer
and related test files, as well as updates to JSON schema files. The most important changes include the addition of description length validation, reordering of JSON schema properties, and updates to test cases.Improvements to description handling and validation:
src/composers/HttpLlmApplicationComposer.ts
: Added logic to handle operation descriptions, ensuring they are properly formatted and do not exceed 1024 characters. If the description is too long, an error is added toprops.errors
. [1] [2] [3] [4]Updates to JSON schema files:
examples/function-calling/schemas/claude.sale.schema.json
: Reordered therequired
property for units to ensure it appears after thename
property. [1] [2] [3]Test case updates:
test/features/llm/chatgpt/test_chatgpt_function_calling_description_length.ts
: Added a new test case to validate that descriptions do not exceed 1024 characters.test/features/llm/chatgpt/test_chatgpt_function_calling_name_length.ts
: Added a new test case to validate function names with a maximum length of 64 characters.test/features/llm/chatgpt/test_chatgpt_function_calling_additionalProperties.ts
test/features/llm/chatgpt/test_chatgpt_function_calling_example.ts
test/features/llm/chatgpt/test_chatgpt_function_calling_optional.ts
test/features/llm/chatgpt/test_chatgpt_function_calling_recursive.ts
test/features/llm/chatgpt/test_chatgpt_function_calling_union.ts
test/features/llm/claude/test_claude_function_calling_additionalProperties.ts
Other changes:
package.json
: Updated the version number from2.3.4
to2.4.0
.