fix: hotfix create_with_completion
failing for AdapterBase
, ParallelBase
, IterableBase
and PartialBase
#1103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.