Resolve Typing Issues on Wrapping OpenAI Client #1156
Merged
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.
Details
When wrapping the OpenAI client with the tracker, it set the type as a Union of both the regular and async client. This caused downstream type check errors when using OpenAI classes. TypeVar can resolve this by allowing the output type to match the input type. The IDE will now understand that the type of the client remains the same.
This is the same pattern that currently exists in the Anthropic wrapper.
Issues
Resolves #1152
Testing
Tested locally, fixed the problem. This is my first time contributing, so would love advice/help on what the order of operations is for contributing.
Documentation
No updates to documentation required.