Skip to content

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

Closed
vish0l wants to merge 1 commit intosashabaranov:masterfrom
vish0l:support-union-type
Closed

Change Definition struct 'Type' field to support multiple data types …#833
vish0l wants to merge 1 commit intosashabaranov:masterfrom
vish0l:support-union-type

Conversation

@vish0l
Copy link
Copy Markdown

@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

@codecov
Copy link
Copy Markdown

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
Copy Markdown
Owner

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

@vish0l
Copy link
Copy Markdown
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