Skip to content
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

[refactor] Introduce PluginAware utility class #443

Merged
merged 4 commits into from
Jan 31, 2025

Conversation

jhamon
Copy link
Collaborator

@jhamon jhamon commented Jan 31, 2025

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, PluginAware which pluggable classes may extend.

Solution

  • I have made all the currently pluggable classes (Pinecone, PineconeGRPC, Index, Inference) extend PluginAware and deleted duplicated code. In order to be pluggable, a class must have attributes for config, openapi_config, pool_threads and rely on conventional openapi libraries (e.g. generated Api classes and ApiClient) 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

  • None of the above: Refactor

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 Pinecone class without errors.

@jhamon jhamon changed the base branch from main to release-candidate/2025-01 January 31, 2025 16:01
@jhamon jhamon changed the title Introduce PluginAware utility class [refactor] Introduce PluginAware utility class Jan 31, 2025
@jhamon jhamon marked this pull request as ready for review January 31, 2025 16:06
Copy link
Contributor

@austin-denoble austin-denoble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea. 👍

@jhamon jhamon merged commit 980ac3b into release-candidate/2025-01 Jan 31, 2025
74 of 75 checks passed
@jhamon jhamon deleted the jhamon/plugin-aware branch January 31, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants