|
34 | 34 | index_insert_params, |
35 | 35 | index_upsert_params, |
36 | 36 | index_get_by_ids_params, |
| 37 | + index_list_vectors_params, |
37 | 38 | index_delete_by_ids_params, |
38 | 39 | ) |
39 | 40 | from ....types.vectorize.create_index import CreateIndex |
|
42 | 43 | from ....types.vectorize.index_delete_response import IndexDeleteResponse |
43 | 44 | from ....types.vectorize.index_insert_response import IndexInsertResponse |
44 | 45 | from ....types.vectorize.index_upsert_response import IndexUpsertResponse |
| 46 | +from ....types.vectorize.index_list_vectors_response import IndexListVectorsResponse |
45 | 47 | from ....types.vectorize.index_delete_by_ids_response import IndexDeleteByIDsResponse |
46 | 48 |
|
47 | 49 | __all__ = ["IndexesResource", "AsyncIndexesResource"] |
@@ -437,6 +439,61 @@ def insert( |
437 | 439 | cast_to=cast(Type[Optional[IndexInsertResponse]], ResultWrapper[IndexInsertResponse]), |
438 | 440 | ) |
439 | 441 |
|
| 442 | + def list_vectors( |
| 443 | + self, |
| 444 | + index_name: str, |
| 445 | + *, |
| 446 | + account_id: str, |
| 447 | + count: int | NotGiven = NOT_GIVEN, |
| 448 | + cursor: str | NotGiven = NOT_GIVEN, |
| 449 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 450 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 451 | + extra_headers: Headers | None = None, |
| 452 | + extra_query: Query | None = None, |
| 453 | + extra_body: Body | None = None, |
| 454 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 455 | + ) -> Optional[IndexListVectorsResponse]: |
| 456 | + """ |
| 457 | + Returns a paginated list of vector identifiers from the specified index. |
| 458 | +
|
| 459 | + Args: |
| 460 | + account_id: Identifier |
| 461 | +
|
| 462 | + count: Maximum number of vectors to return |
| 463 | +
|
| 464 | + cursor: Cursor for pagination to get the next page of results |
| 465 | +
|
| 466 | + extra_headers: Send extra headers |
| 467 | +
|
| 468 | + extra_query: Add additional query parameters to the request |
| 469 | +
|
| 470 | + extra_body: Add additional JSON properties to the request |
| 471 | +
|
| 472 | + timeout: Override the client-level default timeout for this request, in seconds |
| 473 | + """ |
| 474 | + if not account_id: |
| 475 | + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") |
| 476 | + if not index_name: |
| 477 | + raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") |
| 478 | + return self._get( |
| 479 | + f"/accounts/{account_id}/vectorize/v2/indexes/{index_name}/list", |
| 480 | + options=make_request_options( |
| 481 | + extra_headers=extra_headers, |
| 482 | + extra_query=extra_query, |
| 483 | + extra_body=extra_body, |
| 484 | + timeout=timeout, |
| 485 | + query=maybe_transform( |
| 486 | + { |
| 487 | + "count": count, |
| 488 | + "cursor": cursor, |
| 489 | + }, |
| 490 | + index_list_vectors_params.IndexListVectorsParams, |
| 491 | + ), |
| 492 | + post_parser=ResultWrapper[Optional[IndexListVectorsResponse]]._unwrapper, |
| 493 | + ), |
| 494 | + cast_to=cast(Type[Optional[IndexListVectorsResponse]], ResultWrapper[IndexListVectorsResponse]), |
| 495 | + ) |
| 496 | + |
440 | 497 | def query( |
441 | 498 | self, |
442 | 499 | index_name: str, |
@@ -949,6 +1006,61 @@ async def insert( |
949 | 1006 | cast_to=cast(Type[Optional[IndexInsertResponse]], ResultWrapper[IndexInsertResponse]), |
950 | 1007 | ) |
951 | 1008 |
|
| 1009 | + async def list_vectors( |
| 1010 | + self, |
| 1011 | + index_name: str, |
| 1012 | + *, |
| 1013 | + account_id: str, |
| 1014 | + count: int | NotGiven = NOT_GIVEN, |
| 1015 | + cursor: str | NotGiven = NOT_GIVEN, |
| 1016 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 1017 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 1018 | + extra_headers: Headers | None = None, |
| 1019 | + extra_query: Query | None = None, |
| 1020 | + extra_body: Body | None = None, |
| 1021 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 1022 | + ) -> Optional[IndexListVectorsResponse]: |
| 1023 | + """ |
| 1024 | + Returns a paginated list of vector identifiers from the specified index. |
| 1025 | +
|
| 1026 | + Args: |
| 1027 | + account_id: Identifier |
| 1028 | +
|
| 1029 | + count: Maximum number of vectors to return |
| 1030 | +
|
| 1031 | + cursor: Cursor for pagination to get the next page of results |
| 1032 | +
|
| 1033 | + extra_headers: Send extra headers |
| 1034 | +
|
| 1035 | + extra_query: Add additional query parameters to the request |
| 1036 | +
|
| 1037 | + extra_body: Add additional JSON properties to the request |
| 1038 | +
|
| 1039 | + timeout: Override the client-level default timeout for this request, in seconds |
| 1040 | + """ |
| 1041 | + if not account_id: |
| 1042 | + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") |
| 1043 | + if not index_name: |
| 1044 | + raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") |
| 1045 | + return await self._get( |
| 1046 | + f"/accounts/{account_id}/vectorize/v2/indexes/{index_name}/list", |
| 1047 | + options=make_request_options( |
| 1048 | + extra_headers=extra_headers, |
| 1049 | + extra_query=extra_query, |
| 1050 | + extra_body=extra_body, |
| 1051 | + timeout=timeout, |
| 1052 | + query=await async_maybe_transform( |
| 1053 | + { |
| 1054 | + "count": count, |
| 1055 | + "cursor": cursor, |
| 1056 | + }, |
| 1057 | + index_list_vectors_params.IndexListVectorsParams, |
| 1058 | + ), |
| 1059 | + post_parser=ResultWrapper[Optional[IndexListVectorsResponse]]._unwrapper, |
| 1060 | + ), |
| 1061 | + cast_to=cast(Type[Optional[IndexListVectorsResponse]], ResultWrapper[IndexListVectorsResponse]), |
| 1062 | + ) |
| 1063 | + |
952 | 1064 | async def query( |
953 | 1065 | self, |
954 | 1066 | index_name: str, |
@@ -1099,6 +1211,9 @@ def __init__(self, indexes: IndexesResource) -> None: |
1099 | 1211 | self.insert = to_raw_response_wrapper( |
1100 | 1212 | indexes.insert, |
1101 | 1213 | ) |
| 1214 | + self.list_vectors = to_raw_response_wrapper( |
| 1215 | + indexes.list_vectors, |
| 1216 | + ) |
1102 | 1217 | self.query = to_raw_response_wrapper( |
1103 | 1218 | indexes.query, |
1104 | 1219 | ) |
@@ -1139,6 +1254,9 @@ def __init__(self, indexes: AsyncIndexesResource) -> None: |
1139 | 1254 | self.insert = async_to_raw_response_wrapper( |
1140 | 1255 | indexes.insert, |
1141 | 1256 | ) |
| 1257 | + self.list_vectors = async_to_raw_response_wrapper( |
| 1258 | + indexes.list_vectors, |
| 1259 | + ) |
1142 | 1260 | self.query = async_to_raw_response_wrapper( |
1143 | 1261 | indexes.query, |
1144 | 1262 | ) |
@@ -1179,6 +1297,9 @@ def __init__(self, indexes: IndexesResource) -> None: |
1179 | 1297 | self.insert = to_streamed_response_wrapper( |
1180 | 1298 | indexes.insert, |
1181 | 1299 | ) |
| 1300 | + self.list_vectors = to_streamed_response_wrapper( |
| 1301 | + indexes.list_vectors, |
| 1302 | + ) |
1182 | 1303 | self.query = to_streamed_response_wrapper( |
1183 | 1304 | indexes.query, |
1184 | 1305 | ) |
@@ -1219,6 +1340,9 @@ def __init__(self, indexes: AsyncIndexesResource) -> None: |
1219 | 1340 | self.insert = async_to_streamed_response_wrapper( |
1220 | 1341 | indexes.insert, |
1221 | 1342 | ) |
| 1343 | + self.list_vectors = async_to_streamed_response_wrapper( |
| 1344 | + indexes.list_vectors, |
| 1345 | + ) |
1222 | 1346 | self.query = async_to_streamed_response_wrapper( |
1223 | 1347 | indexes.query, |
1224 | 1348 | ) |
|
0 commit comments