Skip to content

Commit

Permalink
Modify api description (#665)
Browse files Browse the repository at this point in the history
Signed-off-by: yhmo <[email protected]>
  • Loading branch information
yhmo authored Aug 26, 2021
1 parent d5b0ccf commit 9aaee8a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@ def calc_distance(self, vectors_left, vectors_right, params, timeout=30, **kwarg
params = params or {"metric": config.CALC_DIST_METRIC}
if "metric_type" in params.keys():
params["metric"] = params["metric_type"]
params.pop("metric_type")

req = Prepare.calc_distance_request(vectors_left, vectors_right, params)
future = self._stub.CalcDistance.future(req, wait_for_ready=True, timeout=timeout)
Expand Down
17 changes: 10 additions & 7 deletions pymilvus/client/stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,16 +1078,19 @@ def calc_distance(self, vectors_left, vectors_right, params=None, timeout=None,
or
`{"bin_vectors": [b'\x94', b'N', ... b'\xca']}`
:param params: parameters, currently only support "metric_type", default value is "L2"
extra parameter for "L2" distance: "sqrt", true or false, default is false
extra parameter for "HAMMING" and "TANIMOTO": "dim", set this value if dimension is not a multiple of 8, otherwise the dimension will be calculted by list length
:param params: key-value pair parameters
Key: "metric_type"/"metric" Value: "L2"/"IP"/"HAMMING"/"TANIMOTO", default is "L2",
Key: "sqrt" Value: true or false, default is false Only for "L2" distance
Key: "dim" Value: set this value if dimension is not a multiple of 8,
otherwise the dimension will be calculted by list length,
only for "HAMMING" and "TANIMOTO"
:type params: dict
There are examples of supported metric_type:
`{"metric_type": "L2"}`
Examples of supported metric_type:
`{"metric_type": "L2", "sqrt": true}`
`{"metric_type": "IP"}`
`{"metric_type": "HAMMING"}`
`{"metric_type": "HAMMING", "dim": 17}`
`{"metric_type": "TANIMOTO"}`
Note: "L2", "IP", "HAMMING", "TANIMOTO" are case insensitive
Note: metric type are case insensitive
:return: 2-d array distances
:rtype: list[list[int]] for "HAMMING" or list[list[float]] for others
Expand Down
23 changes: 13 additions & 10 deletions pymilvus/orm/pymilvus_orm/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,16 +314,19 @@ def calc_distance(vectors_left, vectors_right, params=None, timeout=None, using=
or
`{"bin_vectors": [b'\x94', b'N', ... b'\xca']}`
:param params: parameters, currently only support "metric_type", default value is "L2"
extra parameter for "L2" distance: "sqrt", true or false, default is false
extra parameter for "HAMMING" and "TANIMOTO": "dim", set this value if dimension is not a multiple of 8, otherwise the dimension will be calculted by list length
:type params: dict
There are examples of supported metric_type:
`{"metric_type": "L2"}`
`{"metric_type": "IP"}`
`{"metric_type": "HAMMING"}`
`{"metric_type": "TANIMOTO"}`
Note: "L2", "IP", "HAMMING", "TANIMOTO" are case insensitive
:param params: key-value pair parameters
Key: "metric_type"/"metric" Value: "L2"/"IP"/"HAMMING"/"TANIMOTO", default is "L2",
Key: "sqrt" Value: true or false, default is false Only for "L2" distance
Key: "dim" Value: set this value if dimension is not a multiple of 8,
otherwise the dimension will be calculted by list length,
only for "HAMMING" and "TANIMOTO"
:type params: dict
Examples of supported metric_type:
`{"metric_type": "L2", "sqrt": true}`
`{"metric_type": "IP"}`
`{"metric_type": "HAMMING", "dim": 17}`
`{"metric_type": "TANIMOTO"}`
Note: metric type are case insensitive
:return: 2-d array distances
:rtype: list[list[int]] for "HAMMING" or list[list[float]] for others
Expand Down

0 comments on commit 9aaee8a

Please sign in to comment.