[refactor] Introduce PluginAware utility class#443
Merged
jhamon merged 4 commits intorelease-candidate/2025-01from Jan 31, 2025
Merged
[refactor] Introduce PluginAware utility class#443jhamon merged 4 commits intorelease-candidate/2025-01from
jhamon merged 4 commits intorelease-candidate/2025-01from
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
As I've been working on bringing in inference features and asyncio stuff, I felt like I was duplicating too much code related to plugins. I decided to pull the setup steps into a new class,
PluginAwarewhich pluggable classes may extend.Solution
I have made all the currently pluggable classes (Pinecone, PineconeGRPC, Index, Inference) extend
PluginAwareand deleted duplicated code. In order to be pluggable, a class must have attributes forconfig,openapi_config,pool_threadsand rely on conventional openapi libraries (e.g. generated Api classes andApiClient) for network calls.I have removed the plugin code from Asyncio variant classes (PineconeAsyncio, AsyncioIndex, AsyncioInference) because even though these are built around openapi internals they require async context management that is incompatible with the current plugin approach (which news up a fresh copy of ApiClient for each plugin).
I removed plugin code from GRPCIndex. As far as I know this was never used and it seems confusing trying to figure out how this fits into the picture with plugins as the plugin stuff is very openapi centric. Also since we seldom build grpc stuff first, I don't think we can expect to need this capability.
Type of Change
Test Plan
I did a bit of manual testing and looking at logs to confirm this seems to work after the changes. I tested with the assistant plugin which installed into the
Pineconeclass without errors.