Skip to content
Snippets Groups Projects
Commit 4bb2b05b authored by theanupllm's avatar theanupllm
Browse files

feat: Enhance Pinecone Index configuration for local and cloud environments

- Update PineconeIndex to handle both local and cloud Pinecone index configurations
- Add base_url default to Pinecone cloud API
- Improve logging for base URL selection
- Update documentation notebook to reflect new configuration approach
parent 200e5439
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ Please follow these guidelines when making a contribution: ...@@ -13,7 +13,7 @@ Please follow these guidelines when making a contribution:
- Navigating to /semantic-router. - Navigating to /semantic-router.
- Running `make lint` to fix linting issues. - Running `make lint` to fix linting issues.
- Running `black .` to fix `black` linting issues. - Running `black .` to fix `black` linting issues.
- Running `ruff . --fix` to fix `ruff` linting issues (where possible, others may need manual changes). - Running `ruff check . --fix` to fix `ruff` linting issues (where possible, others may need manual changes).
- Running `mypy .` and then fixing any of the issues that are raised. - Running `mypy .` and then fixing any of the issues that are raised.
- Confirming the linters pass using `make lint` again. - Confirming the linters pass using `make lint` again.
- Ensure that, for any new code, new [PyTests are written](https://github.com/aurelio-labs/semantic-router/tree/main/tests/unit). If any code is removed, then ensure that corresponding PyTests are also removed. Finally, ensure that all remaining PyTests pass using `pytest ./tests` (to avoid integration tests you can run `pytest ./tests/unit`. - Ensure that, for any new code, new [PyTests are written](https://github.com/aurelio-labs/semantic-router/tree/main/tests/unit). If any code is removed, then ensure that corresponding PyTests are also removed. Finally, ensure that all remaining PyTests pass using `pytest ./tests` (to avoid integration tests you can run `pytest ./tests/unit`.
......
This diff is collapsed.
This diff is collapsed.
...@@ -137,7 +137,7 @@ class PineconeIndex(BaseIndex): ...@@ -137,7 +137,7 @@ class PineconeIndex(BaseIndex):
region: str = "us-east-1", region: str = "us-east-1",
host: str = "", host: str = "",
namespace: Optional[str] = "", namespace: Optional[str] = "",
base_url: Optional[str] = "", base_url: Optional[str] = "https://api.pinecone.io",
init_async_index: bool = False, init_async_index: bool = False,
): ):
super().__init__() super().__init__()
...@@ -151,7 +151,9 @@ class PineconeIndex(BaseIndex): ...@@ -151,7 +151,9 @@ class PineconeIndex(BaseIndex):
"User-Agent": "source_tag=semanticrouter", "User-Agent": "source_tag=semanticrouter",
} }
self.base_url = base_url or os.getenv("PINECONE_API_BASE_URL") if base_url is not None or os.getenv("PINECONE_API_BASE_URL"):
logger.info("Using pinecone remote API.")
self.base_url = base_url or os.getenv("PINECONE_API_BASE_URL")
if self.base_url and "api.pinecone.io" in self.base_url: if self.base_url and "api.pinecone.io" in self.base_url:
self.headers["X-Pinecone-API-Version"] = "2024-07" self.headers["X-Pinecone-API-Version"] = "2024-07"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment