From d557a408e826db02c54d1a4ebfae72ec38e4e9c5 Mon Sep 17 00:00:00 2001 From: serafettin Date: Fri, 7 Jun 2024 08:07:19 -0400 Subject: [PATCH] Update docs --- sdk/python/README.MD | 79 +++++++++++++++++++++++++++++++++++++++++--- sdk/python/setup.py | 2 +- 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/sdk/python/README.MD b/sdk/python/README.MD index 8f5b620e..473bb99f 100644 --- a/sdk/python/README.MD +++ b/sdk/python/README.MD @@ -10,18 +10,18 @@ # Index Network Python SDK -Index is a discovery protocol that functions as a decentralized search engine which offers an open layer for discovery. As the first decentralized semantic index which leverages Web3 and AI to eliminate the need for intermediaries for finding knowledge, products and like-minded people through direct, composable discovery across peers. -Here's a quick start guide. +Index is a discovery protocol that eliminates the need for intermediaries when finding knowledge, products, and like-minded people through direct, composable discovery across the web. By leveraging Web3 and AI, Index offers an open layer for discovery as the first decentralized semantic index. It functions as a composable vector database with a user-centric perspective, enabling interaction with decentralized graphs. + ## Using the Index Network Python SDK The Index Network offers a Python SDK to facilitate various operations on our platform. This guide will walk you through setting up the SDK, authenticating, creating an Index, and adding an Item to it and finally interacting with it. - ### Installation First, install the indexnetwork-sdk package via pip: + ``` pip install indexnetwork-sdk ``` @@ -30,7 +30,7 @@ pip install indexnetwork-sdk Creating an Instance of IndexClient ``` -from indexnetwork-sdk import IndexClient +from indexclient import IndexClient client = IndexClient( domain="index.network", @@ -95,3 +95,74 @@ The response should look something like this: ] } ``` + +### Additional Methods + +#### Get All Indexes +Retrieve all indexes associated with a DID. + +```python +indexes = client.get_all_indexes(did="your_did") +print(indexes) +``` + +#### Get Profile +Retrieve the profile associated with a DID. + +```python +profile = client.get_profile(did="your_did") +print(profile) +``` + +#### Get Index +Retrieve a specific index by its ID. +```python +index = client.get_index(index_id="your_index_id") +print(index) +``` + +#### Get Items +Retrieve items from an index with optional query parameters. +```python +items = client.get_items(index_id="your_index_id", query_params={"param1": "value1"}) +print(items) +``` + +#### Create Node +Create a new node in the composed database. +```python +node_data = { + "field1": "value1", + "field2": "value2" +} +node = client.create_node(model_id="your_model_id", node_data=node_data) +print(node) +``` + +#### Update Node +Update an existing node in the composed database. +```python +updated_data = { + "field1": "new_value1" +} +updated_node = client.update_node(model_id="your_model_id", node_id="your_node_id", node_data=updated_data) +print(updated_node) +``` + +#### Add Item +Add an item to an index. +```python +item_data = { + "field1": "value1", + "field2": "value2" +} +added_item = client.add_item(index_id="your_index_id", item=item_data) +print(added_item) +``` + +#### Remove Item +Remove an item from an index by its ID. +```python +removed_item = client.remove_item(index_id="your_index_id", item_id="your_item_id") +print(removed_item) +``` diff --git a/sdk/python/setup.py b/sdk/python/setup.py index ec892463..ae0e746c 100644 --- a/sdk/python/setup.py +++ b/sdk/python/setup.py @@ -3,7 +3,7 @@ setup( name='indexnetwork-sdk', - version='0.0.15', + version='0.0.16', description='Index Network SDK', long_description=open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.MD')).read(), long_description_content_type='text/markdown',