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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(response model): introduce handling of simple types #447

Merged
merged 3 commits into from
Feb 19, 2024
Merged

Conversation

jxnl
Copy link
Owner

@jxnl jxnl commented Feb 19, 2024

Ellipsis 馃殌 This PR description was created by Ellipsis for commit 2319fff.

Summary:

This PR introduces handling of simple types in the response model, adds a new is_simple_type function and ModelAdapter class, updates several functions in patch.py, and includes new tests in test_simple_types.py.

Key points:

  • Introduced handling of simple types in the response model.
  • Added is_simple_type function and ModelAdapter class in simple_type.py.
  • Updated handle_response_model, process_response, and process_response_async in patch.py to handle simple types.
  • Added new tests in test_simple_types.py for simple types handling.

Generated with 鉂わ笍 by ellipsis.dev

@jxnl jxnl requested review from lukevs and shanktt February 19, 2024 21:09
@ellipsis-dev ellipsis-dev bot changed the title ... feat(response model): introduce handling of simple types Feb 19, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Reviewed entire PR up to commit d289c31

Reviewed 330 lines of code across 5 files in 44 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_91jodXUOg8t4sfcp
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at instructor/dsl/simple_type.py:41

Notes: The PR introduces a new feature to handle simple types in the response model. The code changes look good and the logic seems sound. The new feature is well tested. However, there is a minor issue with the comment in the is_simple_type function in the simple_type.py file. The comment is incomplete and does not provide any useful information.

The comment on this line seems to be incomplete. Please provide a complete and meaningful comment.

Confidence changes required: 80%


Something look wrong? Tag @ellipsis-dev in a comment, or customize the ellipsis.yaml for this repository.

Generated with 鉂わ笍 by ellipsis.dev

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Incremental review on commit b40fc41

Reviewed 38 lines of code across 2 files in 1 minute(s) and 9 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_XXeWqHRlSDCuWJSs
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 additional comments

Filtered comment at instructor/dsl/simple_type.py:27

Notes: The PR introduces handling of simple types in the response model. The changes in the code seem to be logically correct. The is_simple_type function checks if the response model is a simple type and the ModelAdapter class wraps the simple types in a BaseModel. The changes in patch.py handle instances of AdapterBase. The tests also seem to cover the new functionality adequately. However, there is a minor issue in the simple_type.py file where the create_model function is called with ... as the second argument for content. This is not a valid default value and should be replaced with None.

The ... in this line is not a valid default value for the content field. It should be replaced with None.

content=(response_model, None),

Confidence changes required: 100%

Score: 70%


Something look wrong? Tag @ellipsis-dev in a comment, or customize the ellipsis.yaml for this repository.

Generated with 鉂わ笍 by ellipsis.dev

messages=[
{
"role": "user",
"content": "Product a Random but correct response given the desired output",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Product a"

Copy link
Collaborator

@lukevs lukevs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo in tests otherwise solid! I like this for enums

@jxnl
Copy link
Owner Author

jxnl commented Feb 19, 2024

@lukevs I ripped your code to merge onto this one

@jxnl jxnl merged commit 2319fff into main Feb 19, 2024
11 checks passed
@jxnl jxnl deleted the simple-types branch February 19, 2024 21:49
@shanktt
Copy link
Collaborator

shanktt commented Feb 19, 2024

Looks good! I like how this is moving us away from unnecessary wrapper classes like we talked about for parallel models @jxnl

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Incremental review on commit 8f37a29

Reviewed 58 lines of code across 1 files in 54 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_fp8ihwcN6NZf8kad
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at tests/openai/test_simple_types.py:17

Notes: The tests seem to be well written and cover a variety of cases. However, there is a lot of repetition in the test cases. The same 'client.chat.completions.create' function is called with the same parameters except for the 'response_model'. This could be refactored into a helper function to make the code DRY (Don't Repeat Yourself).

Consider refactoring the repeated 'client.chat.completions.create' calls into a helper function to adhere to the DRY principle. This function could take the 'response_model' as a parameter, which is the only varying element in these calls.

Confidence changes required: 80%


Something look wrong? Tag @ellipsis-dev in a comment, or customize the ellipsis.yaml for this repository.

Generated with 鉂わ笍 by ellipsis.dev

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Incremental review on commit 2319fff

Reviewed 345 lines of code across 5 files in 1 minute(s) and 8 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_mkH6NOy86WQrdqr6
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at instructor/dsl/simple_type.py:64

Notes: The new is_simple_type function and ModelAdapter class in simple_type.py seem to be implemented correctly. They handle simple types in the response model as expected. The updates in patch.py also look good, as they now handle simple types. The tests in test_simple_types.py cover all the new functionality and pass.

The implementation of simple types handling in the response model looks good. The new is_simple_type function and ModelAdapter class are correctly defined and used. The updates in patch.py correctly handle simple types. The tests cover all the new functionality and pass.

Confidence changes required: 10%


Something look wrong? Tag @ellipsis-dev in a comment, or customize the ellipsis.yaml for this repository.

Generated with 鉂わ笍 by ellipsis.dev

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.

None yet

3 participants