diff --git a/Makefile b/Makefile index 64873094c..670ed3fe2 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,6 @@ tests: # skipping flake8 for now pip3 install --upgrade --quiet tox && TOX_SKIP_ENV='flake|docs' tox -docs: - echo skipping temporarily... - # pip3 install --upgrade --quiet tox && tox -e docs - version: python3 setup.py --version @@ -44,8 +40,3 @@ set-production: set-development: echo "" > pinecone/__environment__ - -gen-openapi: - docker run --rm -v "${mkfile_path}:/local" openapitools/openapi-generator-cli:v5.2.0 generate --input-spec /local/specs/pinecone_api.json --config /local/codegen-src/openapi-generator-args.python.json --generator-name python --template-dir /local/codegen-src/templates --output /local/openapi-gen - cp -r ${mkfile_path}/openapi-gen/pinecone/core/client/ ${mkfile_path}/pinecone/core/client/ - rm -r ${mkfile_path}/openapi-gen diff --git a/codegen-src/gen_python_postprocess.sh b/codegen-src/gen_python_postprocess.sh deleted file mode 100644 index f1f641af1..000000000 --- a/codegen-src/gen_python_postprocess.sh +++ /dev/null @@ -1 +0,0 @@ -#!/usr/bin/env bash diff --git a/codegen-src/openapi-generator-args.python.json b/codegen-src/openapi-generator-args.python.json deleted file mode 100644 index 989497e69..000000000 --- a/codegen-src/openapi-generator-args.python.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "packageName": "pinecone.core.client", - "pythonAttrNoneIfUnset": true -} \ No newline at end of file diff --git a/codegen-src/templates/exceptions.mustache b/codegen-src/templates/exceptions.mustache deleted file mode 100644 index a78262324..000000000 --- a/codegen-src/templates/exceptions.mustache +++ /dev/null @@ -1,153 +0,0 @@ -{{>partial_header}} - -from pinecone.core.exceptions import PineconeException - - -class OpenApiException(PineconeException): - """The base exception class for all OpenAPIExceptions""" - - -class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None): - """ Raises an exception for TypeErrors - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list): a list of keys an indices to get to the - current_item - None if unset - valid_classes (tuple): the primitive classes that current item - should be an instance of - None if unset - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a list - None if unset - """ - self.path_to_item = path_to_item - self.valid_classes = valid_classes - self.key_type = key_type - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiTypeError, self).__init__(full_msg) - - -class ApiValueError(OpenApiException, ValueError): - def __init__(self, msg, path_to_item=None): - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list) the path to the exception in the - received_data dict. None if unset - """ - - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiValueError, self).__init__(full_msg) - - -class ApiAttributeError(OpenApiException, AttributeError): - def __init__(self, msg, path_to_item=None): - """ - Raised when an attribute reference or assignment fails. - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiAttributeError, self).__init__(full_msg) - - -class ApiKeyError(OpenApiException, KeyError): - def __init__(self, msg, path_to_item=None): - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiKeyError, self).__init__(full_msg) - - -class ApiException(OpenApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data - self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None - - def __str__(self): - """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) - if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) - - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) - - return error_message - - -class NotFoundException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(NotFoundException, self).__init__(status, reason, http_resp) - - -class UnauthorizedException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(UnauthorizedException, self).__init__(status, reason, http_resp) - - -class ForbiddenException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(ForbiddenException, self).__init__(status, reason, http_resp) - - -class ServiceException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(ServiceException, self).__init__(status, reason, http_resp) - - -def render_path(path_to_item): - """Returns a string representation of a path""" - result = "" - for pth in path_to_item: - if isinstance(pth, int): - result += "[{0}]".format(pth) - else: - result += "['{0}']".format(pth) - return result diff --git a/docs/_static/.gitkeep b/docs/_static/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/_static/img/favicon-32x32.png b/docs/_static/img/favicon-32x32.png deleted file mode 100644 index 808ac94ca..000000000 Binary files a/docs/_static/img/favicon-32x32.png and /dev/null differ diff --git a/docs/_static/img/figure_graph.svg b/docs/_static/img/figure_graph.svg deleted file mode 100644 index dc6f375cc..000000000 --- a/docs/_static/img/figure_graph.svg +++ /dev/null @@ -1,1811 +0,0 @@ - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - agg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/_static/img/figure_service.svg b/docs/_static/img/figure_service.svg deleted file mode 100644 index e6881e8fc..000000000 --- a/docs/_static/img/figure_service.svg +++ /dev/null @@ -1,3188 +0,0 @@ - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/_static/img/multivar.png b/docs/_static/img/multivar.png deleted file mode 100644 index d6f5f8fc0..000000000 Binary files a/docs/_static/img/multivar.png and /dev/null differ diff --git a/docs/_static/img/pinecone-logo.png b/docs/_static/img/pinecone-logo.png deleted file mode 100644 index a3bc4a84f..000000000 Binary files a/docs/_static/img/pinecone-logo.png and /dev/null differ diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html deleted file mode 100644 index 3d9f0545d..000000000 --- a/docs/_templates/layout.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends "!layout.html" %} - - -{%- block extrahead %} -{{ super() }} - - - - - - - - -{% endblock %} diff --git a/docs/api/controller.rst.exclude b/docs/api/controller.rst.exclude deleted file mode 100644 index 3857ea019..000000000 --- a/docs/api/controller.rst.exclude +++ /dev/null @@ -1,372 +0,0 @@ -Controller API -====================== - - - -Service -````````````````````` - -.. http:post:: /services - - Create a new service. - - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 503: user authenticated but action not allowed - - .. http:example:: curl wget python-requests - - POST /services HTTP/1.1 - Host: controller.beta.pinecone.io - Accept: application/json - Content-Type: application/json - Api-Key: XXXX-XXXX-XXXX-XXXX - - { - "service": { - "version": "pinecone/v1alpha1", - "kind": "Service", - "metadata": { - "name": "movie-recommender-service" - }, - "spec": { - "functions": [ - { - "name": "engine", - "class": "pinecone.functions.engine.namespaced.NamespacedEngine", - "args": [ - "--config", - "{\"metric\":\"cosine\",\"engine_type\":\"approximated\"}", - "--replicas", - "1", - "--shards", - "1", - "--name", - "engine" - ] - }, - { - "name": "aggregator", - "class": "pinecone.functions.ranker.aggregator.Aggregator", - "args": [ - "--config", - "{\"num_shards\":1}", - "--replicas", - "1", - "--shards", - "1", - "--name", - "aggregator" - ] - } - ], - "paths": [ - { - "name": "read", - "steps": [ - "engine", - "aggregator" - ] - }, - { - "name": "write", - "steps": [ - "engine", - "aggregator" - ] - } - ] - } - } - } - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "success": true - } - - -.. http:get:: /services - - List a user's services. - - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 503: user authenticated but action not allowed - - .. http:example:: curl wget python-requests - - GET /services HTTP/1.1 - Host: controller.beta.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - [ - "movie-recommender-service-1", - "movie-recommender-service-2" - ] - - - -.. http:get:: /services/(service_name) - - Get the configuration of a service. - - :param service_name: name of the service - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 404: resource not found - :statuscode 503: user authenticated but action not allowed - - .. http:example:: curl wget python-requests - - GET /services/(service_name) HTTP/1.1 - Host: controller.beta.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "version": "pinecone/v1alpha1", - "kind": "Service", - "metadata": { - "name": "movie-recommender-service" - }, - "spec": { - "functions": [ - { - "name": "engine", - "class": "pinecone.functions.engine.namespaced.NamespacedEngine", - "args": [ - "--config", - "{\"metric\":\"cosine\",\"engine_type\":\"approximated\"}", - "--replicas", - "1", - "--shards", - "1", - "--name", - "engine" - ] - }, - { - "name": "aggregator", - "class": "pinecone.functions.ranker.aggregator.Aggregator", - "args": [ - "--config", - "{\"num_shards\":1}", - "--replicas", - "1", - "--shards", - "1", - "--name", - "aggregator" - ] - } - ], - "paths": [ - { - "name": "read", - "steps": [ - "engine", - "aggregator" - ] - }, - { - "name": "write", - "steps": [ - "engine", - "aggregator" - ] - } - ] - } - } - - -.. http:delete:: /services/(service_name) - - Delete a service. - - :param service_name: name of the service - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 404: service not found - :statuscode 503: user authenticated but action not allowed - - .. http:example:: curl wget python-requests - - DELETE /services/(service_name) HTTP/1.1 - Host: controller.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "success": true - } - - -.. http:get:: /services/(service_name)/status - - Get the status of a service. - - :param service_name: name of the service - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 404: resource not found - :statuscode 503: user authenticated but action not allowed - - .. http:example:: curl wget python-requests - - GET /services/(service_name)/status HTTP/1.1 - Host: controller.beta.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "ready": false, - "waiting": ["engine-0", "transformer-0"], - "crashed": [], - "host": null, - "port": null - } - - - -Router -````````````````````` - -The APIs for traffic routers work in the same way as -the APIs for services. You only need to replace -:code:`/services` with :code:`/routers` -and :code:`service_name` with :code:`router_name`. - -.. http:post:: /routers - - Create a new traffic router or update an existing traffic router. - Note that JSON data structure for traffic routers requests differs from that of services'. - Also see :http:post:`/services` for more details. - - .. http:example:: curl wget python-requests - - POST /routers HTTP/1.1 - Host: controller.beta.pinecone.io - Accept: application/json - Content-Type: application/json - Api-Key: XXXX-XXXX-XXXX-XXXX - - { - "router": { - "version": "pinecone/v1alpha1", - "kind": "TrafficRouter", - "metadata": { - "name": "movie-recommender-router" - }, - "spec": { - "active": "movie-recommender-service-v1", - "services": [ - "movie-recommender-service-v1", - "movie-recommender-service-v2" - ] - } - } - } - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "success": true - } - -.. http:get:: /routers - - List a user's routers. - See :http:get:`/services` for details. - -.. http:get:: /routers/(router_name) - - Get the configuration of a router. - See :http:get:`/services/(service_name)` for details. - -.. http:delete:: /routers/(router_name) - - Delete a router. - See :http:delete:`/services/(service_name)` for details. - -.. http:get:: /routers/(router_name)/status - - Get the status of a router. - See :http:get:`/services/(service_name)/status` for details. - - - -Action -````````````````````` - -.. http:get:: /actions/whoami - - Get user information. - - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 503: user authenticated but action not allowed - - .. http:example:: curl wget python-requests - - GET /actions/whoami HTTP/1.1 - Host: controller.beta.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "user_label": "user_label", - "user_name": "user_name", - "project_name": "user_name" - } - -.. http:get:: /actions/version - - Get the Pinecone controller version. - - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 503: user authenticated but action not allowed - - .. http:example:: curl wget python-requests - - GET /actions/version HTTP/1.1 - Host: controller.beta.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "version": "version" - } \ No newline at end of file diff --git a/docs/api/hub.rst.exclude b/docs/api/hub.rst.exclude deleted file mode 100644 index 601feed03..000000000 --- a/docs/api/hub.rst.exclude +++ /dev/null @@ -1,134 +0,0 @@ -Model Hub API -````````````````````` - -.. http:post:: /login - - Return temporary credential for logging into Pinecone Model Hub. - - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 503: user authenticated but action not allowed - - .. http:example:: curl wget python-requests - - POST /login HTTP/1.1 - Host: hub-api.beta.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "username": "HUB_USERNAME", - "password": "HUB_PASSWORD", - "server": "SERVER_URL" - } - - -.. http:get:: /repositories - - List a user's unarchived repositories. - - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 503: user authenticated but action not allowed - - .. http:example:: curl wget python-requests - - GET /repositories HTTP/1.1 - Host: hub-api.beta.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - [ - "movie-embedding-model", - "user-embedding-model" - ] - - - -.. http:post:: /repositories - - Create or unarchive a repository. - Update the repository if it already exists. - - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 400: bad request (e.g. invalid repository name) - :statuscode 401: user not authenticated - :statuscode 503: user authenticated but action not allowed - -.. http:example:: curl wget python-requests - - POST /repositories HTTP/1.1 - Host: hub-api.beta.pinecone.io - Accept: application/json - Content-Type: application/json - Api-Key: XXXX-XXXX-XXXX-XXXX - - { - "repository_name": "REPOSITORY_NAME" - } - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "success": true - } - - - -.. http:delete:: /repositories/(repository_name) - - Archive a repository. - - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 401: user not authenticated - :statuscode 404: repository not found - :statuscode 503: user authenticated but action not allowed - -.. http:example:: curl wget python-requests - - DELETE /repositories/(repository_name) HTTP/1.1 - Host: hub-api.beta.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "success": true - } - - -.. http:get:: /repositories/(repository_name)/tags - - List tags of a repository. - - :reqheader Api-Key: for user authentication - :statuscode 200: no error - :statuscode 404: repository not found - :statuscode 401: user not authenticated - :statuscode 503: user authenticated but action not allowed - -.. http:example:: curl wget python-requests - - GET /repositories/(repository_name)/tags HTTP/1.1 - Host: hub-api.beta.pinecone.io - Api-Key: XXXX-XXXX-XXXX-XXXX - - - HTTP/1.1 200 OK - Content-Type: application/json - - ["V1", "V2"] diff --git a/docs/api/protos.md.exclude b/docs/api/protos.md.exclude deleted file mode 100644 index 6aa420e48..000000000 --- a/docs/api/protos.md.exclude +++ /dev/null @@ -1,328 +0,0 @@ -# Protocol Buffer (protobuf) - -## core.proto - - - - - -### Ack -An acknowledgement from a replica to the leader that it has caught up to that point in the log. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| replica | [uint32](#uint32) | | Ordinal of replica the request comes from | -| replay | [bool](#bool) | | Whether the replica is requesting a replay starting from acked offset | - - - - - - - - -### DeleteRequest -Represents a delete request - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ids | [string](#string) | repeated | Ids of items to delete | - - - - - - - - -### FetchRequest -Represents a fetch request - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ids | [string](#string) | repeated | Ids of vectors to fetch | -| vectors | [NdArray](#core.NdArray) | repeated | Result vectors corresponding to ids | - - - - - - - - -### IndexRequest -Represents an index request - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ids | [string](#string) | repeated | ids of items to be inserted | -| data | [NdArray](#core.NdArray) | | vectors of items to be inserted | - - - - - - - - -### InfoRequest -Represents an info request - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| index_size | [uint64](#uint64) | | Size of a stateful function (Index) | - - - - - - - - -### LogEntry - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| offset | [uint64](#uint64) | | WAL offset of this entry | -| entry | [Request](#core.Request) | | The request itself as it was received | -| ack | [Ack](#core.Ack) | | Or an acknowledgement from a follower of receiving this entry | - - - - - - - - -### NdArray -Represents the a numpy ndarray - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| buffer | [bytes](#bytes) | | the actual array data, in bytes | -| shape | [uint32](#uint32) | repeated | the shape (dimensions) of the array | -| dtype | [string](#string) | | the data type of the array | -| compressed | [bool](#bool) | | whether lz4 compression is used on buffer | - - - - - - - - -### QueryRequest -Represents a query request - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| top_k | [uint32](#uint32) | | Number of results to return for each query | -| include_data | [bool](#bool) | | Whether to include the vectors and raw data in response as well as ids | -| data | [NdArray](#core.NdArray) | | The batch of vectors to query | -| matches | [ScoredResults](#core.ScoredResults) | repeated | The corresponding matches returned for each query in the batch | - - - - - - - - -### Request -Represents an execution plane Request - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| request_id | [uint64](#uint64) | | unique id of the request | -| timeout | [uint32](#uint32) | | timeout in second until this message is dropped | -| path | [string](#string) | | path in DAG (defined ahead of time) to follow | -| version | [string](#string) | | request schema version | -| routes | [Request.Route](#core.Request.Route) | repeated | a list of routes this message goes through | -| status | [Status](#core.Status) | | status info, e.g. error | -| query | [QueryRequest](#core.QueryRequest) | | A query request object | -| index | [IndexRequest](#core.IndexRequest) | | An upsert items request object | -| delete | [DeleteRequest](#core.DeleteRequest) | | A delete items request object | -| info | [InfoRequest](#core.InfoRequest) | | An object for a get info request | -| fetch | [FetchRequest](#core.FetchRequest) | | Payload for a request to fetch vectors by id | -| namespace | [string](#string) | | Namespace to perform operation in (if data is divided by namespace, default "") | -| client_id | [uint32](#uint32) | | Integer ID that represents the client connection. Assigned by gateway. | -| client_offset | [uint32](#uint32) | | Offset of request within client connection. Assigned by gateway. | -| shard_num | [uint32](#uint32) | | Ordinal of the last shard visited of a stateful function (or 0). | - - - - - - - - -### Request.Route -Represents the route paths of this message - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| function | [string](#string) | | the name of the Service | -| function_id | [int32](#int32) | | the id of the Service | -| start_time | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | receiving time | -| end_time | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | sending (out) time | - - - - - - - - -### ScoredResults - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ids | [string](#string) | repeated | String ids of the item results of a query | -| scores | [float](#float) | repeated | Corresponding pairwise scores between the query to each item | -| data | [NdArray](#core.NdArray) | | Corresponding data for all of these items, if requested | - - - - - - - - -### ServiceControlRequest -Request from the controller to individual service for monitoring, updating, and terminating running services. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| function | [string](#string) | | Name of the function. | -| function_id | [uint64](#uint64) | | Unique id of the function (if any). | -| status | [Status](#core.Status) | | Status of the function. | -| service | [string](#string) | | Name of the service the function belongs to. | - - - - - - - - -### Status - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code | [Status.StatusCode](#core.Status.StatusCode) | | status code | -| description | [string](#string) | | error description of the very first exception | -| details | [Status.Details](#core.Status.Details) | repeated | the details of the error | -| msg_sent | [uint64](#uint64) | | number of messages sent by the function | -| msg_recv | [uint64](#uint64) | | number of messages received by the function | -| avg_time | [Status.AvgTimeEntry](#core.Status.AvgTimeEntry) | repeated | average time spent by messages in function | -| size | [uint64](#uint64) | | size of a function's dataset if stateful | - - - - - - - - -### Status.AvgTimeEntry - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| key | [string](#string) | | | -| value | [uint32](#uint32) | | | - - - - - - - - -### Status.Details - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| function | [string](#string) | | the name of that problematic service | -| function_id | [string](#string) | | the id of that problematic service | -| exception | [string](#string) | | the class name of the exception | -| traceback | [string](#string) | | the reason of the exception | -| time | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | the timestamp when error occurs | - - - - - - - - - - -### Status.StatusCode - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| SUCCESS | 0 | success | -| READY | 1 | ready to use | -| ERROR | 2 | error | -| ERROR_DUPLICATE | 3 | already a existing service | - - - - - - - - - -### RPCClient -core gRPC service. - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| Call | [Request](#core.Request) stream | [Request](#core.Request) stream | Pass in a Request stream and completed Requests will be returned | - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | -| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | -| double | | double | double | float | float64 | double | float | Float | -| float | | float | float | float | float32 | float | float | Float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | -| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | - diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index a6bcc6e16..000000000 --- a/docs/conf.py +++ /dev/null @@ -1,69 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) -import sphinx_rtd_theme - - -# -- Project information ----------------------------------------------------- - -project = 'Pinecone' -copyright = '2020-2021, Pinecone Systems, Inc.' -author = 'Pinecone Systems, Inc.' - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ['sphinx.ext.autodoc', 'sphinx_rtd_theme', 'sphinxcontrib.httpdomain', - 'sphinxcontrib.httpexample', 'recommonmark', 'sphinx_markdown_tables'] - -autoclass_content = "both" -httpexample_scheme = 'https' - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**/*.exclude'] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' -html_theme_options = { - "display_version": True, -} - -html_show_sourcelink = False -html_favicon = '_static/img/favicon-32x32.png' -html_logo = "_static/img/pinecone-logo.png" - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# These paths are either relative to html_static_path -# or fully qualified paths (eg. https://...) -html_css_files = [ - 'https://optimistic-curran-b817a8.netlify.app/css/pinecone-docs.css' -] diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 66b643685..000000000 --- a/docs/index.rst +++ /dev/null @@ -1,66 +0,0 @@ -.. Pinecone documentation master file, created by - sphinx-quickstart. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - - -Pinecone's Python SDK Reference -========================================================== - -`Pinecone `__ provides similarity search as a managed service. - -Learn more about Pinecone and how your ML models can benefit from a similarity search -service at `pinecone.io/docs `__ and -`pinecone.io/learn `__. - -📝 Questions and suggestions: `pinecone.io/contact `__ - - -Installation ------------------- - -.. code-block:: bash - - pip install -U pinecone-client - - -.. tip:: - Pinecone is tested on Python 3.6+. - - We strongly recommend that you install Pinecone in a virtual environment. - We think it's good for Python hygiene. - It's really easy to start using virtual environments with one of these guides: - `[1] `__, - `[2] `__. - - - -Getting Started ------------------- - -To get started, visit `pinecone.io/start `__ to get an API key. - -Once you have received your API key in the email, -head over to `pinecone.io/docs `__ to see examples and tutorials. - - -Package Reference ------------------------------------- - -.. toctree:: - :hidden: - - ✨ pinecone.io - 🚀 pinecone.io/docs - -.. toctree:: - :maxdepth: 2 - - python_client/manage - python_client/index - - -.. toctree:: - :hidden: - - support@pinecone.io diff --git a/docs/intro/concepts.rst.exclude b/docs/intro/concepts.rst.exclude deleted file mode 100644 index f9f439aaa..000000000 --- a/docs/intro/concepts.rst.exclude +++ /dev/null @@ -1,108 +0,0 @@ -Core Concepts -======================= - -The core concepts of Pinecone include: **Service**, **Graph**, **Function**, **Model Hub**, and **Traffic Router**. -The figure below describes the relationships among the core concepts. - - -.. image:: /_static/img/figure_service.svg - :alt: Pinecone service - :width: 600 - - -.. _Concept Service: - -Service ----------------------- - -A Pinecone service is a live instance of Pinecone’s vector database. -A service consists of the following compnents: - -* :ref:`Concept Graph` - The graph of a service describes how the service handles requests - and how functions in the service should be deployed. - When setting up a service, you will construct a graph from scratch - or modify an existing service's graph, then deploy the graph - to Pinecone. -* :ref:`Concept Function` - A function is a self-contained functional unit within a service. - Functions in a service handle requests (e.g. upsert, query, delete, or fetch) - per the network graph. - A service pulls custom function docker images from the :ref:`Concept Hub`. -* Management - Pinecone manages the orchestration (e.g. scaling, sharding, and recovery) - of the docker containers, - as well as the networking, storage, and logging layers. -* Connection - A client establishes a connection to a service, then it can - interact with the service to upsert, delete, query, or fetch. - Multiple connections can be established with a service. - - -.. _Concept Graph: - -Graph ----------------------- - - -A Pinecone graph is a serialization of a Pinecone **service**. -Analogous to a network graph, a Pinecone graph describes -how a request (e.g. upsert, delete, query, or fetch) is handled by a service -by specifying the sequence of nodes (i.e., the path) that the request would go through within a service's network. -The "write" path supports upsert and delete requests, -and the "read" path supports query and fetch requests. -Each node in a graph manifests itself in a service as a Pinecone **function**. - -The figure below is an example of the topology of a user-movie recommender service. -The "Pinecone engine" and "Pinecone aggregator" functions are the workhorses of Pinecone's vector database. -The figure shows that you can add a movie preprocessor and a user perprocessor to -transform movie ids and user ids into embeddings before sending time to the vector database. - -.. image:: /_static/img/figure_graph.svg - :alt: Pinecone service - :width: 600 - - -.. _Concept Function: - -Function ----------------------- - -A Pinecone function is a self-contained functional unit within a Pinecone **service**. -A function is analogous to a node in a network graph, -and each function has its own replication and sharding factors. -Currently, Pinecone supports two types of custom functions: preprocessor and postprocessor. -A preprocessor modifies the items or the queries before they are sent to Pinecone's vector database, -and a postprocessor modifies the results from the vector database. -Furthurmore, multiple preprocessors can be concatenated, and so can the postprocessors. -Note that custom functions are optional when you use Pinecone. - -A function is deployed by pulling docker images from the **model hub**. -To deploy custom functions, you will build your custom model and upload the docker images to the model hub. - - -.. _Concept Hub: - -Model Hub ----------------------- - -Pinecone's model hub is a registry where custom models are stored as docker images. -These custom models can be used by Pinecone **functions**. - -Custom models will need to use Pinecone's base docker image but they are flexible otherwise--you may write -them in any framework (e.g. scikit-learn, Tensorflow, Pytorch) with a Python interface. - - -.. _Concept Traffic Router: - -Traffic Router ----------------------- - -When a client creates a connection to a **service**, -all the traffic is sent to that particular service. -With a Pinecone traffic router, the client maintains the same connection, -but you can change, with zero downtime, the active service that handles the client's requests. -This is particular helpful for updating inference models already in production. -Currently, Pinecone traffic routers support -`blue-green deployment `_. -We are planning to add support for Canary, A/B testing, and champion/challenger deployment strategies. \ No newline at end of file diff --git a/docs/intro/figure_multivariate.rst.exclude b/docs/intro/figure_multivariate.rst.exclude deleted file mode 100644 index c4abe2fd7..000000000 --- a/docs/intro/figure_multivariate.rst.exclude +++ /dev/null @@ -1,49 +0,0 @@ -.. Code for generating multivariate graph - import seaborn as sns - import matplotlib as mpl - import matplotlib.pyplot as plt - import pandas as pd - import numpy as np - from collections import Counter - - mpl.rcdefaults() - mpl.rcParams['figure.dpi'] = 150 - sns.set_theme(style="white") - # Let's use our own colors to make things pretty... - pink = (206/255, 0/255, 65/255) - blue = ( 0/255, 0/255, 163/255) - green = ( 24/255, 187/255, 169/255) - - sample_size = 1000 - dim = 10 - A_mean = 0 - B_mean = 2 - - # Create multivariate normal samples - A_vectors = A_mean + np.random.randn(sample_size, dim) - B_vectors = B_mean + np.random.randn(sample_size, dim) - - # Query data generated from A distribution - query_size = 100 - A_queries = A_mean + np.random.randn(query_size, dim) - - # Plot - df = pd.concat([ - pd.DataFrame(dict(D1=A_vectors[:, 0], D2=A_vectors[:, 1], cluster='A')), - pd.DataFrame(dict(D1=B_vectors[:, 0], D2=B_vectors[:, 1], cluster='B')), - pd.DataFrame(dict(D1=A_queries[:, 0], D2=A_queries[:, 1], cluster='Queries')), - ]) - - fig, ax = plt.subplots(figsize=(8, 4)) - ax.tick_params(labelsize=10) - ax.xaxis.label.set_size(12) - ax.yaxis.label.set_size(12) - sns.scatterplot(data=df, x="D1", y="D2", hue="cluster", palette=[green, pink, blue], s=10, ax=ax) - ax.legend(title="cluster", loc='upper left', borderpad=0.2, fancybox=False, framealpha=0.5) - plt.tight_layout() - plt.box(on=None) - plt.savefig('multivar.png', transparent=True, dpi=80) - -.. image:: /_static/img/multivar.png - :width: 600 - :alt: Multivariate normals \ No newline at end of file diff --git a/docs/intro/installation.rst.exclude b/docs/intro/installation.rst.exclude deleted file mode 100644 index b068cdb93..000000000 --- a/docs/intro/installation.rst.exclude +++ /dev/null @@ -1,83 +0,0 @@ -.. _Intro Installation: - -Installation -======================= - -Pinecone is tested on Python 3.6+. - -We strongly recommend that you install Pinecone in a virtual environment. -We think it's good for Python hygiene. -It's really easy to start using virtual environments with one of these guides: -`[1] `_, -`[2] `_. - - -Installing Pinecone ------------------------------------- - -.. code-block:: bash - - pip install pinecone-client - - -A neat feature of Pinecone is that you can visualize the graphical representations -of your Pinecone services. If you plan to use Pinecone in a Jupyter notebook, -you should install the graph visualization tool -`graphviz `_ in your operating system. -Throughout the documentation, we assume that you have ``graphviz`` installed. - -.. code-block:: bash - - # OSX - brew install graphviz - # Debian - sudo apt install graphviz - # RPM - sudo yum install graphviz - # Windows - winget install graphviz - - - - -Setting Up Pinecone ------------------------------------- - -You will need a Pinecone API key for this step. -If you haven't received your API key, visit `pinecone.io `_ -to get started. You will receive an API key after registration. - -Make sure to load your Pinecone API key before calling Pinecone services: - - -.. code-block:: Python - - import pinecone - - pinecone.init(api_key="YOUR_API_KEY") - - - -Hello, Pinecone! ------------------------------------- - -.. tip:: - Try out this example on `Google Colab `__. - -.. code-block:: python - - import pinecone.graph - import pinecone.service - import pinecone.connector - import pandas as pd - - service_name="hello-pinecone" - graph = pinecone.graph.IndexGraph() # create a graph - graph.view() # view the graph - pinecone.service.deploy(service_name, graph) # deploy the graph as a service - conn = pinecone.connector.connect(service_name) # connect to the service - df = pd.DataFrame(data={"id": ["A", "B"], "vector": [[1, 1, 1], [2, 2, 2]]}) - conn.upsert(items=zip(df.id, df.vector)).collect() # insert vectors - conn.query(queries=[[0,1,0]], top_k=5).collect() # query - conn.info() # index info - pinecone.service.stop(service_name=service_name) # stop the service diff --git a/docs/intro/quicktour.rst.exclude b/docs/intro/quicktour.rst.exclude deleted file mode 100644 index b71031e1e..000000000 --- a/docs/intro/quicktour.rst.exclude +++ /dev/null @@ -1,584 +0,0 @@ -Quick Tour -======================= - -We will do a quick tour of Pinecone's features. -Each section is intended to be self-contained to help you -quickly reference a feature in the future. - - -Creating a vector database service ------------------------------------- - -.. tip:: - Try out this example on `Google Colab `__. - -It is easy to build vector-based ML applications using Pinecone's simple workflow: - -#. Create a Pinecone :ref:`Python Graph`. A Pinecone graph is the serialization of a Pinecone :ref:`Python Service`. -#. Deploy the Pinecone graph. - It takes a few minutes for Pinecone to set up the service. - Once the deployment finishes, you will have a production-ready vector database service. (Yes, it's that simple!) -#. Establish a :ref:`Python Connection` to the Pinecone service. - You can then start inserting vectors and getting query results. - - -In this example, we show you how you can build a simple nearest neighbor classifier. -We will sample data from two multivariate normal distributions with different means and equal variance. -We will then classify which multivariate normal distribution an unknown vector belongs to by the -majority vote of the nearest neighbors' class labels. - -.. include:: ./figure_multivariate.rst - -.. code-block:: python - - """Generate data from multivariate normal distributions""" - - import numpy as np - from collections import Counter - - sample_size = 50000 - dim = 10 - A_mean = 0 - B_mean = 2 - - # Create multivariate normal samples - A_vectors = A_mean + np.random.randn(sample_size, dim) - B_vectors = B_mean + np.random.randn(sample_size, dim) - - # Query data generated from A distribution - query_size = 20 - A_queries = A_mean + np.random.randn(query_size, dim) - - - """Build a classifier using Pinecone""" - - import pinecone.graph - import pinecone.service - import pinecone.connector - import pandas as pd - - # Create a graph - graph = pinecone.graph.IndexGraph(metric="euclidean") - - # Deploy the graph - service_name = 'simple-knn-classifier' - pinecone.service.deploy(service_name=service_name, graph=graph) - - # Create a connection - conn = pinecone.connector.connect(service_name) - - # Upload the sample data formatted as (id, vector) tuples. - items_df = pd.DataFrame() - items_df["id"] = [f"A-{ii}" for ii in range(len(A_vectors))] + [ - f"B-{ii}" for ii in range(len(B_vectors)) - ] - items_df["vector"] = [*A_vectors, *B_vectors] - acks = conn.upsert(items=zip(items_df.id, items_df.vector)).collect() - - # We expect most of a query's nearest neighbors are from the A distribution - for result in conn.query(queries=A_queries, top_k=10).collect(): - cc = Counter(id_.split("-")[0] for id_ in result.ids) - print(f"Count nearest neighbors' class labels: A={cc['A']}, B={cc['B']}") - - # Stop the service - pinecone.service.stop(service_name) - - - -Managing services ------------------------------------- - -You can manage a Pinecone :ref:`Python Service` via the following APIs: - -* ``ls``: list your Pinecone services. -* ``deploy``: deploy a Pinecone service from a Pinecone graph. -* ``stop``: stop a Pinecone service. -* ``describe``: get metadata about a Pinecone service such as its status and graphical serialization. - - -.. code-block:: python - - import pinecone.graph - import pinecone.service - - # List services - pinecone.service.ls() - - # Deploy a service - graph = pinecone.graph.IndexGraph() - pinecone.service.deploy(service_name='hello-pinecone', graph=graph) - - # Describe a service - pinecone.service.describe(service_name='hello-pinecone') - - # Stop a service - pinecone.service.stop(service_name='hello-pinecone') - - - -Interacting with a service ------------------------------------- - -.. tip:: - Try out this example on `Google Colab `__. - - -A Pinecone service creates an index for your input vectors, -and let's you query their nearest neighbors. -A service supports the following operations: - -* :code:`upsert`: insert data formatted as :code:`(id, vector)` tuples into the index, - or replace existing :code:`(id, vector)` tuples with new vector values. -* :code:`delete`: delete vectors by id. -* :code:`query`: query the index and retrieve the top-k nearest neighbors based on dot-product, cosine-similarity, Euclidean distance, and more. -* :code:`fetch`: fetch vectors stored in the index by id. -* :code:`info`: get statistics about the index. - - - -.. code-block:: python - - import pinecone.graph - import pinecone.service - import pinecone.connector - - service_name='pinecone-example' - - # Deploy a service - graph = pinecone.graph.IndexGraph() - pinecone.service.deploy(service_name=service_name, graph=graph) - - # Create a connection - conn = pinecone.connector.connect(service_name) - - # Insert vectors - - df = pd.DataFrame() - df["id"] = ["A", "B", "C", "D", "E"] - df["vector"] = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]] - - # Method 1: in-memory, all at once - AB_df = df[:2] - acks_AB = conn.upsert(items=zip(AB_df.id, AB_df.vector)).collect() - - # Method 2: in-memory, batch by batch - CDE_df = df[2:] - db_cursor = conn.upsert(items=zip(CDE_df.id, CDE_df.vector)) - acks_C = db_cursor.take(1) - acks_DE = db_cursor.take(2) - - # Method 3: stream with generators. This allows you to, for instance, consume Kafka streams. - stream_iterator = (("A{}".format(ii), [101, 201]) for ii in range(10)) - for ack in conn.upsert(items=stream_iterator).stream(): - print(ack) - - # Fetch vectors - fetch_results = conn.fetch(ids=["A", "B", "C"]).collect() - - # Query - query_results = conn.query(queries=[[1.1, 1.1], [2.2, 2.2]], top_k=2).collect() - - # Update vectors - acks = conn.upsert(items=[("A", [0, 0])]).collect() - - # Delete vectors - acks = conn.delete(ids=["A"]).collect() - - # Index statistics - conn.info() - - # Stop the service - pinecone.service.stop(service_name=service_name) - - -Namespacing data ------------------------------------------------------- - -.. tip:: - Try out this example on `Google Colab `__. - -Namespacing is a neat feature in a Pinecone service that allows you to partition your data in an index. -When you read from or write to a namespace in an index, you only access data in that particular namespace. -In other words, data from two namespaces may have the same ids but different values. -Namespacing is useful when you want to reuse the same data processing pipeline -but query only a subset of your data. -For example, when you are building a movie recommender system, you could use namespacing to -separate recommendations by genre. - - -.. code-block:: python - - import pinecone.graph - import pinecone.service - import pinecone.connector - import pandas as pd - - service_name='pinecone-namespacing' - - # Deploy a service - graph = pinecone.graph.IndexGraph() - pinecone.service.deploy(service_name=service_name, graph=graph) - - # Create a connection - conn = pinecone.connector.connect(service_name) - - # Generate some data - df = pd.DataFrame() - df["id"] = ["Wall-E", "Up", "Ratatouille", "Toy Story"] - df["vector"] = [[1, 1], [2, 2], [3, 3], [4, 4]] - - # Insert vectors without specifying a namespace - conn.upsert(items=zip(df.id, df.vector)).collect() - conn.info() - - # Insert vectors into a namespace - romantic_comedies = ["Wall-E", "Ratatouille"] - romcom_df = df[df.id.isin(romantic_comedies)] - conn.upsert( - items=zip(romcom_df.id, romcom_df.vector), namespace="romantic-comedy" - ).collect() - conn.info(namespace="romantic-comedy") - - # Query top results, without a namespace - query_results = conn.query(queries=df[df.id == "Wall-E"].vector, top_k=3).collect() - - # Query top results in the "romantic-comedy" namespace - query_results = conn.query( - queries=df[df.id == "Wall-E"].vector, top_k=3, namespace="romantic-comedy" - ).collect() - - # Stop the service - pinecone.service.stop(service_name=service_name) - - -Preprocessing data ------------------------------------------------------- - -In most vector-based ML applications, your data and your queries should be comparable -(i.e., in the same vector space). -For example, in a user-movie recommender system, user data and movie data are usually transformed -into embeddings in the same vector space for retrieving recommendations. -The data transformation tasks during insertion, update, and query are usually performed offline -or as a service separate from the database. -Pinecone lets you integrate these tasks within a Pinecone service to -optimize performance and streamline deployments. - -Let's consider the following application. -Suppose that the data consist of RGB color images whereas the expected queries are greyscale images. -We will create a preprocessor function to transform the data into greyscale images, then flatten them. -We add this preprocessor function to a Pinecone service so that we can index the color images directly. - -First, create the preprocessor function and write the function locally as ``preprocessor.py``. -You can use your favorite framework (Tensorflow, Pytorch, Scikit-learn, etc) to write the preprocessor function. - -.. code-block:: python - - # preprocessor.py - import numpy as np - from pinecone.hub import preprocessor - - - @preprocessor - class MyFunc: - def transform(self, vectors): - weights = [0.299, 0.587, 0.144] - mat = np.dot(vectors, weights) - return np.array([vec.flatten() for vec in mat]) - - -The next step is to package and upload the preprocessor as a Pinecone-compatible docker image. -You can use convenience functions in the ``pinecone`` package to easily package, build, and push docker images. - -.. code-block:: python - - import pinecone.hub - import numpy as np - - # Docker image helper - image_builder = pinecone.hub.ImageBuilder( - # The name of the docker image (you should also tag the image) - image="mock-preprocessor:v1", - - # path to which docker build artifacts are saved - build_path="./docker_build/image_preprocessor/v1", - - # main model file - model_path='./preprocessor.py', - - # pip packages needed, in addition to numpy - pip=[], - - # additional files or directories needed - data_paths=[], - ) - - # Prepare for docker build. Copy all the necessary files to the build path. - image_builder.package(exist_ok=True) - - # Get commands for logging into Pinecone Hub. - login_cmd = pinecone.hub.get_login_cmd() - - # Run the commands in the terminal. - # or in Jupyter notebook: - # !{login_cmd} - assert False, f"Run the commands in the terminal or in Jupyter notebook: {login_cmd}" - - # Get commands for building the docker image. - build_cmd = image_builder.get_build_cmd() - - # Run the commands in the terminal. - # or in Jupyter notebook: - # !{build_cmd} - assert False, f"Run the commands in the terminal or in Jupyter notebook: {build_cmd}" - - # Test the docker image locally and make sure that the preprocessor returns the expected output. - rgb_img = np.random.rand(5, 5, 3) * 255 - weights = [0.299, 0.587, 0.144] - - input_vectors = np.array([rgb_img]) - expected_output_vectors = np.array([vec.flatten() for vec in np.dot(input_vectors, weights)]) - output_vectors = None - - with pinecone.hub.ImageServer(image=image_builder.image, image_type="preprocessor") as preprocessor: - output_vectors = await preprocessor.transform(input_vectors) - - assert all([(np.float32(v1) == np.float32(v2)).all() for v1, v2 in zip(output_vectors, expected_output_vectors)]) - - # After testing the docker image locally, we will push the docker image to Pinecone hub. - # Get commands for pushing the docker image. - push_cmd = image_builder.get_push_cmd() - - # Run the commands in the terminal. - # or in Jupyter notebook: - # !{push_cmd} - assert False, f"Run the commands in the terminal or in Jupyter notebook: {push_cmd}" - - # Check that the docker image is uploaded. - assert image_builder.repository in pinecone.hub.list_repositories() - assert image_builder.tag in pinecone.hub.list_repository_tags(image_builder.repository) - -.. note:: - By default preprocessors are limited to 4GB of memory. - If your application needs to use more memory, - please reach out support@pinecone.io. - - -Once the preprocessor image is pushed to the :ref:`Python Hub`, we can add it to a Pinecone graph. -Upsert requests flow through the “write” path in the graph, -and query requests flow through the “read” path in the graph. - -.. code-block:: python - - graph = pinecone.graph.IndexGraph() - - # Add the rgb-to-greyscale preprocessor to the write path of the graph - image_name = pinecone.hub.as_user_image(image_builder.image) - write_preprocessor = pinecone.hub.HubFunction(name='rgb2grey-preprocessor', image=image_name) - graph.add_write_preprocessor(fn=write_preprocessor) - - # View the graph. It works best if you are using Jupyter notebook. - graph.view() - - -You can deploy the graph as usual, but now you can insert RGB images and query with greyscale images. - - -Postprocessing query results --------------------------------------- - -We often need to re-rank the query results. -For example, we may replace some nearest neighbors in the query results with more popular items -when their similarity scores are below a certain threshold. -Suppose that ``popular_items.json`` is a file containing the popular items and their respective similarity scores. - -.. code-block:: json - - [["A", 0.85], ["B", 0.8]] - -Let's create the postprocessor function and write it to ``postprocessor.py``: - -.. code-block:: python - - # postprocessor.py - import json - import os - import numpy as np - from pinecone.hub import postprocessor, QueryResult - - # by default all the data files on HyperCloud are placed in the ./data directory. - DATA_PREFIX = './data' - THRESHOLD = 0.7 - - # Load popular items - popular_items = [] # list of (id, score) - with open(os.path.join(DATA_PREFIX, 'popular_items.json')) as infile: - popular_items = json.load(infile) - - @postprocessor - class MyFunc: - def transform(self, queries, matches): - output = [] - for match in matches: - # First query result with score below the threshold - threshold_idx = -1 - for ii, score in enumerate(match.scores): - if score < THRESHOLD: - threshold_idx = ii - break - if threshold_idx < 0: - # All results are above threshold - output.append(match) - else: - backfill_size = len(match.ids) - threshold_idx - new_ids = match.ids[:threshold_idx] + [popular_items[ii][0] for ii in range(backfill_size)] - new_scores = match.scores[:threshold_idx] + [popular_items[ii][1] for ii in range(backfill_size)] - output.append(QueryResult(ids=new_ids, scores=new_scores, data=match.data)) - return output - - -The next step is to package and upload the postprocessor as a Pinecone-compatible docker image. -You can use convenience functions in the ``pinecone`` package to easily package, build, and push docker images. - -.. code-block:: python - - # Docker image helper - image_builder = pinecone.hub.ImageBuilder( - # The name of the docker image (you should also tag the image) - image="mock-postprocessor:v1", - - # path to which docker build artifacts are saved - build_path="./docker_build/image_postprocessor/v1", - - # main model file - model_path='./postprocessor.py', - - # pip packages needed, in addition to numpy - pip=[], - - # additional files or directories needed - data_paths=['./popular_items.json'], - ) - - # Prepare for docker build. Copy all the necessary files to the build path. - image_builder.package(exist_ok=True) - - - # Get commands for logging into Pinecone Hub. - login_cmd = pinecone.hub.get_login_cmd() - - # Run the commands in the terminal. - # or in Jupyter notebook: - # !{login_cmd} - - - # Get commands for building the docker image. - build_cmd = image_builder.get_build_cmd() - - # Run the commands in the terminal. - # or in Jupyter notebook: - # !{build_cmd} - - # Test the docker image locally and make sure that the postprocessor returns the expected output. - from pinecone.hub import QueryResult - - input_vectors = [QueryResult(ids=["AA", "BB"], scores=np.array([0.9, 0.3]))] - expected_output_vectors = [QueryResult(ids=["AA", "A"], scores=np.array([0.9, 0.85]))] - output_vectors = None - - with pinecone.hub.ImageServer(image=image_builder.image, image_type="postprocessor") as postprocessor: - output_vectors = await postprocessor.transform(np.ones(1), input_vectors) - - # Verify that output_vectors is the same as expected_output_vectors - assert output_vectors[0].ids == expected_output_vectors[0].ids - assert all(np.array(output_vectors[0].scores, dtype=np.float32) == np.array(expected_output_vectors[0].scores, dtype=np.float32)) - - - # After testing the docker image locally, we will push the docker image to Pinecone hub. - # Get commands for pushing the docker image. - push_cmd = image_builder.get_push_cmd() - - # Run the commands in the terminal. - # or in Jupyter notebook: - # !{push_cmd} - - # Check that the docker image is uploaded. - assert image_builder.repository in pinecone.hub.list_repositories() - assert image_builder.tag in pinecone.hub.list_repository_tags(image_builder.repository) - - -.. note:: - By default postprocessors are limited to 4GB of memory. - If your application needs to use more memory, - please reach out support@pinecone.io. - -Once the postprocessor image is pushed to the :ref:`Python Hub`, we can add it to a Pinecone graph. - -.. code-block:: python - - graph = pinecone.graph.IndexGraph() - - # Add the postprocessor to the graph - image_name = pinecone.hub.as_user_image(image_builder.image) - postprocessor = pinecone.hub.HubFunction(name='postprocessor', image=image_name) - graph.add_postprocessor(fn=postprocessor) - - # View the graph. It works best if you are using Jupyter notebook. - graph.view() - - -You can then deploy the graph as usual. - - - - -Routing traffic --------------------------------------- - - -With Pinecone traffic routers, your in-production ML models can be updated with zero downtime. -You can manage Pinecone traffic routers via the following APIs: - -* ``ls``: list your Pinecone traffic routers. -* ``deploy``: deploy a Pinecone traffic router. -* ``update_active_service``: updates a traffic router's active service. -* ``update_services``: updates the list of services available to a traffic router. -* ``stop``: stop a Pinecone traffic router. -* ``describe``: get metadata about a Pinecone traffic router. - - -.. code-block:: python - - import pinecone.router - import pinecone.connector - - # List routers - pinecone.router.ls() - - # Deploy a router with existing services. - pinecone.router.deploy( - router_name="movie_recommender_router", - services=["recommender-v1", "recommender-v2"], - active_service="recommender-v1", - ) - - # Connect to the active service of a traffic router - conn = pinecone.connector.connect(router_name="movie_recommender_router") - - # Update a traffic router's active service. - pinecone.router.update_active_service( - router_name="movie_recommender_router", - active_service="recommender-v2", - ) - - # Update the list of services available to a traffic router. - # NOTE: the new list of services must contain the currently active service. - pinecone.router.update_services( - router_name="movie_recommender_router", - services=["recommender-v2", "recommender-v3"], - ) - - # Stop a traffic router - pinecone.router.stop("movie_recommender_router") - - # Describe a traffic router - pinecone.router.describe("movie_recommender_router") \ No newline at end of file diff --git a/docs/python_client/index.rst b/docs/python_client/index.rst deleted file mode 100644 index 8de547e75..000000000 --- a/docs/python_client/index.rst +++ /dev/null @@ -1,28 +0,0 @@ -Pinecone Index ------------------- - -.. autoclass:: pinecone.Index - :members: - :undoc-members: - - -.. autoclass:: pinecone.UpsertResult - :members: - :undoc-members: -.. autoclass:: pinecone.QueryResult - :members: - :undoc-members: -.. autoclass:: pinecone.DeleteResult - :members: - :undoc-members: -.. autoclass:: pinecone.FetchResult - :members: - :undoc-members: -.. autoclass:: pinecone.InfoResult - :members: - :undoc-members: - - -.. autoclass:: pinecone.grpc.GRPCClientConfig - :members: - :undoc-members: diff --git a/docs/python_client/manage.rst b/docs/python_client/manage.rst deleted file mode 100644 index e4c486791..000000000 --- a/docs/python_client/manage.rst +++ /dev/null @@ -1,13 +0,0 @@ -Pinecone Resource Management ------------------------------------- - - -.. automethod:: pinecone.init -.. automethod:: pinecone.create_index -.. automethod:: pinecone.delete_index -.. automethod:: pinecone.list_indexes -.. automethod:: pinecone.describe_index - -.. autoclass:: pinecone.IndexDescription - :members: - :undoc-members: \ No newline at end of file diff --git a/docs/python_client/router.rst.exclude b/docs/python_client/router.rst.exclude deleted file mode 100644 index 6b77f002f..000000000 --- a/docs/python_client/router.rst.exclude +++ /dev/null @@ -1,7 +0,0 @@ -Traffic Router ---------------- - -.. automodule:: pinecone.router - :members: - :undoc-members: - diff --git a/open_api_merge.json b/open_api_merge.json deleted file mode 100644 index e1f62727b..000000000 --- a/open_api_merge.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "inputs":[ - { - "inputFile":"specs/vector_service.openapi.json" - }, - { - "inputFile":"specs/index_service.json" - } - ], - "output":"specs/pinecone_api.json" -} diff --git a/requirements-grpc.txt b/requirements-grpc.txt index 08dc72c1d..0cf082178 100644 --- a/requirements-grpc.txt +++ b/requirements-grpc.txt @@ -1,4 +1,4 @@ -grpcio==1.37.1 +grpcio>=1.44.0 grpc-gateway-protoc-gen-openapiv2==0.1.0 googleapis-common-protos==1.53.0 lz4==3.1.3 diff --git a/specs/index_service.json b/specs/index_service.json deleted file mode 100644 index 6e0144724..000000000 --- a/specs/index_service.json +++ /dev/null @@ -1,405 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "defaultTitle", - "description": "defaultDescription", - "version": "0.1" - }, - "tags": [ - { - "name": "Index Operations" - } - ], - "servers": [ - { - "url": "https://controller.{environment}.pinecone.io" - } - ], - "paths": { - "/databases": { - "get": { - "operationId": "list_indexes", - "description": "This operation returns a list of your Pinecone indexes.", - "responses": { - "200": { - "description": "This operation returns a list of all the indexes that you have previously created, and which are associated with the given API key", - "content": { - "application/json; charset=utf-8": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Index Operations" - ] - }, - "post": { - "operationId": "create_index", - "description": "This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/createRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The index has been successfully created", - "content": { - "text/plain": { - "schema": { - "type": "string" - } - } - } - }, - "400": { - "description": "Bad request. Encountered when request exceeds quota or an invalid index name." - }, - "409": { - "description": "Index of given name already exists." - }, - "500": { - "description": "Internal error. Can be caused by invalid parameters." - } - }, - "tags": [ - "Index Operations" - ] - }, - "servers": [ - { - "url": "https://controller.{environment}.pinecone.io", - "variables": { - "environment": { - "default": "unknown" - } - } - } - ] - }, - "/databases/{indexName}": { - "get": { - "operationId": "describe_index", - "description": "Get a description of an index.", - "parameters": [ - { - "name": "indexName", - "required": true, - "in": "path", - "description": "The name of the index", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Configuration information and deployment status of the index", - "content": { - "application/json": { - "schema": { - "type": "object", - "$ref": "#/components/schemas/indexMeta" - } - } - } - }, - "404": { - "description": "Index not found" - }, - "500": { - "description": "Internal error. Can be caused by invalid parameters." - } - }, - "tags": [ - "Index Operations" - ] - }, - "delete": { - "operationId": "delete_index", - "description": "This operation deletes an existing index.", - "parameters": [ - { - "name": "indexName", - "required": true, - "in": "path", - "schema": { - "type": "string" - }, - "description": "The name of the index" - } - ], - "responses": { - "200": { - "description": "The index has been successfully deleted.", - "content": { - "text/plain": { - "schema": { - "type": "string" - } - } - } - }, - "404": { - "description": "Index not found." - }, - "500": { - "description": "Internal error. Can be caused by invalid parameters." - } - }, - "tags": [ - "Index Operations" - ] - }, - "patch": { - "operationId": "scale_index", - "description": "This operation increases or decreases the number of replicas in an index.", - "parameters": [ - { - "name": "indexName", - "required": true, - "in": "path", - "schema": { - "type": "string" - }, - "description": "The name of the index" - } - ], - "requestBody": { - "description": "The number of replicas", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/patchRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The index has been successfully updated", - "content": { - "text/plain": { - "schema": { - "type": "string" - } - } - } - }, - "404": { - "description": "Index not found." - }, - "400": { - "description": "Bad request,not enough quota." - }, - "500": { - "description": "Internal error. Can be caused by invalid parameters." - } - }, - "tags": [ - "Index Operations" - ] - }, - "servers": [ - { - "url": "https://controller.{environment}.pinecone.io", - "variables": { - "environment": { - "default": "unknown" - } - } - } - ] - } - }, - "components": { - "schemas": { - "createRequest": { - "type": "object", - "required": [ - "name", - "dimension" - ], - "properties": { - "name": { - "type": "string", - "description": "The name of the index to be updated", - "example": "example-index" - }, - "dimension": { - "type": "integer", - "description": "The dimensions of the vectors to be inserted in the index", - "example": 1024 - }, - "index_type": { - "type": "string", - "description": "The type of vector index. Pinecone supports 'approximated'.", - "default": "approximated" - }, - "metric": { - "type": "string", - "description": "The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.", - "default": "cosine" - }, - "pods": { - "type": "integer", - "description": "The number of pods for the index to use,including replicas.", - "default": 1 - }, - "replicas": { - "type": "integer", - "description": "The number of replicas. Replicas duplicate your index. They provide higher availability and throughput.", - "default": 1 - }, - "shards": { - "type": "integer", - "description": "The number of shards to be used in the index.", - "default": 1 - }, - "pod_type": { - "type": "string", - "description": "The type of pod to use. One of 's1' or 'p1'.", - "default": "p1" - }, - "index_config": { - "oneOf": [ - { - "$ref": "#/components/schemas/ApproximatedConfig" - } - ] - }, - "metadata_config": { - "type": "object", - "description": "Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: \n - ``` \n - {\"indexed\": [\"example_metadata_field\"] \n - ``` ", - "nullable": true - } - } - }, - "indexMeta": { - "type": "object", - "properties": { - "database": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "dimensions": { - "type": "string" - }, - "index_type": { - "type": "string" - }, - "metric": { - "type": "string" - }, - "pods": { - "type": "integer" - }, - "replicas": { - "type": "integer" - }, - "shards": { - "type": "integer" - }, - "pod_type": { - "type": "string" - }, - "index_config": { - "oneOf": [ - { - "$ref": "#/components/schemas/ApproximatedConfig" - } - ] - }, - "status": { - "type": "object", - "properties": { - "ready": { - "type": "boolean" - }, - "state": { - "type": "string", - "enum": ["Initializing", "ScalingUp", "ScalingDown", "Terminating", "Ready"] - } - } - } - } - } - } - }, - "patchRequest": { - "type": "object", - "properties": { - "replicas": { - "type": "integer", - "example": 3 - } - } - }, - "HnswConfig": { - "type": "object", - "properties": { - "ef_construction": { - "type": "integer", - "default": 500 - }, - "ef": { - "type": "integer", - "default": 250 - }, - "M": { - "type": "integer", - "default": 12 - }, - "max_elements": { - "type": "integer", - "default": 50000000 - } - } - }, - "ApproximatedConfig": { - "type": "object", - "properties": { - "k_bits": { - "type": "integer", - "default": 512 - }, - "hybrid": { - "type": "boolean", - "default": false - } - } - } - }, - "securitySchemes": { - "ApiKeyAuth": { - "type": "apiKey", - "name": "Api-Key", - "in": "header" - } - } - }, - "security": [ - { - "ApiKeyAuth": [] - } - ], - "externalDocs": { - "description": "More Pinecone.io API docs", - "url": "https://www.pinecone.io/docs" - } -} diff --git a/specs/pinecone_api.json b/specs/pinecone_api.json deleted file mode 100644 index 89343b2b0..000000000 --- a/specs/pinecone_api.json +++ /dev/null @@ -1,1330 +0,0 @@ -{ - "openapi": "3.0.3", - "info": { - "title": "Pinecone API", - "version": "version not set", - "contact": { - "name": "Pinecone.io Ops", - "url": "https://pinecone.io", - "email": "support@pinecone.io" - } - }, - "servers": [ - { - "url": "https://{index_name}-{project_name}.svc.{environment}.pinecone.io", - "variables": { - "index_name": { - "default": "unknown" - }, - "project_name": { - "default": "unknown" - }, - "environment": { - "default": "unknown" - } - } - } - ], - "externalDocs": { - "description": "More Pinecone.io API docs", - "url": "https://www.pinecone.io/docs" - }, - "security": [ - { - "ApiKeyAuth": [] - } - ], - "tags": [ - { - "name": "Vector Operations" - }, - { - "name": "Index Operations" - } - ], - "paths": { - "/describe_index_stats": { - "get": { - "summary": "DescribeIndexStats", - "description": "The `DescribeIndexStats` operation returns statistics about the index's contents.\nFor example: The vector count per namespace and the number of dimensions.", - "operationId": "describe_index_stats1", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DescribeIndexStatsResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "tags": [ - "Vector Operations" - ] - }, - "post": { - "summary": "DescribeIndexStats", - "description": "The `DescribeIndexStats` operation returns statistics about the index's contents.\nFor example: The vector count per namespace and the number of dimensions.", - "operationId": "describe_index_stats", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DescribeIndexStatsResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DescribeIndexStatsRequest" - } - } - }, - "required": true - }, - "tags": [ - "Vector Operations" - ] - } - }, - "/query": { - "post": { - "summary": "Query", - "description": "The `Query` operation searches a namespace, using a query vector.\nIt retrieves the ids of the most similar items in a namespace, along with their similarity scores.", - "operationId": "query", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueryResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueryRequest" - } - } - }, - "required": true - }, - "tags": [ - "Vector Operations" - ] - } - }, - "/vectors/delete": { - "delete": { - "summary": "Delete", - "description": "The `Delete` operation deletes vectors, by id, from a single namespace.\nYou can delete items by their id, from a single namespace.", - "operationId": "delete1", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "parameters": [ - { - "name": "ids", - "description": "Vectors to delete.", - "in": "query", - "required": false, - "explode": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "deleteAll", - "description": "This indicates that all vectors in the index namespace should be deleted.", - "in": "query", - "required": false, - "schema": { - "type": "boolean", - "default": "false" - } - }, - { - "name": "namespace", - "description": "The namespace to delete vectors from, if applicable.", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Vector Operations" - ] - }, - "post": { - "summary": "Delete", - "description": "The `Delete` operation deletes vectors, by id, from a single namespace.\nYou can delete items by their id, from a single namespace.", - "operationId": "delete", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteRequest" - } - } - }, - "required": true - }, - "tags": [ - "Vector Operations" - ] - } - }, - "/vectors/fetch": { - "get": { - "summary": "Fetch", - "description": "The `Fetch` operation looks up and returns vectors, by id, from a single namespace.\nThe returned vectors include the vector data and/or metadata.", - "operationId": "fetch", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FetchResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "parameters": [ - { - "name": "ids", - "description": "The vector ids to fetch.", - "in": "query", - "required": true, - "explode": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "namespace", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Vector Operations" - ] - } - }, - "/vectors/update": { - "post": { - "summary": "Update", - "description": "The `Update` operation updates vector in a namespace.\nIf a value is included, it will overwrite the previous value.\nIf a set_metadata is included, the values of the fields specified in it will be added or overwrite the previous value.", - "operationId": "update", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateRequest" - } - } - }, - "required": true - }, - "tags": [ - "Vector Operations" - ] - } - }, - "/vectors/upsert": { - "post": { - "summary": "Upsert", - "description": "The `Upsert` operation writes vectors into a namespace.\nIf a new value is upserted for an existing vector id, it will overwrite the previous value.", - "operationId": "upsert", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpsertResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpsertRequest" - } - } - }, - "required": true - }, - "tags": [ - "Vector Operations" - ] - } - }, - "/databases": { - "get": { - "operationId": "list_indexes", - "description": "This operation returns a list of your Pinecone indexes.", - "responses": { - "200": { - "description": "This operation returns a list of all the indexes that you have previously created, and which are associated with the given API key", - "content": { - "application/json; charset=utf-8": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Index Operations" - ] - }, - "post": { - "operationId": "create_index", - "description": "This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/createRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The index has been successfully created", - "content": { - "text/plain": { - "schema": { - "type": "string" - } - } - } - }, - "400": { - "description": "Bad request. Encountered when request exceeds quota or an invalid index name." - }, - "409": { - "description": "Index of given name already exists." - }, - "500": { - "description": "Internal error. Can be caused by invalid parameters." - } - }, - "tags": [ - "Index Operations" - ] - }, - "servers": [ - { - "url": "https://controller.{environment}.pinecone.io", - "variables": { - "environment": { - "default": "unknown" - } - } - } - ] - }, - "/databases/{indexName}": { - "get": { - "operationId": "describe_index", - "description": "Get a description of an index.", - "parameters": [ - { - "name": "indexName", - "required": true, - "in": "path", - "description": "The name of the index", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Configuration information and deployment status of the index", - "content": { - "application/json": { - "schema": { - "type": "object", - "$ref": "#/components/schemas/indexMeta" - } - } - } - }, - "404": { - "description": "Index not found" - }, - "500": { - "description": "Internal error. Can be caused by invalid parameters." - } - }, - "tags": [ - "Index Operations" - ] - }, - "delete": { - "operationId": "delete_index", - "description": "This operation deletes an existing index.", - "parameters": [ - { - "name": "indexName", - "required": true, - "in": "path", - "schema": { - "type": "string" - }, - "description": "The name of the index" - } - ], - "responses": { - "200": { - "description": "The index has been successfully deleted.", - "content": { - "text/plain": { - "schema": { - "type": "string" - } - } - } - }, - "404": { - "description": "Index not found." - }, - "500": { - "description": "Internal error. Can be caused by invalid parameters." - } - }, - "tags": [ - "Index Operations" - ] - }, - "patch": { - "operationId": "scale_index", - "description": "This operation increases or decreases the number of replicas in an index.", - "parameters": [ - { - "name": "indexName", - "required": true, - "in": "path", - "schema": { - "type": "string" - }, - "description": "The name of the index" - } - ], - "requestBody": { - "description": "The number of replicas", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/patchRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The index has been successfully updated", - "content": { - "text/plain": { - "schema": { - "type": "string" - } - } - } - }, - "400": { - "description": "Bad request,not enough quota." - }, - "404": { - "description": "Index not found." - }, - "500": { - "description": "Internal error. Can be caused by invalid parameters." - } - }, - "tags": [ - "Index Operations" - ] - }, - "servers": [ - { - "url": "https://controller.{environment}.pinecone.io", - "variables": { - "environment": { - "default": "unknown" - } - } - } - ] - } - }, - "components": { - "schemas": { - "DeleteRequest": { - "type": "object", - "properties": { - "ids": { - "type": "array", - "example": [ - "id-0", - "id-1" - ], - "items": { - "type": "string" - }, - "description": "Vectors to delete.", - "maxLength": 1000, - "minLength": 1 - }, - "deleteAll": { - "type": "boolean", - "example": false, - "default": "false", - "description": "This indicates that all vectors in the index namespace should be deleted." - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "The namespace to delete vectors from, if applicable." - }, - "filter": { - "type": "object", - "description": "If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive\nwith specifying ids to delete in the ids param or using delete_all=True.\nSee https://www.pinecone.io/docs/metadata-filtering/`." - } - }, - "description": "The request for the `Delete` operation." - }, - "DeleteResponse": { - "type": "object", - "description": "The response for the `Delete` operation." - }, - "DescribeIndexStatsRequest": { - "type": "object", - "properties": { - "filter": { - "type": "object", - "title": "If specified, the metadata filter here will be used to select the vectors to get stats about.\nSee https://www.pinecone.io/docs/metadata-filtering/`" - } - }, - "description": "The request for the `DescribeIndexStats` operation." - }, - "DescribeIndexStatsResponse": { - "type": "object", - "example": { - "namespaces": { - "": { - "vectorCount": 50000 - }, - "example-namespace-2": { - "vectorCount": 30000 - } - }, - "dimension": 1024, - "index_fullness": 0.42 - }, - "properties": { - "namespaces": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/NamespaceSummary" - }, - "title": "A mapping for each namespace in the index from namespace name to a summary of its contents.\nIf a metadata filter expression is passed, the summary will reflect only vectors matching that expression" - }, - "dimension": { - "type": "integer", - "format": "int64", - "example": 1024, - "description": "The dimension of the indexed vectors." - }, - "indexFullness": { - "type": "number", - "format": "float", - "example": 0.42, - "description": "The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%." - }, - "totalVectorCount": { - "type": "integer", - "format": "int64", - "example": 80000, - "title": "The total number of vectors in the index, regardless of whether a metadata filter expression was passed" - } - }, - "description": "The response for the `DescribeIndexStats` operation." - }, - "FetchResponse": { - "type": "object", - "properties": { - "vectors": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/Vector" - }, - "title": "The fetched vectors, in the form of a map between the fetched ids and the fetched vectors" - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "The namespace of the vectors." - } - }, - "description": "The response for the `Fetch` operation." - }, - "NamespaceSummary": { - "type": "object", - "properties": { - "vectorCount": { - "type": "integer", - "format": "int64", - "example": 50000, - "description": "The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the\nunderlying index and corresponding query results, etc." - } - }, - "description": "A summary of the contents of a namespace." - }, - "QueryRequest": { - "type": "object", - "properties": { - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "The namespace to query." - }, - "topK": { - "type": "integer", - "format": "int64", - "example": 10, - "description": "The number of results to return for each query.", - "maximum": 10000, - "minimum": 1, - "required": [ - "top_k" - ] - }, - "filter": { - "type": "object", - "example": { - "genre": { - "$in": [ - "comedy", - "documentary", - "drama" - ] - }, - "year": { - "$eq": 2019 - } - }, - "description": "The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/." - }, - "includeValues": { - "type": "boolean", - "example": true, - "default": "false", - "description": "Indicates whether vector values are included in the response." - }, - "includeMetadata": { - "type": "boolean", - "example": true, - "default": "false", - "description": "Indicates whether metadata is included in the response as well as the ids." - }, - "queries": { - "type": "array", - "items": { - "$ref": "#/components/schemas/QueryVector" - }, - "description": "DEPRECATED. The query vectors.", - "maxLength": 10, - "minLength": 1 - }, - "vector": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "The query vector. This should be the same length as the dimension of the index being queried.", - "maxLength": 20000, - "minLength": 1 - }, - "id": { - "type": "string", - "example": "example-vector-1", - "description": "The vector's unique id.", - "maxLength": 512 - } - }, - "description": "The request for the `Query` operation.", - "required": [ - "topK" - ] - }, - "QueryResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SingleQueryResults" - }, - "description": "DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`." - }, - "matches": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ScoredVector" - }, - "description": "The matches for the vectors." - }, - "namespace": { - "type": "string", - "description": "The namespace for the vectors." - } - }, - "description": "The response for the `Query` operation. These are the matches found for a particular query vector. The matches are ordered from most similar to least similar." - }, - "QueryVector": { - "type": "object", - "properties": { - "values": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "The query vector values. This should be the same length as the dimension of the index being queried.", - "maxLength": 20000, - "minLength": 1, - "required": [ - "values" - ] - }, - "topK": { - "type": "integer", - "format": "int64", - "example": 10, - "description": "An override for the number of results to return for this query vector.", - "maximum": 10000, - "minimum": 1 - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "An override the namespace to search." - }, - "filter": { - "type": "object", - "example": { - "genre": { - "$in": [ - "comedy", - "documentary", - "drama" - ] - }, - "year": { - "$eq": 2019 - } - }, - "description": "An override for the metadata filter to apply. This replaces the request-level filter." - } - }, - "description": "A single query vector within a `QueryRequest`.", - "required": [ - "values" - ] - }, - "ScoredVector": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "example-vector-1", - "description": "This is the vector's unique id.", - "maxLength": 512, - "minLength": 1, - "required": [ - "id" - ] - }, - "score": { - "type": "number", - "format": "float", - "example": 0.08, - "description": "This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar." - }, - "values": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "This is the vector data, if it is requested." - }, - "metadata": { - "type": "object", - "example": { - "genre": "documentary", - "year": 2019 - }, - "description": "This is the metadata, if it is requested." - } - }, - "required": [ - "id" - ] - }, - "SingleQueryResults": { - "type": "object", - "properties": { - "matches": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ScoredVector" - }, - "description": "The matches for the vectors." - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "The namespace for the vectors." - } - }, - "title": "The query results for a single `QueryVector`" - }, - "UpdateRequest": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "example-vector-1", - "description": "Vector's unique id.", - "maxLength": 512, - "minLength": 1, - "required": [ - "id" - ] - }, - "values": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "Vector data.", - "maxLength": 20000, - "minLength": 1 - }, - "setMetadata": { - "type": "object", - "example": { - "genre": "documentary", - "year": 2019 - }, - "description": "Metadata to *set* for the vector." - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "Namespace name where to update the vector." - } - }, - "description": "The request for the `Upsert` operation.", - "required": [ - "id" - ] - }, - "UpdateResponse": { - "type": "object", - "description": "The response for the `Update` operation." - }, - "UpsertRequest": { - "type": "object", - "properties": { - "vectors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Vector" - }, - "description": "This is the actual array data.", - "maxLength": 1000, - "minLength": 1, - "required": [ - "vectors" - ] - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "This is the namespace name where you upsert vectors." - } - }, - "description": "The request for the `Upsert` operation.", - "required": [ - "vectors" - ] - }, - "UpsertResponse": { - "type": "object", - "properties": { - "upsertedCount": { - "type": "integer", - "format": "int64", - "example": 10, - "description": "The number of vectors upserted." - } - }, - "description": "The response for the `Upsert` operation." - }, - "Vector": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "example-vector-1", - "description": "This is the vector's unique id.", - "maxLength": 512, - "minLength": 1, - "required": [ - "id" - ] - }, - "values": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "This is the vector data included in the request.", - "maxLength": 20000, - "minLength": 1, - "required": [ - "values" - ] - }, - "metadata": { - "type": "object", - "example": { - "genre": "documentary", - "year": 2019 - }, - "description": "This is the metadata included in the request." - } - }, - "required": [ - "id", - "values" - ] - }, - "protobufAny": { - "type": "object", - "properties": { - "typeUrl": { - "type": "string" - }, - "value": { - "type": "string", - "format": "byte" - } - } - }, - "protobufNullValue": { - "type": "string", - "enum": [ - "NULL_VALUE" - ], - "default": "NULL_VALUE", - "description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value." - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "$ref": "#/components/schemas/protobufAny" - } - } - } - }, - "createRequest": { - "type": "object", - "required": [ - "name", - "dimension" - ], - "properties": { - "name": { - "type": "string", - "description": "The name of the index to be updated", - "example": "example-index" - }, - "dimension": { - "type": "integer", - "description": "The dimensions of the vectors to be inserted in the index", - "example": 1024 - }, - "index_type": { - "type": "string", - "description": "The type of vector index. Pinecone supports 'approximated'.", - "default": "approximated" - }, - "metric": { - "type": "string", - "description": "The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.", - "default": "cosine" - }, - "pods": { - "type": "integer", - "description": "The number of pods for the index to use,including replicas.", - "default": 1 - }, - "replicas": { - "type": "integer", - "description": "The number of replicas. Replicas duplicate your index. They provide higher availability and throughput.", - "default": 1 - }, - "shards": { - "type": "integer", - "description": "The number of shards to be used in the index.", - "default": 1 - }, - "pod_type": { - "type": "string", - "description": "The type of pod to use. One of 's1' or 'p1'.", - "default": "p1" - }, - "index_config": { - "oneOf": [ - { - "$ref": "#/components/schemas/ApproximatedConfig" - } - ] - }, - "metadata_config": { - "type": "object", - "description": "Configuration for the behavior of Pinecone's internal metadata index", - "nullable": true - } - } - }, - "indexMeta": { - "type": "object", - "properties": { - "database": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "dimensions": { - "type": "string" - }, - "index_type": { - "type": "string" - }, - "metric": { - "type": "string" - }, - "pods": { - "type": "integer" - }, - "replicas": { - "type": "integer" - }, - "shards": { - "type": "integer" - }, - "pod_type": { - "type": "string" - }, - "index_config": { - "oneOf": [ - { - "$ref": "#/components/schemas/ApproximatedConfig" - } - ] - }, - "status": { - "type": "object", - "properties": { - "ready": { - "type": "boolean" - }, - "state": { - "type": "string", - "enum": [ - "Initializing", - "ScalingUp", - "ScalingDown", - "Terminating", - "Ready" - ] - } - } - } - } - } - } - }, - "patchRequest": { - "type": "object", - "properties": { - "replicas": { - "type": "integer", - "example": 3 - } - } - }, - "HnswConfig": { - "type": "object", - "properties": { - "ef_construction": { - "type": "integer", - "default": 500 - }, - "ef": { - "type": "integer", - "default": 250 - }, - "M": { - "type": "integer", - "default": 12 - }, - "max_elements": { - "type": "integer", - "default": 50000000 - } - } - }, - "ApproximatedConfig": { - "type": "object", - "properties": { - "k_bits": { - "type": "integer", - "default": 512 - }, - "hybrid": { - "type": "boolean", - "default": false - } - } - } - }, - "securitySchemes": { - "ApiKeyAuth": { - "type": "apiKey", - "description": "An API Key is required to call Pinecone APIs. Get yours at https://www.pinecone.io/start/", - "name": "Api-Key", - "in": "header" - } - } - } -} \ No newline at end of file diff --git a/specs/vector_service.openapi.json b/specs/vector_service.openapi.json deleted file mode 100644 index c2afac93c..000000000 --- a/specs/vector_service.openapi.json +++ /dev/null @@ -1,956 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Pinecone API", - "version": "version not set", - "contact": { - "name": "Pinecone.io Ops", - "url": "https://pinecone.io", - "email": "support@pinecone.io" - } - }, - "tags": [ - { - "name": "Vector Operations" - } - ], - "paths": { - "/describe_index_stats": { - "get": { - "summary": "DescribeIndexStats", - "description": "The `DescribeIndexStats` operation returns statistics about the index's contents.\nFor example: The vector count per namespace and the number of dimensions.", - "operationId": "describe_index_stats1", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DescribeIndexStatsResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "tags": [ - "Vector Operations" - ] - }, - "post": { - "summary": "DescribeIndexStats", - "description": "The `DescribeIndexStats` operation returns statistics about the index's contents.\nFor example: The vector count per namespace and the number of dimensions.", - "operationId": "describe_index_stats", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DescribeIndexStatsResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DescribeIndexStatsRequest" - } - } - }, - "tags": [ - "Vector Operations" - ] - } - }, - "/query": { - "post": { - "summary": "Query", - "description": "The `Query` operation searches a namespace, using a query vector.\nIt retrieves the ids of the most similar items in a namespace, along with their similarity scores.", - "operationId": "query", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueryResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueryRequest" - } - } - }, - "required": true - }, - "tags": [ - "Vector Operations" - ] - } - }, - "/vectors/delete": { - "delete": { - "summary": "Delete", - "description": "The `Delete` operation deletes vectors, by id, from a single namespace.\nYou can delete items by their id, from a single namespace.", - "operationId": "delete", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "parameters": [ - { - "name": "ids", - "description": "Vectors to delete.", - "in": "query", - "required": false, - "explode": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "deleteAll", - "description": "This indicates that all vectors in the index namespace should be deleted.", - "in": "query", - "required": false, - "schema": { - "type": "boolean", - "default": "false" - } - }, - { - "name": "namespace", - "description": "The namespace to delete vectors from, if applicable.", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Vector Operations" - ] - }, - "post": { - "summary": "Delete", - "description": "The `Delete` operation deletes vectors, by id, from a single namespace.\nYou can delete items by their id, from a single namespace.", - "operationId": "delete", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteRequest" - } - } - }, - "required": true - }, - "tags": [ - "Vector Operations" - ] - } - }, - "/vectors/fetch": { - "get": { - "summary": "Fetch", - "description": "The `Fetch` operation looks up and returns vectors, by id, from a single namespace.\nThe returned vectors include the vector data and/or metadata.", - "operationId": "fetch", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FetchResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "parameters": [ - { - "name": "ids", - "description": "The vector ids to fetch.", - "in": "query", - "required": true, - "explode": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "namespace", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Vector Operations" - ] - } - }, - "/vectors/update": { - "post": { - "summary": "Update", - "description": "The `Update` operation updates vector in a namespace.\nIf a value is included, it will overwrite the previous value.\nIf a set_metadata is included, the values of the fields specified in it will be added or overwrite the previous value.", - "operationId": "update", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateRequest" - } - } - }, - "required": true - }, - "tags": [ - "Vector Operations" - ] - } - }, - "/vectors/upsert": { - "post": { - "summary": "Upsert", - "description": "The `Upsert` operation writes vectors into a namespace.\nIf a new value is upserted for an existing vector id, it will overwrite the previous value.", - "operationId": "upsert", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpsertResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/rpcStatus" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpsertRequest" - } - } - }, - "required": true - }, - "tags": [ - "Vector Operations" - ] - } - } - }, - "security": [ - { - "ApiKeyAuth": [] - } - ], - "externalDocs": { - "description": "More Pinecone.io API docs", - "url": "https://www.pinecone.io/docs" - }, - "servers": [ - { - "url": "https://{index_name}-{project_name}.svc.{environment}.pinecone.io", - "variables": { - "index_name": { - "default": "unknown" - }, - "project_name": { - "default": "unknown" - }, - "environment": { - "default": "unknown" - } - } - } - ], - "components": { - "securitySchemes": { - "ApiKeyAuth": { - "type": "apiKey", - "description": "An API Key is required to call Pinecone APIs. Get yours at https://www.pinecone.io/start/", - "name": "Api-Key", - "in": "header" - } - }, - "schemas": { - "DeleteRequest": { - "type": "object", - "properties": { - "ids": { - "type": "array", - "example": [ - "id-0", - "id-1" - ], - "items": { - "type": "string" - }, - "description": "Vectors to delete.", - "maxLength": 1000, - "minLength": 1 - }, - "deleteAll": { - "type": "boolean", - "example": false, - "default": "false", - "description": "This indicates that all vectors in the index namespace should be deleted." - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "The namespace to delete vectors from, if applicable." - }, - "filter": { - "type": "object", - "description": "If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive\nwith specifying ids to delete in the ids param or using delete_all=True.\nSee https://www.pinecone.io/docs/metadata-filtering/`." - } - }, - "description": "The request for the `Delete` operation." - }, - "DeleteResponse": { - "type": "object", - "description": "The response for the `Delete` operation." - }, - "DescribeIndexStatsRequest": { - "type": "object", - "properties": { - "filter": { - "type": "object", - "title": "If specified, the metadata filter here will be used to select the vectors to get stats about.\nSee https://www.pinecone.io/docs/metadata-filtering/`" - }, - "description": "The request for the `DescribeIndexStats` operation." - }, - "DescribeIndexStatsResponse": { - "type": "object", - "example": { - "namespaces": { - "": { - "vectorCount": 50000 - }, - "example-namespace-2": { - "vectorCount": 30000 - } - }, - "dimension": 1024, - "index_fullness": 0.42 - }, - "properties": { - "namespaces": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/NamespaceSummary" - }, - "description": "A mapping for each namespace in the index from namespace name to a summary of its contents." - }, - "dimension": { - "type": "integer", - "format": "int64", - "example": 1024, - "description": "The dimension of the indexed vectors." - }, - "indexFullness": { - "type": "number", - "format": "float", - "example": 0.42, - "description": "The fullness of the index." - }, - "totalVectorCount": { - "type": "integer", - "format": "int64", - "example": 80000, - "title": "The total number of vectors in the index" - } - }, - "description": "The response for the `DescribeIndexStats` operation." - }, - "FetchResponse": { - "type": "object", - "properties": { - "vectors": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/Vector" - }, - "title": "The fetched vectors, in the form of a map between the fetched ids and the fetched vectors" - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "The namespace of the vectors." - } - }, - "description": "The response for the `Fetch` operation." - }, - "NamespaceSummary": { - "type": "object", - "properties": { - "vectorCount": { - "type": "integer", - "format": "int64", - "example": 50000, - "description": "The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the\nunderlying index and corresponding query results, etc." - } - }, - "description": "A summary of the contents of a namespace." - }, - "QueryRequest": { - "type": "object", - "properties": { - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "The namespace to query." - }, - "topK": { - "type": "integer", - "format": "int64", - "example": 10, - "description": "The number of results to return for each query.", - "maximum": 10000, - "minimum": 1, - "required": [ - "top_k" - ] - }, - "filter": { - "type": "object", - "example": { - "genre": { - "$in": [ - "comedy", - "documentary", - "drama" - ] - }, - "year": { - "$eq": 2019 - } - }, - "description": "The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/." - }, - "includeValues": { - "type": "boolean", - "example": true, - "default": "false", - "description": "Indicates whether vector values are included in the response." - }, - "includeMetadata": { - "type": "boolean", - "example": true, - "default": "false", - "description": "Indicates whether metadata is included in the response as well as the ids." - }, - "queries": { - "type": "array", - "items": { - "$ref": "#/components/schemas/QueryVector" - }, - "description": "DEPRECATED. The query vectors.", - "maxLength": 10, - "minLength": 1 - }, - "vector": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "The query vector. This should be the same length as the dimension of the index being queried.", - "maxLength": 20000, - "minLength": 1 - }, - "id": { - "type": "string", - "example": "example-vector-1", - "description": "The vector's unique id.", - "maxLength": 512 - } - }, - "description": "The request for the `Query` operation.", - "required": [ - "topK" - ] - }, - "QueryResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SingleQueryResults" - }, - "description": "DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`." - }, - "matches": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ScoredVector" - }, - "description": "The matches for the vectors." - }, - "namespace": { - "type": "string", - "description": "The namespace for the vectors." - } - }, - "description": "The response for the `Query` operation. These are the matches found for a particular query vector. The matches are ordered from most similar to least similar." - }, - "QueryVector": { - "type": "object", - "properties": { - "values": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "The query vector values. This should be the same length as the dimension of the index being queried.", - "maxLength": 20000, - "minLength": 1, - "required": [ - "values" - ] - }, - "topK": { - "type": "integer", - "format": "int64", - "example": 10, - "description": "An override for the number of results to return for this query vector.", - "maximum": 10000, - "minimum": 1 - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "An override the namespace to search." - }, - "filter": { - "type": "object", - "example": { - "genre": { - "$in": [ - "comedy", - "documentary", - "drama" - ] - }, - "year": { - "$eq": 2019 - } - }, - "description": "An override for the metadata filter to apply. This replaces the request-level filter." - } - }, - "description": "A single query vector within a `QueryRequest`.", - "required": [ - "values" - ] - }, - "ScoredVector": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "example-vector-1", - "description": "This is the vector's unique id.", - "maxLength": 512, - "minLength": 1, - "required": [ - "id" - ] - }, - "score": { - "type": "number", - "format": "float", - "example": 0.08, - "description": "This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar." - }, - "values": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "This is the vector data, if it is requested." - }, - "metadata": { - "type": "object", - "example": { - "genre": "documentary", - "year": 2019 - }, - "description": "This is the metadata, if it is requested." - } - }, - "required": [ - "id" - ] - }, - "SingleQueryResults": { - "type": "object", - "properties": { - "matches": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ScoredVector" - }, - "description": "The matches for the vectors." - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "The namespace for the vectors." - } - }, - "title": "The query results for a single `QueryVector`" - }, - "UpdateRequest": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "example-vector-1", - "description": "Vector's unique id.", - "maxLength": 512, - "minLength": 1, - "required": [ - "id" - ] - }, - "values": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "Vector data.", - "maxLength": 20000, - "minLength": 1 - }, - "setMetadata": { - "type": "object", - "example": { - "genre": "documentary", - "year": 2019 - }, - "description": "Metadata to *set* for the vector." - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "Namespace name where to update the vector." - } - }, - "description": "The request for the `Upsert` operation.", - "required": [ - "id" - ] - }, - "UpdateResponse": { - "type": "object", - "description": "The response for the `Update` operation." - }, - "UpsertRequest": { - "type": "object", - "properties": { - "vectors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Vector" - }, - "description": "This is the actual array data.", - "maxLength": 1000, - "minLength": 1, - "required": [ - "vectors" - ] - }, - "namespace": { - "type": "string", - "example": "example-namespace", - "description": "This is the namespace name where you upsert vectors." - } - }, - "description": "The request for the `Upsert` operation.", - "required": [ - "vectors" - ] - }, - "UpsertResponse": { - "type": "object", - "properties": { - "upsertedCount": { - "type": "integer", - "format": "int64", - "example": 10, - "description": "The number of vectors upserted." - } - }, - "description": "The response for the `Upsert` operation." - }, - "Vector": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "example-vector-1", - "description": "This is the vector's unique id.", - "maxLength": 512, - "minLength": 1, - "required": [ - "id" - ] - }, - "values": { - "type": "array", - "example": [ - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8 - ], - "items": { - "type": "number", - "format": "float" - }, - "description": "This is the vector data included in the request.", - "maxLength": 20000, - "minLength": 1, - "required": [ - "values" - ] - }, - "metadata": { - "type": "object", - "example": { - "genre": "documentary", - "year": 2019 - }, - "description": "This is the metadata included in the request." - } - }, - "required": [ - "id", - "values" - ] - }, - "protobufAny": { - "type": "object", - "properties": { - "typeUrl": { - "type": "string" - }, - "value": { - "type": "string", - "format": "byte" - } - } - }, - "protobufNullValue": { - "type": "string", - "enum": [ - "NULL_VALUE" - ], - "default": "NULL_VALUE", - "description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value." - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "$ref": "#/components/schemas/protobufAny" - } - } - } - } - } - } -} \ No newline at end of file