-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Make ChatGPT strict mode configurable. #112
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As I've understood that ChatGPT's strict mode is not perfect, and found much better way by giving validation feedback with `typia.validate<T>()` function, I've changed the ChatGPT strict mode to be configurable, and also changed ChatGPT function calling (or structured output) composition strategy. From now on, ChatGPT schema also supports the optional properties and dynamic key typed object unless the strict mode configured.
samchon
commented
Dec 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test OK
samchon
added a commit
to samchon/typia
that referenced
this pull request
Dec 14, 2024
samchon
added a commit
to samchon/typia
that referenced
this pull request
Dec 14, 2024
Adapt samchon/openapi#112: ChatGPT strict mode configurable.
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://redirect.github.com/samchon/typia)) | [`7.0.2` -> `7.5.1`](https://renovatebot.com/diffs/npm/typia/7.0.2/7.5.1) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>samchon/typia (typia)</summary> ### [`v7.5.1`](https://redirect.github.com/samchon/typia/releases/tag/v7.5.1) [Compare Source](https://redirect.github.com/samchon/typia/compare/v7.5.0...v7.5.1) #### What's Changed - Update typedoc requirement from ^0.27.4 to ^0.27.5 in /website in the ecosystem group by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/samchon/typia/pull/1437](https://redirect.github.com/samchon/typia/pull/1437) - Fix `ILlmFunction.parameters.description` problem. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1442](https://redirect.github.com/samchon/typia/pull/1442) **Full Changelog**: samchon/typia@v7.5.0...v7.5.1 ### [`v7.5.0`](https://redirect.github.com/samchon/typia/releases/tag/v7.5.0) [Compare Source](https://redirect.github.com/samchon/typia/compare/v7.4.2...v7.5.0) Special update for commercial project performing LLM function calling to the Rest API. #### What's Changed - Adapt `@samchon/[email protected]`. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1440](https://redirect.github.com/samchon/typia/pull/1440) **Full Changelog**: samchon/typia@v7.4.2...v7.5.0 ### [`v7.4.2`](https://redirect.github.com/samchon/typia/releases/tag/v7.4.2) [Compare Source](https://redirect.github.com/samchon/typia/compare/v7.4.1...v7.4.2) #### What's Changed - Fix `typia.llm.applicationOfValidate()` function in generation mode. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1439](https://redirect.github.com/samchon/typia/pull/1439) **Full Changelog**: samchon/typia@v7.4.1...v7.4.2 ### [`v7.4.1`](https://redirect.github.com/samchon/typia/releases/tag/v7.4.1) [Compare Source](https://redirect.github.com/samchon/typia/compare/v7.4.0...v7.4.1) #### What's Changed - Fix LLM schema recursive type detector. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1438](https://redirect.github.com/samchon/typia/pull/1438) **Full Changelog**: samchon/typia@v7.4.0...v7.4.1 ### [`v7.4.0`](https://redirect.github.com/samchon/typia/releases/tag/v7.4.0) [Compare Source](https://redirect.github.com/samchon/typia/compare/v7.3.0...v7.4.0) #### What's Changed - feat(ci): update node versions by [@​ryoppippi](https://redirect.github.com/ryoppippi) in [https://github.com/samchon/typia/pull/1414](https://redirect.github.com/samchon/typia/pull/1414) - Adapt [samchon/openapi#112](https://redirect.github.com/samchon/openapi/issues/112): ChatGPT strict mode configurable. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1434](https://redirect.github.com/samchon/typia/pull/1434) **Full Changelog**: samchon/typia@v7.3.0...v7.4.0 ### [`v7.3.0`](https://redirect.github.com/samchon/typia/releases/tag/v7.3.0) [Compare Source](https://redirect.github.com/samchon/typia/compare/88ca453c1cad0fc5acd465e66380007331b360e8...v7.3.0) #### What's Changed - Adapt nextra v3 update by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1422](https://redirect.github.com/samchon/typia/pull/1422) - Refactor README and index.html by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1423](https://redirect.github.com/samchon/typia/pull/1423) - Fixing [#​1227](https://redirect.github.com/samchon/typia/issues/1227): documentation of `UniqueItems` by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1424](https://redirect.github.com/samchon/typia/pull/1424) - Block LLM function schema composition by `@human` tag. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1427](https://redirect.github.com/samchon/typia/pull/1427) - `ILlmFunction.strict` has been removed. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1428](https://redirect.github.com/samchon/typia/pull/1428) **Full Changelog**: samchon/typia@v7.2.0...v7.3.0 ### [`v7.2.1`](https://redirect.github.com/samchon/typia/compare/v7.2.0...88ca453c1cad0fc5acd465e66380007331b360e8) [Compare Source](https://redirect.github.com/samchon/typia/compare/v7.2.0...88ca453c1cad0fc5acd465e66380007331b360e8) ### [`v7.2.0`](https://redirect.github.com/samchon/typia/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/samchon/typia/compare/v7.1.0...v7.2.0) #### What's Changed - Report `TransformError` in website playground. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1420](https://redirect.github.com/samchon/typia/pull/1420) - Update typedoc requirement from ^0.27.3 to ^0.27.4 in /website in the ecosystem group by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/samchon/typia/pull/1419](https://redirect.github.com/samchon/typia/pull/1419) - Add `IValidation.IError.data` property. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1421](https://redirect.github.com/samchon/typia/pull/1421) **Full Changelog**: samchon/typia@v7.1.0...v7.2.0 ### [`v7.1.0`](https://redirect.github.com/samchon/typia/releases/tag/v7.1.0) [Compare Source](https://redirect.github.com/samchon/typia/compare/v7.0.2...v7.1.0) #### What's Changed - Bump typedoc from 0.26.11 to 0.27.3 in /website in the ecosystem group across 1 directory by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/samchon/typia/pull/1416](https://redirect.github.com/samchon/typia/pull/1416) - New function `typia.llm.applicationOfValidate()`. by [@​samchon](https://redirect.github.com/samchon) in [https://github.com/samchon/typia/pull/1418](https://redirect.github.com/samchon/typia/pull/1418) **Full Changelog**: samchon/typia@v7.0.2...v7.1.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, 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:eyJjcmVhdGVkSW5WZXIiOiIzOS44MC4wIiwidXBkYXRlZEluVmVyIjoiMzkuODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsicmVub3ZhdGUiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Qingyu Wang <[email protected]>
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
good first issue
Good for newcomers
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 I've understood that ChatGPT's strict mode is not perfect, and found much better way by giving validation feedback with
typia.validate<T>()
function, I've changed the ChatGPT strict mode to be configurable, and also changed ChatGPT function calling (or structured output) composition strategy.From now on, ChatGPT schema also supports the optional properties and dynamic key typed object unless the strict mode configured.
This pull request introduces a new strict mode configuration to the ChatGPT schema composer and updates various components to support this feature. The strict mode enforces stricter validation rules, such as requiring all object properties to be mandatory and disallowing additional properties.
Key changes include:
New Features:
strict
configuration option toIChatGptSchema.IConfig
to enforce stricter validation rules.ChatGptSchemaComposer
to use the newstrict
configuration for validation and transformation. [1] [2] [3] [4]Validation Enhancements:
validateStrict
function to enforce strict mode validation rules, ensuring no optional properties and no additional properties are allowed.IChatGptSchema.IParameters
and related interfaces to reflect the new strict mode constraints. [1] [2] [3]Schema Updates:
LlmSchemaV3_1Composer
andChatGptSchemaComposer
to handleadditionalProperties
correctly under strict mode. [1] [2] [3] [4] [5] [6] [7] [8]Testing:
test_chatgpt_function_calling_additionalProperties
,test_chatgpt_function_calling_optional
, andtest_chatgpt_schema_additionalProperties
. [1] [2] [3]Miscellaneous:
@samchon/openapi
package to2.2.0
.These changes collectively enhance the robustness and flexibility of the schema validation process, especially for use cases requiring strict adherence to predefined schemas.