-
-
Notifications
You must be signed in to change notification settings - Fork 663
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
fix: hotfix create_with_completion
failing for AdapterBase
, ParallelBase
, IterableBase
and PartialBase
#1103
base: main
Are you sure you want to change the base?
fix: hotfix create_with_completion
failing for AdapterBase
, ParallelBase
, IterableBase
and PartialBase
#1103
Conversation
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.
👍 Looks good to me! Reviewed everything up to 1f30dce in 35 seconds
More details
- Looked at
300
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
8
drafted comments based on config settings.
1. instructor/client.py:28
- Draft comment:
Consider adding type annotations for theraw
andprocessed
attributes in theCreation
class to improve code clarity and type safety. - Reason this comment was not posted:
Confidence changes required:80%
TheCreation
class is missing type annotations for its attributesraw
andprocessed
. This can lead to confusion and potential misuse of the class.
2. instructor/client.py:37
- Draft comment:
Update the type ofcreate_fn
toCallable[..., Creation[T]]
to ensure consistency with the constructor and type safety. - Reason this comment was not posted:
Confidence changes required:80%
Thecreate_fn
attribute in theInstructor
class is defined asCallable[..., Any]
, but it should beCallable[..., Creation[T]]
to match the constructor and ensure type consistency.
3. instructor/client.py:368
- Draft comment:
Update the type ofcreate_fn
toCallable[..., Creation[T]]
to ensure consistency with the constructor and type safety. - Reason this comment was not posted:
Confidence changes required:80%
Thecreate_fn
attribute in theAsyncInstructor
class is defined asCallable[..., Any]
, but it should beCallable[..., Creation[T]]
to match the constructor and ensure type consistency.
4. instructor/retry.py:108
- Draft comment:
Update the return type in the docstring toCreation[T_Model] | None
for consistency with the function's return type. - Reason this comment was not posted:
Confidence changes required:50%
Theretry_sync
andretry_async
functions have been updated to returnCreation[T_Model] | None
, but the docstring return type still mentionsT_Model | None
. This should be updated for consistency.
5. instructor/retry.py:189
- Draft comment:
Update the return type in the docstring toCreation[T_Model] | None
for consistency with the function's return type. - Reason this comment was not posted:
Confidence changes required:50%
Theretry_sync
andretry_async
functions have been updated to returnCreation[T_Model] | None
, but the docstring return type still mentionsT_Model | None
. This should be updated for consistency.
6. instructor/client.py:27
- Draft comment:
The introduction of theCreation
class is a change in the library code. Ensure that the documentation is updated to reflect this change. - Reason this comment was not posted:
Confidence changes required:80%
TheCreation
class is introduced in theinstructor/client.py
file, which is a change in the library code. However, there is no indication that the documentation has been updated to reflect this change. According to the principles, if library code changes, the documentation should be updated accordingly.
7. instructor/patch.py:16
- Draft comment:
The introduction of theCreation
class is a change in the library code. Ensure that the documentation is updated to reflect this change. - Reason this comment was not posted:
Confidence changes required:80%
TheCreation
class is introduced in theinstructor/patch.py
file, which is a change in the library code. However, there is no indication that the documentation has been updated to reflect this change. According to the principles, if library code changes, the documentation should be updated accordingly.
8. instructor/retry.py:9
- Draft comment:
The introduction of theCreation
class is a change in the library code. Ensure that the documentation is updated to reflect this change. - Reason this comment was not posted:
Confidence changes required:80%
TheCreation
class is introduced in theinstructor/retry.py
file, which is a change in the library code. However, there is no indication that the documentation has been updated to reflect this change. According to the principles, if library code changes, the documentation should be updated accordingly.
Workflow ID: wflow_siD89ALUCSdoBjXz
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
will this break for folks who access _raw_response or type inference? |
Hey @jxnl good questions
|
Hey @ivanbelenky great that you tackled this problem. At the moment my code is starting to get polluted with all sorts of 'dummy models` that look like
and the addition of this boilerplate seems to very much against the ethos of this library. |
Describe your changes
The change solve
create_with_completion
failing withAdapterBase
,ParallelBase
,IterableBase
andPartialBase
types. Every singleinstructor.create_fn
call is wrapped with aCreation
object. The idea for this wrapper is to be as simple as a container for both the raw response from the LM client, and the processed response byinstructor
.Then
retry_sync
andretry_async
return types were altered fromT_Model
toCreation[T_Model]
.For further traceability in instructor calls, a runtime accessible Inspector|Monitor could be set up. Capturing calls as a postfix for every single
create_fn
call.Related Issue
Important
Fixes
create_with_completion
failures by introducingCreation
class to wrap responses, updating return types ininstructor/client.py
,instructor/patch.py
, andinstructor/retry.py
.create_with_completion
failing forAdapterBase
,ParallelBase
,IterableBase
, andPartialBase
by introducingCreation
class ininstructor/client.py
.Creation
class wraps raw and processed responses.retry_sync
andretry_async
ininstructor/retry.py
to returnCreation[T_Model]
.create
,create_partial
,create_iterable
, andcreate_with_completion
inInstructor
andAsyncInstructor
classes to useCreation
.new_create_sync
andnew_create_async
ininstructor/patch.py
to handleCreation
.Generic
import ininstructor/client.py
forCreation
class.This description was created by for 1f30dce. It will automatically update as commits are pushed.