Skip to content
New issue

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

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

Already on GitHub? # 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
Yradex pushed a commit to Yradex/lynx-stack that referenced this pull request Mar 4, 2025
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [typia](https://typia.io)
([source](https://github.com/samchon/typia)) | [`7.5.1` ->
`7.6.3`](https://renovatebot.com/diffs/npm/typia/7.5.1/7.6.3) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/typia/7.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/typia/7.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/typia/7.5.1/7.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/typia/7.5.1/7.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>samchon/typia (typia)</summary>

###
[`v7.6.3`](https://github.com/samchon/typia/releases/tag/v7.6.3)

[Compare
Source](https://github.com/samchon/typia/compare/b7ddefa4414df2e69dd844b5619721e4513bbe78...v7.6.3)

#### What's Changed

- Fix
[#&#8203;1486](https://github.com/samchon/typia/issues/1486):
object alias type case in LLM. by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1487](https://github.com/samchon/typia/pull/1487)
- Fix wrong function name in the compilation error messages. by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1488](https://github.com/samchon/typia/pull/1488)

**Full Changelog**:
samchon/typia@v7.6.1...v7.6.3

###
[`v7.6.2`](https://github.com/samchon/typia/compare/v7.6.1...b7ddefa4414df2e69dd844b5619721e4513bbe78)

[Compare
Source](https://github.com/samchon/typia/compare/v7.6.1...b7ddefa4414df2e69dd844b5619721e4513bbe78)

###
[`v7.6.1`](https://github.com/samchon/typia/releases/tag/v7.6.1)

[Compare
Source](https://github.com/samchon/typia/compare/v7.6.0...v7.6.1)

#### What's Changed

- Docs: fix wrong configured tsconfig.json at setup document by
[@&#8203;sunrabbit123](https://github.com/sunrabbit123) in
[https://github.com/samchon/typia/pull/1461](https://github.com/samchon/typia/pull/1461)
- Fix
[samchon/nestia#1063](https://github.com/samchon/nestia/issues/1063):
no `@default` comment tag support. by
@&#8203;samch[https://github.com/samchon/typia/pull/1464](https://github.com/samchon/typia/pull/1464)l/1464
- fix typo by [@&#8203;ryoppippi](https://github.com/ryoppippi)
in
[https://github.com/samchon/typia/pull/1465](https://github.com/samchon/typia/pull/1465)
- Benchmark
[#&#8203;1455](https://github.com/samchon/typia/issues/1455):
measure on Bun.JS by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1471](https://github.com/samchon/typia/pull/1471)
- Close
[#&#8203;1470](https://github.com/samchon/typia/issues/1470):
upgrade eslint by [@&#8203;samchon](https://github.com/samchon)
in
[https://github.com/samchon/typia/pull/1472](https://github.com/samchon/typia/pull/1472)
- fix build for esm by
[@&#8203;ryoppippi](https://github.com/ryoppippi) in
[https://github.com/samchon/typia/pull/1467](https://github.com/samchon/typia/pull/1467)
- include tsconfig and rollup in workflow triggers by
[@&#8203;ryoppippi](https://github.com/ryoppippi) in
[https://github.com/samchon/typia/pull/1469](https://github.com/samchon/typia/pull/1469)
- Introduce how to build A.I. chatbot by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1474](https://github.com/samchon/typia/pull/1474)
- Enhance `/docs/llm/chat` content. by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1475](https://github.com/samchon/typia/pull/1475)
- Assign titles for each website document by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1476](https://github.com/samchon/typia/pull/1476)
- Purify the expression, A.I. chatbot can replace GUI applications. by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1478](https://github.com/samchon/typia/pull/1478)
- Benchmark on server processor: NodeJS versus Bun by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1479](https://github.com/samchon/typia/pull/1479)
- feat: add GitHub Actions CI workflow for code quality by
[@&#8203;ryoppippi](https://github.com/ryoppippi) in
[https://github.com/samchon/typia/pull/1480](https://github.com/samchon/typia/pull/1480)
- chore(gitignore): add bun.lock by
[@&#8203;ryoppippi](https://github.com/ryoppippi) in
[https://github.com/samchon/typia/pull/1482](https://github.com/samchon/typia/pull/1482)
- Update typedoc-github-theme requirement from ^0.2.0 to ^0.2.1 in
/website in the ecosystem group across 1 directory by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/samchon/typia/pull/1460](https://github.com/samchon/typia/pull/1460)
- fix spelling ci & fix typo by
[@&#8203;ryoppippi](https://github.com/ryoppippi) in
[https://github.com/samchon/typia/pull/1481](https://github.com/samchon/typia/pull/1481)
- Bump up `@samchon/openapi` version. by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1485](https://github.com/samchon/typia/pull/1485)

**Full Changelog**:
samchon/typia@v7.6.0...v7.6.1

###
[`v7.6.0`](https://github.com/samchon/typia/releases/tag/v7.6.0)

[Compare
Source](https://github.com/samchon/typia/compare/v7.5.1...v7.6.0)

#### What's Changed

- Detailed documentation about `typia.llm.application()` function by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1443](https://github.com/samchon/typia/pull/1443)
- Update typedoc requirement from ^0.27.5 to ^0.27.6 in /website in the
ecosystem group by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/samchon/typia/pull/1446](https://github.com/samchon/typia/pull/1446)
- Update
[@&#8203;samchon/openapi](https://github.com/samchon/openapi)
requirement from ^2.3.0 to ^2.3.1 in the ecosystem group by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/samchon/typia/pull/1444](https://github.com/samchon/typia/pull/1444)
- Detailed description of `typia.llm.parameters()` function. by
[@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1450](https://github.com/samchon/typia/pull/1450)
- Develop
[samchon/openapi#124](https://github.com/samchon/openapi/issues/124)
and
[samchon/openapi#125](https://github.com/samchon/openapi/issues/125).
by [@&#8203;samchon](https://github.com/samchon) in
[https://github.com/samchon/typia/pull/1459](https://github.com/samchon/typia/pull/1459)

**Full Changelog**:
samchon/typia@v7.5.1...v7.6.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/lynx-wg/lynx-stack).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMjUuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE0NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZSJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Qingyu Wang <colinwang.0616@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant