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

Change Definition struct 'Type' field to support multiple data types … #833

Closed
wants to merge 1 commit into from

Conversation

vish0l
Copy link

@vish0l vish0l commented Aug 22, 2024

Describe the change
This PR modifies the Definition struct by updating the Type field to support multiple data types. This change is intended to facilitate the use of union types for parameters, allowing schemas to accommodate a broader range of data types as specified by the OpenAI documentation.

Provide OpenAI documentation link
https://platform.openai.com/docs/guides/structured-outputs/supported-schemas

Describe your solution
To address the need for supporting union types in schema definitions, the Type field in the Definition struct has been updated to allow for multiple data types. This change enables developers to define schemas that can handle a variety of data types, offering more flexibility in schema design.

Tests
Tested manually for both types (existing single type format and new multiple format)

Issue: #832

Copy link

codecov bot commented Aug 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.01%. Comparing base (774fc9d) to head (9f5f5d7).
Report is 45 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #833      +/-   ##
==========================================
+ Coverage   98.46%   99.01%   +0.55%     
==========================================
  Files          24       26       +2     
  Lines        1364     1418      +54     
==========================================
+ Hits         1343     1404      +61     
+ Misses         15        8       -7     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sashabaranov
Copy link
Owner

Hey @vish0l, we've just merged #819 with Schema improvements — please let me know if it works for you!

@vish0l
Copy link
Author

vish0l commented Aug 27, 2024

@sashabaranov works, thanks.

@vish0l vish0l closed this Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants