|
16 | 16 | if TYPE_CHECKING: |
17 | 17 | from pinecone.config import Config, OpenApiConfiguration |
18 | 18 | from pinecone.db_data import _Index as Index, _IndexAsyncio as IndexAsyncio |
| 19 | + from pinecone.repository.data import _Repository as Repository |
19 | 20 | from pinecone.db_control.index_host_store import IndexHostStore |
20 | 21 | from pinecone.core.openapi.db_control.api.manage_indexes_api import ManageIndexesApi |
21 | 22 | from pinecone.db_control.types import CreateIndexForModelEmbedTypedDict, ConfigureIndexEmbed |
@@ -518,6 +519,35 @@ def IndexAsyncio(self, host: str, **kwargs) -> "IndexAsyncio": |
518 | 519 | **kwargs, |
519 | 520 | ) |
520 | 521 |
|
| 522 | + def Repository(self, name: str = "", host: str = "", **kwargs) -> "Repository": |
| 523 | + from pinecone.repository.data import _Repository |
| 524 | + |
| 525 | + if name == "" and host == "": |
| 526 | + raise ValueError("Either name or host must be specified") |
| 527 | + |
| 528 | + pt = kwargs.pop("pool_threads", None) or self._pool_threads |
| 529 | + api_key = self._config.api_key |
| 530 | + openapi_config = self._openapi_config |
| 531 | + |
| 532 | + if host != "": |
| 533 | + check_realistic_host(host) |
| 534 | + |
| 535 | + # Use host url if it is provided |
| 536 | + repository_host = normalize_host(host) |
| 537 | + else: |
| 538 | + # TODO, get host url from describe_kb using the index name |
| 539 | + # index_host = self.db.index._get_host(name) |
| 540 | + raise ValueError("host lookup not yet supported, specify host parameter") |
| 541 | + |
| 542 | + return _Repository( |
| 543 | + host=repository_host, |
| 544 | + api_key=api_key, |
| 545 | + pool_threads=pt, |
| 546 | + openapi_config=openapi_config, |
| 547 | + source_tag=self.config.source_tag, |
| 548 | + **kwargs, |
| 549 | + ) |
| 550 | + |
521 | 551 |
|
522 | 552 | def check_realistic_host(host: str) -> None: |
523 | 553 | """:meta private: |
|
0 commit comments