Skip to content

Commit 1262a20

Browse files
committed
Review comments addressed
1 parent f947806 commit 1262a20

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

src/coherence/ai.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
class Vector(ABC):
2727
"""
28-
Base class that represents a Vector
28+
Base class that represents a Vector.
2929
30-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
30+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
3131
"""
3232

3333
def __init__(self) -> None:
@@ -40,9 +40,9 @@ def __init__(self) -> None:
4040
@proxy("ai.BitVector")
4141
class BitVector(Vector):
4242
"""
43-
Class that represents a Vector of Bits
43+
Class that represents a Vector of Bits.
4444
45-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
45+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
4646
"""
4747

4848
def __init__(
@@ -52,11 +52,11 @@ def __init__(
5252
int_array: Optional[List[int]] = None,
5353
):
5454
"""
55-
Creates an instance of BitVector
55+
Creates an instance of BitVector.
5656
57-
:param hex_string: hexadecimal string used to create the BitVector
58-
:param byte_array: optional byte array used to create the BitVector
59-
:param int_array: optional int array used to create the BitVector
57+
:param hex_string: hexadecimal string used to create the BitVector.
58+
:param byte_array: optional byte array used to create the BitVector.
59+
:param int_array: optional int array used to create the BitVector.
6060
"""
6161
super().__init__()
6262
if hex_string is not None:
@@ -76,16 +76,16 @@ def __init__(
7676
@proxy("ai.Int8Vector")
7777
class ByteVector(Vector):
7878
"""
79-
Class that represents Vector of bytes
79+
Class that represents Vector of bytes.
8080
81-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
81+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
8282
"""
8383

8484
def __init__(self, byte_array: bytes):
8585
"""
86-
Creates an instance of ByteVector
86+
Creates an instance of ByteVector.
8787
88-
:param byte_array: byte array used to create a ByteVector
88+
:param byte_array: byte array used to create a ByteVector.
8989
"""
9090
super().__init__()
9191
self.array = base64.b64encode(byte_array).decode("UTF-8")
@@ -94,16 +94,16 @@ def __init__(self, byte_array: bytes):
9494
@proxy("ai.Float32Vector")
9595
class FloatVector(Vector):
9696
"""
97-
Class that represents Vector of floats
97+
Class that represents Vector of floats.
9898
99-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
99+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
100100
"""
101101

102102
def __init__(self, float_array: List[float]):
103103
"""
104-
Creates an instance of FloatVector
104+
Creates an instance of FloatVector.
105105
106-
:param float_array: array of floats used to create a FloatVector
106+
:param float_array: array of floats used to create a FloatVector.
107107
"""
108108
super().__init__()
109109
self.array = float_array
@@ -120,7 +120,7 @@ class DocumentChunk(AbstractEvolvable):
120120
"""
121121
Class that represents a chunk of text extracted from a document.
122122
123-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
123+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
124124
"""
125125

126126
def __init__(
@@ -130,11 +130,11 @@ def __init__(
130130
vector: Optional[Vector] = None,
131131
):
132132
"""
133-
Creates an instance of DocumentChunk class
133+
Creates an instance of DocumentChunk class.
134134
135-
:param text: the chunk of text extracted from a document
136-
:param metadata: optional document metadata
137-
:param vector: the vector associated with the document chunk
135+
:param text: the chunk of text extracted from a document.
136+
:param metadata: optional document metadata.
137+
:param vector: the vector associated with the document chunk.
138138
"""
139139
super().__init__()
140140
self.text = text
@@ -192,9 +192,9 @@ def restore(self, obj: Dict[str, Any]) -> DocumentChunk:
192192

193193
class DistanceAlgorithm(ABC):
194194
"""
195-
Base class that represents algorithm that can calculate distance to a given vector
195+
Base class that represents algorithm that can calculate distance to a given vector.
196196
197-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
197+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
198198
"""
199199

200200
def __init__(self) -> None:
@@ -211,7 +211,7 @@ class CosineDistance(DistanceAlgorithm):
211211
roughly the same direction. It is often used to measure document similarity
212212
in text analysis.
213213
214-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
214+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
215215
"""
216216

217217
def __init__(self) -> None:
@@ -224,7 +224,7 @@ class InnerProductDistance(DistanceAlgorithm):
224224
Represents a DistanceAlgorithm that performs inner product distance
225225
calculation between two vectors.
226226
227-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
227+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
228228
"""
229229

230230
def __init__(self) -> None:
@@ -237,7 +237,7 @@ class L2SquaredDistance(DistanceAlgorithm):
237237
Represents a DistanceAlgorithm that performs an L2 squared distance
238238
calculation between two vectors.
239239
240-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
240+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
241241
"""
242242

243243
def __init__(self) -> None:
@@ -249,7 +249,7 @@ class SimilaritySearch(EntryAggregator):
249249
"""
250250
This class represents an aggregator to execute a similarity query.
251251
252-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
252+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
253253
"""
254254

255255
def __init__(
@@ -267,10 +267,10 @@ def __init__(
267267
specified `vector`.
268268
269269
:param extractor_or_property: the ValueExtractor to extract the vector
270-
from the cache value
271-
:param vector: the vector to calculate similarity with
272-
:param max_results: the maximum number of results to return
273-
:param algorithm: the distance algorithm to use
270+
from the cache value.
271+
:param vector: the vector to calculate similarity with.
272+
:param max_results: the maximum number of results to return.
273+
:param algorithm: the distance algorithm to use.
274274
:param filter: filter to use to limit the set of entries to search.
275275
:param brute_force: Force brute force search, ignoring any available indexes.
276276
"""
@@ -284,9 +284,9 @@ def __init__(
284284

285285
class BaseQueryResult(ABC):
286286
"""
287-
A base class for QueryResult implementation
287+
A base class for QueryResult implementation.
288288
289-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
289+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
290290
"""
291291

292292
def __init__(self, result: float, key: K, value: V) -> None:
@@ -298,18 +298,18 @@ def __init__(self, result: float, key: K, value: V) -> None:
298298
@proxy("ai.results.QueryResult")
299299
class QueryResult(BaseQueryResult):
300300
"""
301-
QueryResult class
301+
QueryResult class.
302302
303-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
303+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
304304
"""
305305

306306
def __init__(self, result: float, key: K, value: V) -> None:
307307
"""
308-
Creates an instance of the QueryResult class
308+
Creates an instance of the QueryResult class.
309309
310-
:param result: the query result
311-
:param key: the key of the vector the result applies to
312-
:param value: the optional result value
310+
:param result: the query result.
311+
:param key: the key of the vector the result applies to.
312+
:param value: the optional result value.
313313
"""
314314
super().__init__(result, key, value)
315315

@@ -320,17 +320,17 @@ def __str__(self) -> str:
320320
@proxy("ai.index.BinaryQuantIndex")
321321
class BinaryQuantIndex(AbstractEvolvable):
322322
"""
323-
This class represents a custom index using binary quantization of vectors
323+
This class represents a custom index using binary quantization of vectors.
324324
325-
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side
325+
**NOTE:** This requires using Coherence CE 24.09.2+ on the server side.
326326
"""
327327

328328
def __init__(self, extractor: Union[ValueExtractor[T, E], str], over_sampling_factor: int = 3) -> None:
329329
"""
330-
Creates an instance of BinaryQuantIndex class
330+
Creates an instance of BinaryQuantIndex class.
331331
332-
:param extractor: the ValueExtractor to use to extract the Vector
333-
:param over_sampling_factor: the oversampling factor
332+
:param extractor: the ValueExtractor to use to extract the Vector.
333+
:param over_sampling_factor: the oversampling factor.
334334
"""
335335
super().__init__()
336336
self.extractor = extractor

0 commit comments

Comments
 (0)