Skip to content

Commit c8c086f

Browse files
committed
comments
1 parent 90f0515 commit c8c086f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

nucleus/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,15 @@ def delete_model(self, model_id: str) -> dict:
11051105
def create_custom_index(
11061106
self, dataset_id: str, embeddings_urls: list, embedding_dim: int
11071107
):
1108+
"""
1109+
Creates a custom index for a given dataset, which will then be used
1110+
for autotag and similarity search.
1111+
1112+
:param
1113+
dataset_id: id of dataset that the custom index is being added to.
1114+
embeddings_urls: list of urls, each of which being a json mapping dataset_item_id -> embedding vector
1115+
embedding_dim: the dimension of the embedding vectors, must be consistent for all embedding vectors in the index.
1116+
"""
11081117
return self.make_request(
11091118
{
11101119
EMBEDDINGS_URL_KEY: embeddings_urls,

tests/test_indexing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def dataset(CLIENT):
3939

4040
def test_index_integration(dataset):
4141
signed_embeddings_url = TEST_INDEX_EMBEDDINGS_FILE
42-
create_response = dataset.create_custom_index([signed_embeddings_url])
42+
create_response = dataset.create_custom_index(
43+
[signed_embeddings_url], embedding_dim=3
44+
)
4345
assert JOB_ID_KEY in create_response
4446
assert MESSAGE_KEY in create_response
4547
job_id = create_response[JOB_ID_KEY]

0 commit comments

Comments
 (0)