|
28 | 28 | from .schema import (VectoIngestData, VectoEmbeddingData, VectoAttribute, VectoAnalogyStartEnd, |
29 | 29 | IngestResponse, LookupResult, VectoModel, VectoVectorSpace, VectoUser, |
30 | 30 | VectoToken, VectoNewTokenResponse, MODEL_MAP, VectoAnalogy, |
31 | | - DailyUsageMetric, UsageMetric, VectoUsageMetrics, MonthlyUsageResponse) |
| 31 | + DailyUsageMetric, UsageMetric, VectoUsageMetrics, MonthlyUsageResponse, |
| 32 | + DataEntry, DataPage) |
32 | 33 |
|
33 | 34 | from .client import Client |
34 | 35 | import vecto |
@@ -919,6 +920,44 @@ def delete_analogy(self, vector_space_id:int, **kwargs): |
919 | 920 | url = f"/api/v0/account/space/{vector_space_id}/analogy" |
920 | 921 | self._client.delete(url, **kwargs) |
921 | 922 |
|
| 923 | + def list_vector_space_data(self, vector_space_id: int, limit: int = None, offset: int = None, **kwargs): |
| 924 | + ''' |
| 925 | + List the attributes of all entries in the given vector space. |
| 926 | +
|
| 927 | + Args: |
| 928 | + vector_space_id (int): The ID of the vector space. |
| 929 | + limit (int, optional): The maximum number of entries to return. If not specified, it will be set to 0. |
| 930 | + offset (int, optional): The offset from the start of the list to begin returning entries. |
| 931 | + **kwargs: Other keyword arguments for clients other than `requests` |
| 932 | +
|
| 933 | + Returns: |
| 934 | + DataPage: A DataPage instance containing the list of entries and their attributes. |
| 935 | + ''' |
| 936 | + |
| 937 | + url = f"/api/v0/space/{vector_space_id}/data" |
| 938 | + params = {'limit': limit, 'offset': offset} |
| 939 | + response = self._client.get(url, params=params, **kwargs) |
| 940 | + response_json = response.json() |
| 941 | + |
| 942 | + # Create DataEntry instances for each element in the response |
| 943 | + data_entries = [DataEntry(**entry) for entry in response_json["elements"]] |
| 944 | + |
| 945 | + # Create and return the DataPage instance |
| 946 | + return DataPage(count=response_json["count"], elements=data_entries) |
| 947 | + |
| 948 | + def delete_vector_space_entry(self, vector_space_id: int, entry_id: int, **kwargs): |
| 949 | + ''' |
| 950 | + Delete an entry in a vector space. |
| 951 | +
|
| 952 | + Args: |
| 953 | + vector_space_id (int): The ID of the vector space. |
| 954 | + entry_id (int): The ID of the entry to be deleted. |
| 955 | + **kwargs: Other keyword arguments for clients other than `requests` |
| 956 | + ''' |
| 957 | + |
| 958 | + url = f"/api/v0/space/{vector_space_id}/data/{entry_id}" |
| 959 | + self._client.delete(url, **kwargs) |
| 960 | + |
922 | 961 | ############### |
923 | 962 | # Metrics API # |
924 | 963 | ############### |
|
0 commit comments