diff --git a/pyproject.toml b/pyproject.toml index d7fba4d0..9e2cfd67 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "semantic-router" -version = "0.0.51" +version = "0.0.52" description = "Super fast semantic router for AI decision making" authors = [ "James Briggs ", diff --git a/semantic_router/index/base.py b/semantic_router/index/base.py index 9e226da7..76388d1d 100644 --- a/semantic_router/index/base.py +++ b/semantic_router/index/base.py @@ -18,6 +18,7 @@ class BaseIndex(BaseModel): utterances: Optional[np.ndarray] = None dimensions: Union[int, None] = None type: str = "base" + init_async_index: bool = False sync: Union[str, None] = None def add( diff --git a/semantic_router/index/pinecone.py b/semantic_router/index/pinecone.py index a9c93ccd..fdd87320 100644 --- a/semantic_router/index/pinecone.py +++ b/semantic_router/index/pinecone.py @@ -66,6 +66,7 @@ def __init__( namespace: Optional[str] = "", base_url: Optional[str] = "https://api.pinecone.io", sync: str = "local", + init_async_index: bool = False, ): super().__init__() self.index_name = index_name @@ -84,7 +85,10 @@ def __init__( raise ValueError("Pinecone API key is required.") self.client = self._initialize_client(api_key=self.api_key) - self.async_client = self._initialize_async_client(api_key=self.api_key) + if init_async_index: + self.async_client = self._initialize_async_client(api_key=self.api_key) + else: + self.async_client = None def _initialize_client(self, api_key: Optional[str] = None): try: