You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Object of type "InterventionProxy" cannot be used with "with" because it does not implement __enter__
Attribute "__enter__" is unknown
Object of type "InterventionProxy" cannot be used with "with" because it does not implement __exit__
It looks like this because LanguageModel.__new__() is typed as returning either a LanguageModel or an Envoy. Envoy.__call__() returns an InterventionProxy, which is not a contextmanager. Since the type checker doesn't know if the model is a LanguageModel or an Envoy, it has to assume that model might be an Envoy and thus can't use with model.trace() as a contextmanager. It seems like __new__() should be typed to just return a LanguageModel, no?
The text was updated successfully, but these errors were encountered:
The following code works, but pyright/pylance gives a typing error:
The errors are the following:
It looks like this because
LanguageModel.__new__()
is typed as returning either aLanguageModel
or anEnvoy
.Envoy.__call__()
returns anInterventionProxy
, which is not a contextmanager. Since the type checker doesn't know if the model is aLanguageModel
or anEnvoy
, it has to assume thatmodel
might be anEnvoy
and thus can't usewith model.trace()
as a contextmanager. It seems like__new__()
should be typed to just return aLanguageModel
, no?The text was updated successfully, but these errors were encountered: