Repository navigation
Add pdoc integration in GitHub workflows #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cc70c87
1675252
113f91b
3ab1036
b7f62a0
2d45cf2
0e8d4ba
97213a6
7bba15b
5b25ccd
c187c35
31eceaf
b5fb228
f726288
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: 'Build client documentation' | ||
| description: 'Generates client documentation using pdoc' | ||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.x | ||
|
|
||
| - name: Setup Poetry | ||
| uses: ./.github/actions/setup-poetry | ||
|
|
||
| - name: Build html documentation | ||
| shell: bash | ||
| run: | | ||
| poetry run pdoc pinecone/ --favicon ./favicon-32x32.png --docformat google -o ./docs |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: 'Merge to main' | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: {} | ||
|
|
||
| jobs: | ||
| build-and-deploy-documentation: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Generate pdoc documentation | ||
| uses: ./.github/actions/build-docs | ||
|
|
||
| - name: Deploy documentation to gh-pages | ||
| uses: s0/git-publish-subdir-action@develop | ||
| env: | ||
| REPO: self | ||
| BRANCH: gh-pages | ||
| FOLDER: docs | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,21 @@ | ||
| name: Pull-request CI | ||
| name: Pull Request | ||
|
|
||
| on: pull_request | ||
| on: | ||
| pull_request: {} | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: {} | ||
|
|
||
| jobs: | ||
| run-tests: | ||
| uses: './.github/workflows/testing.yaml' | ||
| uses: './.github/workflows/testing.yaml' | ||
|
|
||
| build-docs: | ||
| name: Build docs with pdoc | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| - name: Build docs with pdoc | ||
| uses: './.github/actions/build-docs' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| include LICENSE.txt requirements.txt requirements-grpc.txt pinecone/__version__ pinecone/__environment__ | ||
| include LICENSE.txt pinecone/__version__ pinecone/__environment__ | ||
| recursive-exclude tests * | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| """ | ||
| .. include:: ../README.md | ||
| """ | ||
| from pinecone.core.utils.constants import CLIENT_VERSION as __version__ | ||
| from .config import * | ||
| from .exceptions import * | ||
|
|
@@ -12,7 +15,12 @@ | |
|
|
||
| # Kept for backwards-compatibility | ||
| UpsertResult = None | ||
| """@private""" | ||
| DeleteResult = None | ||
| """@private""" | ||
| QueryResult = None | ||
| """@private""" | ||
| FetchResult = None | ||
| """@private""" | ||
| InfoResult = None | ||
| """@private""" | ||
|
Comment on lines
+18
to
+26
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These were showing up in the generated docs on the very top level page under the README. We could include them and/or comment them, but I hid them for now.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hiding seems good. There's nothing interesting to say about a bunch of |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,61 +108,50 @@ def upsert( | |
| namespace: Optional[str] = None, | ||
| batch_size: Optional[int] = None, | ||
| show_progress: bool = True, | ||
| **kwargs | ||
| **kwargs, | ||
| ) -> UpsertResponse: | ||
| """ | ||
| The upsert operation writes vectors into a namespace. | ||
| If a new value is upserted for an existing vector id, it will overwrite the previous value. | ||
|
|
||
| API reference: https://docs.pinecone.io/reference/upsert | ||
|
|
||
| To upsert in parallel follow: https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel | ||
|
|
||
| A vector can be represented by a 1) Vector object, a 2) tuple or 3) a dictionary | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was lots of formatting jank in here, did a brief pass for now.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can handle it in a follow-up PR because I'm sure there are a lot of other places where this comes up, but in general we want to migrate most "vector" references to "record" to align with the docs here. |
||
|
|
||
| If a tuple is used, it must be of the form `(id, values, metadata)` or `(id, values)`. | ||
| where id is a string, vector is a list of floats, metadata is a dict, | ||
| and sparse_values is a dict of the form `{'indices': List[int], 'values': List[float]}`. | ||
|
|
||
| Examples: | ||
| >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}, {'indices': [1, 2], 'values': [0.2, 0.4]}) | ||
| >>> ('id1', [1.0, 2.0, 3.0], None, {'indices': [1, 2], 'values': [0.2, 0.4]}) | ||
| >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0]) | ||
|
|
||
| If a Vector object is used, a Vector object must be of the form | ||
| `Vector(id, values, metadata, sparse_values)`, where metadata and sparse_values are optional | ||
| arguments. | ||
|
|
||
| Examples: | ||
| >>> index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), | ||
| ('id2', [1.0, 2.0, 3.0]), | ||
| ]) | ||
| >>> Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}) | ||
| >>> Vector(id='id2', values=[1.0, 2.0, 3.0]) | ||
| >>> Vector(id='id3', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4])) | ||
|
|
||
| **Note:** the dimension of each vector must match the dimension of the index. | ||
|
|
||
| If a dictionary is used, it must be in the form `{'id': str, 'values': List[float], 'sparse_values': {'indices': List[int], 'values': List[float]}, 'metadata': dict}` | ||
|
|
||
| Examples: | ||
| >>> index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])]) | ||
| >>> | ||
| >>> index.upsert([{'id': 'id1', 'values': [1.0, 2.0, 3.0], 'metadata': {'key': 'value'}}, | ||
| {'id': 'id2', | ||
| 'values': [1.0, 2.0, 3.0], | ||
| 'sprase_values': {'indices': [1, 8], 'values': [0.2, 0.4]}, | ||
| ]) | ||
| >>> index.upsert([Vector(id='id1', | ||
| values=[1.0, 2.0, 3.0], | ||
| metadata={'key': 'value'}), | ||
| Vector(id='id2', | ||
| values=[1.0, 2.0, 3.0], | ||
| sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))]) | ||
| >>> {'id': 'id2', 'values': [1.0, 2.0, 3.0], 'sparse_values': {'indices': [1, 8], 'values': [0.2, 0.4]}]) | ||
| >>> index.upsert([Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}), | ||
| >>> Vector(id='id2', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))]) | ||
|
|
||
| API reference: https://docs.pinecone.io/reference/upsert | ||
|
|
||
| Args: | ||
| vectors (Union[List[Vector], List[Tuple]]): A list of vectors to upsert. | ||
|
|
||
| A vector can be represented by a 1) Vector object, a 2) tuple or 3) a dictionary | ||
| 1) if a tuple is used, it must be of the form (id, values, metadata) or (id, values). | ||
| where id is a string, vector is a list of floats, metadata is a dict, | ||
| and sparse_values is a dict of the form {'indices': List[int], 'values': List[float]}. | ||
| Examples: ('id1', [1.0, 2.0, 3.0], {'key': 'value'}, {'indices': [1, 2], 'values': [0.2, 0.4]}), | ||
| ('id1', [1.0, 2.0, 3.0], None, {'indices': [1, 2], 'values': [0.2, 0.4]}) | ||
| ('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0]), | ||
|
|
||
| 2) if a Vector object is used, a Vector object must be of the form | ||
| Vector(id, values, metadata, sparse_values), | ||
| where metadata and sparse_values are optional arguments | ||
| Examples: Vector(id='id1', | ||
| values=[1.0, 2.0, 3.0], | ||
| metadata={'key': 'value'}) | ||
| Vector(id='id2', | ||
| values=[1.0, 2.0, 3.0]) | ||
| Vector(id='id3', | ||
| values=[1.0, 2.0, 3.0], | ||
| sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4])) | ||
|
|
||
| Note: the dimension of each vector must match the dimension of the index. | ||
|
|
||
| 3) if a dictionary is used, it must be in the form | ||
| {'id': str, 'values': List[float], 'sparse_values': {'indices': List[int], 'values': List[float]}, | ||
| 'metadata': dict} | ||
|
|
||
| namespace (str): The namespace to write to. If not specified, the default namespace is used. [optional] | ||
| batch_size (int): The number of vectors to upsert in each batch. | ||
| If not specified, all vectors will be upserted in a single batch. [optional] | ||
|
|
@@ -279,9 +268,9 @@ def _vector_transform(item: Union[Vector, Tuple]): | |
| vectors=list(map(_vector_transform, vectors)), | ||
| **args_dict, | ||
| _check_type=_check_type, | ||
| **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS} | ||
| **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, | ||
| ), | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS} | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, | ||
| ) | ||
|
|
||
| @staticmethod | ||
|
|
@@ -331,36 +320,36 @@ def delete( | |
| delete_all: Optional[bool] = None, | ||
| namespace: Optional[str] = None, | ||
| filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, | ||
| **kwargs | ||
| **kwargs, | ||
| ) -> Dict[str, Any]: | ||
| """ | ||
| The Delete operation deletes vectors from the index, from a single namespace. | ||
| No error raised if the vector id does not exist. | ||
| Note: for any delete call, if namespace is not specified, the default namespace is used. | ||
|
|
||
| Delete can occur in the following mutual exclusive ways: | ||
| 1. Delete by ids from a single namespace | ||
| 2. Delete all vectors from a single namespace by setting delete_all to True | ||
| 3. Delete all vectors from a single namespace by specifying a metadata filter | ||
| (note that for this option delete all must be set to False) | ||
|
|
||
| API reference: https://docs.pinecone.io/reference/delete_post | ||
|
|
||
| Examples: | ||
| >>> index.delete(ids=['id1', 'id2'], namespace='my_namespace') | ||
| >>> index.delete(delete_all=True, namespace='my_namespace') | ||
| >>> index.delete(filter={'key': 'value'}, namespace='my_namespace') | ||
|
|
||
| Args: | ||
| ids (List[str]): Vector ids to delete [optional] | ||
| delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] | ||
| Default is False. | ||
| namespace (str): The namespace to delete vectors from [optional] | ||
| If not specified, the default namespace is used. | ||
| filter (Dict[str, Union[str, float, int, bool, List, dict]]): | ||
| If specified, the metadata filter here will be used to select the vectors to delete. | ||
| This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. | ||
| See https://www.pinecone.io/docs/metadata-filtering/.. [optional] | ||
| The Delete operation deletes vectors from the index, from a single namespace. | ||
| No error raised if the vector id does not exist. | ||
| Note: for any delete call, if namespace is not specified, the default namespace is used. | ||
|
|
||
| Delete can occur in the following mutual exclusive ways: | ||
| 1. Delete by ids from a single namespace | ||
| 2. Delete all vectors from a single namespace by setting delete_all to True | ||
| 3. Delete all vectors from a single namespace by specifying a metadata filter | ||
| (note that for this option delete all must be set to False) | ||
|
|
||
| API reference: https://docs.pinecone.io/reference/delete_post | ||
|
|
||
| Examples: | ||
| >>> index.delete(ids=['id1', 'id2'], namespace='my_namespace') | ||
| >>> index.delete(delete_all=True, namespace='my_namespace') | ||
| >>> index.delete(filter={'key': 'value'}, namespace='my_namespace') | ||
|
|
||
| Args: | ||
| ids (List[str]): Vector ids to delete [optional] | ||
| delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] | ||
| Default is False. | ||
| namespace (str): The namespace to delete vectors from [optional] | ||
| If not specified, the default namespace is used. | ||
| filter (Dict[str, Union[str, float, int, bool, List, dict]]): | ||
| If specified, the metadata filter here will be used to select the vectors to delete. | ||
| This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. | ||
| See https://www.pinecone.io/docs/metadata-filtering/.. [optional] | ||
|
|
||
| Keyword Args: | ||
| Supports OpenAPI client keyword arguments. See pinecone.core.client.models.DeleteRequest for more details. | ||
|
|
@@ -377,9 +366,9 @@ def delete( | |
| DeleteRequest( | ||
| **args_dict, | ||
| **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS and v is not None}, | ||
| _check_type=_check_type | ||
| _check_type=_check_type, | ||
| ), | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS} | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, | ||
| ) | ||
|
|
||
| @validate_and_convert_errors | ||
|
|
@@ -419,7 +408,7 @@ def query( | |
| include_values: Optional[bool] = None, | ||
| include_metadata: Optional[bool] = None, | ||
| sparse_vector: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] = None, | ||
| **kwargs | ||
| **kwargs, | ||
| ) -> QueryResponse: | ||
| """ | ||
| The Query operation searches a namespace, using a query vector. | ||
|
|
@@ -501,9 +490,9 @@ def _query_transform(item): | |
| QueryRequest( | ||
| **args_dict, | ||
| _check_type=_check_type, | ||
| **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS} | ||
| **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, | ||
| ), | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS} | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, | ||
| ) | ||
| return parse_query_response(response, vector is not None or id) | ||
|
|
||
|
|
@@ -515,7 +504,7 @@ def update( | |
| set_metadata: Optional[Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]]] = None, | ||
| namespace: Optional[str] = None, | ||
| sparse_values: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] = None, | ||
| **kwargs | ||
| **kwargs, | ||
| ) -> Dict[str, Any]: | ||
| """ | ||
| The Update operation updates vector in a namespace. | ||
|
|
@@ -563,9 +552,9 @@ def update( | |
| id=id, | ||
| **args_dict, | ||
| _check_type=_check_type, | ||
| **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS} | ||
| **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, | ||
| ), | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS} | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, | ||
| ) | ||
|
|
||
| @validate_and_convert_errors | ||
|
|
@@ -596,9 +585,9 @@ def describe_index_stats( | |
| DescribeIndexStatsRequest( | ||
| **args_dict, | ||
| **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, | ||
| _check_type=_check_type | ||
| _check_type=_check_type, | ||
| ), | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS} | ||
| **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, | ||
| ) | ||
|
|
||
| @staticmethod | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requirements files were removed in the poetry migration, I don't think they're needed in the manifest any longer. Let me know if that's incorrect though.