Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit IHttpLlmFunction.description length under 1,024. #124

Merged
merged 1 commit into from
Jan 13, 2025
Merged

Conversation

samchon
Copy link
Owner

@samchon samchon commented Jan 13, 2025

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 the IHttpLlmApplication composing process.

In the same way, typia.llm.application<App, Model>() and typia.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:

Updates to JSON schema files:

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.
  • Updated various test cases to correct the validation function call:
    • 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 from 2.3.4 to 2.4.0.

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 the `IHttpLlmApplication` composing process.

In the same way, `typia.llm.application<App, Model>()` and `typia.llm.applicationOfValidate<App, Model>()` functions will block the 1,024 length over description too.
@samchon samchon added documentation Improvements or additions to documentation enhancement New feature or request labels Jan 13, 2025
@samchon samchon self-assigned this Jan 13, 2025
Copy link
Owner Author

@samchon samchon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test OK.

@samchon samchon merged commit 0d31c4f into master Jan 13, 2025
3 checks passed
@samchon samchon deleted the feat/length branch January 13, 2025 14:56
samchon added a commit to samchon/typia that referenced this pull request Jan 13, 2025
As OpenAI (ChatGPT) restricts function name and description lengths (64 and 1,024), `@samchon/openapi`'s `HttpLlm.application()` function converting OpenAPI document to LLM function calling application has adopted it.

Therefore, this PR makes `typia` to occur compilation error when 64 length over function name comes, or 1,024 length over descripted function comes.

Also, `typia` has allowed empty parameterized functions in the `typia.llm.application()` function.
samchon added a commit to samchon/typia that referenced this pull request Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant