Skip to content
Open
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
6 changes: 4 additions & 2 deletions semantic_router/index/pinecone.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ def __init__(
namespace: Optional[str] = "",
base_url: Optional[str] = "https://api.pinecone.io",
init_async_index: bool = False,
client: "pinecone.Pinecone" = None,
):
super().__init__()
self.api_key = api_key or os.getenv("PINECONE_API_KEY")
if not self.api_key:
raise ValueError("Pinecone API key is required.")
self.headers = {
Expand Down Expand Up @@ -160,7 +160,9 @@ def __init__(
if self.api_key is None:
raise ValueError("Pinecone API key is required.")

self.client = self._initialize_client(api_key=self.api_key)
if not client:
client = self._initialize_client(api_key=self.api_key)
self.client = client

# try initializing index
self.index = self._init_index()
Expand Down
Loading