33
33
from ..utils import (
34
34
setup_openapi_client ,
35
35
parse_non_empty_args ,
36
- build_plugin_setup_client ,
37
36
validate_and_convert_errors ,
37
+ PluginAware ,
38
38
)
39
39
from .query_results_aggregator import QueryResultsAggregator , QueryNamespacesResults
40
40
from pinecone .openapi_support import OPENAPI_ENDPOINT_PARAMS
41
41
42
42
from multiprocessing .pool import ApplyResult
43
43
from concurrent .futures import as_completed
44
44
45
- from pinecone_plugin_interface import load_and_install as install_plugins
46
45
47
46
logger = logging .getLogger (__name__ )
48
47
@@ -52,7 +51,7 @@ def parse_query_response(response: QueryResponse):
52
51
return response
53
52
54
53
55
- class Index (IndexInterface , ImportFeatureMixin ):
54
+ class Index (IndexInterface , ImportFeatureMixin , PluginAware ):
56
55
"""
57
56
A client for interacting with a Pinecone index via REST API.
58
57
For improved performance, use the Pinecone GRPC index client.
@@ -70,17 +69,17 @@ def __init__(
70
69
self .config = ConfigBuilder .build (
71
70
api_key = api_key , host = host , additional_headers = additional_headers , ** kwargs
72
71
)
73
- self ._openapi_config = ConfigBuilder .build_openapi_config (self .config , openapi_config )
74
- self ._pool_threads = pool_threads
72
+ self .openapi_config = ConfigBuilder .build_openapi_config (self .config , openapi_config )
73
+ self .pool_threads = pool_threads
75
74
76
75
if kwargs .get ("connection_pool_maxsize" , None ):
77
- self ._openapi_config .connection_pool_maxsize = kwargs .get ("connection_pool_maxsize" )
76
+ self .openapi_config .connection_pool_maxsize = kwargs .get ("connection_pool_maxsize" )
78
77
79
78
self ._vector_api = setup_openapi_client (
80
79
api_client_klass = ApiClient ,
81
80
api_klass = VectorOperationsApi ,
82
81
config = self .config ,
83
- openapi_config = self ._openapi_config ,
82
+ openapi_config = self .openapi_config ,
84
83
pool_threads = pool_threads ,
85
84
api_version = API_VERSION ,
86
85
)
@@ -90,22 +89,7 @@ def __init__(
90
89
# Pass the same api_client to the ImportFeatureMixin
91
90
super ().__init__ (api_client = self ._api_client )
92
91
93
- self ._load_plugins ()
94
-
95
- def _load_plugins (self ):
96
- """@private"""
97
- try :
98
- # I don't expect this to ever throw, but wrapping this in a
99
- # try block just in case to make sure a bad plugin doesn't
100
- # halt client initialization.
101
- openapi_client_builder = build_plugin_setup_client (
102
- config = self .config ,
103
- openapi_config = self ._openapi_config ,
104
- pool_threads = self ._pool_threads ,
105
- )
106
- install_plugins (self , openapi_client_builder )
107
- except Exception as e :
108
- logger .error (f"Error loading plugins in Index: { e } " )
92
+ self .load_plugins ()
109
93
110
94
def _openapi_kwargs (self , kwargs ):
111
95
return {k : v for k , v in kwargs .items () if k in OPENAPI_ENDPOINT_PARAMS }
0 commit comments