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

Allow passing any object in json schema in response format #831

Closed
wants to merge 1 commit into from

Conversation

samarthpatil00
Copy link

Describe the change

  • Changed type of Schema field in ChatCompletionResponseFormatJSONSchema from jsonschema.Definition to any. This will allow it to be more flexible and accept schemas from multiple sources rather than just the internal jsonschema package.
  • Added integration test for the change.

Tests

  • Integration test added
=== RUN   TestAPI
--- PASS: TestAPI (5.63s)
=== RUN   TestCompletionStream
--- PASS: TestCompletionStream (0.79s)
=== RUN   TestAPIError
--- PASS: TestAPIError (0.32s)
=== RUN   TestChatCompletionResponseFormat_JSONSchema
--- PASS: TestChatCompletionResponseFormat_JSONSchema (1.11s)
=== RUN   TestChatCompletionStructuredOutputsFunctionCalling
--- PASS: TestChatCompletionStructuredOutputsFunctionCalling (1.13s)
=== RUN   TestChatCompletionResponseFormat_JSONSchemaAsString
--- PASS: TestChatCompletionResponseFormat_JSONSchemaAsString (5.21s)
PASS
ok      command-line-arguments  14.684s

Issue: #829

Copy link

codecov bot commented Aug 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.00%. Comparing base (774fc9d) to head (3fa49d5).
Report is 45 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #831      +/-   ##
==========================================
+ Coverage   98.46%   99.00%   +0.54%     
==========================================
  Files          24       26       +2     
  Lines        1364     1410      +46     
==========================================
+ Hits         1343     1396      +53     
+ Misses         15        8       -7     
  Partials        6        6              

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

@samarthpatil00
Copy link
Author

@sashabaranov
Hi, can you please review this change, it is pretty straightforward

@newhook
Copy link

newhook commented Aug 23, 2024

@sashabaranov Hi, can you please review this change, it is pretty straightforward

I just tested it locally and it works well.

@sashabaranov
Copy link
Owner

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

@samarthpatil00
Copy link
Author

Thanks @sashabaranov , it is working now :)

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.

3 participants