Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pinecone/grpc/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

_logger = logging.getLogger(__name__)


class GRPCIndexBase(ABC):
"""
Base class for grpc-based interaction with Pinecone indexes
Expand All @@ -29,12 +30,13 @@ def __init__(
self,
index_name: str,
config: Config,
channel: Optional[Channel] =None,
channel: Optional[Channel] = None,
grpc_config: Optional[GRPCClientConfig] = None,
_endpoint_override: Optional[str] = None,
):
self.name = index_name

self.config = config
self.grpc_client_config = grpc_config or GRPCClientConfig()
self.retry_config = self.grpc_client_config.retry_config or RetryConfig()
self.fixed_metadata = {"api-key": config.api_key, "service-name": index_name, "client-version": CLIENT_VERSION}
Expand Down Expand Up @@ -76,11 +78,8 @@ def stub_class(self):
pass

def _endpoint(self):
return (
self._endpoint_override
if self._endpoint_override
else f"{self.name}-{Config.PROJECT_NAME}.svc.{Config.ENVIRONMENT}.pinecone.io:443"
)
grpcHost = self.config.host.replace("https://", "")
return self._endpoint_override if self._endpoint_override else f"{grpcHost}:443"

def _gen_channel(self, options=None):
target = self._endpoint()
Expand Down