hyb
2025-11-18 7539e6f48c75dcaeb808359cccfd1c0d0d182ce8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
Ë
 
çúhW4ã
ó"—ddlZddlmZddlmZmZmZmZmZm    Z    ddl
m Z ddl m Z ddlmZddlmZmZmZmZdZd    Zd
Zd Zd Zd ZdZdZdZdZdZeee    eeeeefeeee efffZ!Gd„de«Z"Gd„de«Z#Gd„de«Z$y)éN)ÚEnum)ÚAnyÚ    AwaitableÚDictÚListÚOptionalÚUnion)Ú NEVER_DECODE)Úget_protocol_version)Ú    DataError)ÚCommandsProtocolÚ
EncodableTÚKeyTÚNumberÚVADDÚVSIMÚVREMÚVDIMÚVCARDÚVEMBÚVLINKSÚVINFOÚVSETATTRÚVGETATTRÚ VRANDMEMBERcó—eZdZdZdZdZdZy)ÚQuantizationOptionsz*Quantization options for the VADD command.ÚNOQUANTÚBINÚQ8N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrr ©óõtH:\项目\archive\测试组\脚本\Change_password\venv_build\Lib\site-packages\redis/commands/vectorset/commands.pyrr s„Ù4à€GØ
€CØ     Br&rcó$—eZdZdZdZdZdZdZdZy)ÚCallbacksOptionsz2Options that can be set for the commands callbacksÚRAWÚ
WITHSCORESÚ WITHATTRIBSÚALLOW_DECODINGÚRESP3N)    r!r"r#r$r*r+r,r-r.r%r&r'r)r)(s„Ù<à
€CØ€JØ€KØ%€NØ Er&r)có¢—eZdZdZ                        d"dedeeeefde    de
e de
e de
e d    e
ed
e
eee    fd e
e d eee e ffd „Z                                    d#dedeeeee    fde
e de
e de
e d    e
ede
e    de
e    de
e de
e de
ed eeeeffd„Zded eee e ffd„Zded eee e ffd„Zdede    d eee e ffd„Z    d$dede    de
e d eee
eeeee    effe
eeeee    effffd„Z    d$dede    de
e d eee
eeeee    efeee    efeffe
eeeee    efeee    efeffffd„Zded eeeeffd„Z    d%dede    d
e
eee    fd eee e ffd„Zdede    d ee
eee
effd „Z    d%dede
e d eee
eee    e    fe
eee    e    fffd!„Zy)&ÚVectorSetCommandszRedis VectorSet commandsNÚkeyÚvectorÚelementÚ
reduce_dimÚcasÚ quantizationÚefÚ
attributesÚnumlinksÚreturnc
ó–—|r|s td«‚g}
|r|
jd|g«g} t|t«r| jd|g«n-| jdt    |«g«| j|«|
j| «|
j |«|r|
j d«|r|
j |j «|r|
jd|g«|r;t|t«rtj|«} n|} |
jd| g«|    r|
jd|    g«|jt|g|
¢­ŽS)    a
        Add vector ``vector`` for element ``element`` to a vector set ``key``.
 
        ``reduce_dim`` sets the dimensions to reduce the vector to.
                If not provided, the vector is not reduced.
 
        ``cas`` is a boolean flag that indicates whether to use CAS (check-and-set style)
                when adding the vector. If not provided, CAS is not used.
 
        ``quantization`` sets the quantization type to use.
                If not provided, int8 quantization is used.
                The options are:
                - NOQUANT: No quantization
                - BIN: Binary quantization
                - Q8: Signed 8-bit quantization
 
        ``ef`` sets the exploration factor to use.
                If not provided, the default exploration factor is used.
 
        ``attributes`` is a dictionary or json string that contains the attributes to set for the vector.
                If not provided, no attributes are set.
 
        ``numlinks`` sets the number of links to create for the vector.
                If not provided, the default number of links is used.
 
        For more information, see https://redis.io/commands/vadd.
        z(Both vector and element must be providedÚREDUCEÚFP32ÚVALUESÚCASÚEFÚSETATTRÚM) r ÚextendÚ
isinstanceÚbytesÚlenÚappendÚvalueÚdictÚjsonÚdumpsÚexecute_commandÚVADD_CMD) Úselfr1r2r3r4r5r6r7r8r9ÚpiecesÚ values_piecesÚattributes_jsons              r'ÚvaddzVectorSetCommands.vadd5s#€ñN™WÜÐFÓGÐ GàˆÙ Ø M‰M˜8 ZÐ0Ô 1àˆ Ü fœeÔ $Ø ×  Ñ   &¨&Ð!1Õ 2à ×  Ñ   (¬C°«KÐ!8Ô 9Ø ×  Ñ   Ô (؏ ‰ mÔ$à ‰ gÔá Ø M‰M˜%Ô  á Ø M‰M˜,×,Ñ,Ô -á Ø M‰M˜4 ˜*Ô %á ܘ*¤dÔ+ä"&§*¡*¨ZÓ"8‘à",Ø M‰M˜9 oÐ6Ô 7á Ø M‰M˜3 ˜/Ô *à#ˆt×#Ñ#¤H¨cÐ;°FÒ;Ð;r&ÚinputÚ with_scoresÚ with_attribsÚcountÚfilterÚ    filter_efÚtruthÚ    no_threadÚepsilonc ó’—|s td«‚g} i} t|t«r| jd|g«nQt|t«r.| jdt |«g«| j|«n| jd|g«|s|r”t |j«dvrd| tjj<|r.| jd«d| tjj<|r.| jd«d| tjj<|r| jd    |g«| r| jd
| g«|r| jd |g«|r| jd |g«|r| jd |g«|    r| jd«|
r| jd«|jt|g| ¢­i| ¤ŽS)a'
        Compare a vector or element ``input``  with the other vectors in a vector set ``key``.
 
        ``with_scores`` sets if similarity scores should be returned for each element in the result.
 
        ``with_attribs`` ``with_attribs`` sets if the results should be returned with the
                attributes of the elements in the result, or None when no attributes are present.
 
        ``count`` sets the number of results to return.
 
        ``ef`` sets the exploration factor.
 
        ``filter`` sets the filter that should be applied for the search.
 
        ``filter_ef`` sets the max filtering effort.
 
        ``truth`` when enabled, forces the command to perform a linear scan.
 
        ``no_thread`` when enabled forces the command to execute the search
                on the data structure in the main thread.
 
        ``epsilon`` floating point between 0 and 1, if specified will return
                only elements with distance no further than the specified one.
 
        For more information, see https://redis.io/commands/vsim.
        z'input' should be providedr=r>ÚELE©Ú3éTr+r,ÚCOUNTÚEPSILONr@ÚFILTERz    FILTER-EFÚTRUTHÚNOTHREAD)r rDrErCÚlistrFr Úclientr)r.rHrGr+r,rLÚVSIM_CMD)rNr1rSrTrUrVr7rWrXrYrZr[rOÚoptionss              r'ÚvsimzVectorSetCommands.vsimƒsŒ€ñRÜÐ8Ó9Ð 9àˆØˆä eœUÔ #Ø M‰M˜6 5˜/Õ *Ü ˜œtÔ $Ø M‰M˜8¤S¨£ZÐ0Ô 1Ø M‰M˜%Õ  à M‰M˜5 %˜.Ô )á ™,Ü# D§K¡KÓ0°HÑ<Ø8<Ô(×.Ñ.×4Ñ4Ñ5áØ— ‘ ˜lÔ+Ø=AÔ(×3Ñ3×9Ñ9Ñ:áØ— ‘ ˜mÔ,Ø>BÔ(×4Ñ4×:Ñ:Ñ;á Ø M‰M˜7 EÐ*Ô +á Ø M‰M˜9 gÐ.Ô /á Ø M‰M˜4 ˜*Ô %á Ø M‰M˜8 VÐ,Ô -á Ø M‰M˜;¨    Ð2Ô 3á Ø M‰M˜'Ô "á Ø M‰M˜*Ô %à#ˆt×#Ñ#¤H¨cÐF°FÒF¸gÑFÐFr&có.—|jt|«S)a‰
        Get the dimension of a vector set.
 
        In the case of vectors that were populated using the `REDUCE`
        option, for random projection, the vector set will report the size of
        the projected (reduced) dimension.
 
        Raises `redis.exceptions.ResponseError` if the vector set doesn't exist.
 
        For more information, see https://redis.io/commands/vdim.
        )rLÚVDIM_CMD©rNr1s  r'ÚvdimzVectorSetCommands.vdimÝs€ð×#Ñ#¤H¨cÓ2Ð2r&có.—|jt|«S)zõ
        Get the cardinality(the number of elements) of a vector set with key ``key``.
 
        Raises `redis.exceptions.ResponseError` if the vector set doesn't exist.
 
        For more information, see https://redis.io/commands/vcard.
        )rLÚ    VCARD_CMDrms  r'ÚvcardzVectorSetCommands.vcardës€ð×#Ñ#¤I¨sÓ3Ð3r&có0—|jt||«S)zy
        Remove an element from a vector set.
 
        For more information, see https://redis.io/commands/vrem.
        )rLÚVREM_CMD©rNr1r3s   r'ÚvremzVectorSetCommands.vremõs€ð ×#Ñ#¤H¨c°7Ó;Ð;r&Úrawcó\—i}g}|j||g«t|j«dvrd|tjj
<|rÆ|j d«d|t<t|jd«r#|jjjds9t|jd«r@|jjjdrd|tjj
<d|tjj
<|jtg|¢­i|¤ŽS)a(
        Get the approximated vector of an element ``element`` from vector set ``key``.
 
        ``raw`` is a boolean flag that indicates whether to return the
                internal representation used by the vector.
 
 
        For more information, see https://redis.io/commands/vemb.
        r^Tr*Úconnection_poolÚdecode_responsesÚ nodes_manager)rCr rgr)r.rHrGr
ÚhasattrrxÚconnection_kwargsrzr-r*rLÚVEMB_CMD)rNr1r3rvrirOs      r'ÚvembzVectorSetCommands.vembýsý€ðˆØˆØ ‰ s˜GnÔ%ä  § ¡ Ó ,°Ñ 8Ø48ˆGÔ$×*Ñ*×0Ñ0Ñ 1á Ø M‰M˜%Ô  à$(ˆG”LÑ !䘟 ™ Ð%6Ô7Ø—K‘K×/Ñ/×AÑAÐBTÒU䘟 ™  _Ô5Ø—K‘K×-Ñ-×?Ñ?Ð@RÒSð
BFÔ(×7Ñ7×=Ñ=Ñ>à26ˆGÔ$×(Ñ(×.Ñ.Ñ /à#ˆt×#Ñ#¤HÐA¨vÒA¸ÑAÐAr&cóėi}g}|j||g«|r.|jd«d|tjj<|j
t g|¢­i|¤ŽS)a
        Returns the neighbors for each level the element ``element`` exists in the vector set ``key``.
 
        The result is a list of lists, where each list contains the neighbors for one level.
        If the element does not exist, or if the vector set does not exist, None is returned.
 
        If the ``WITHSCORES`` option is provided, the result is a list of dicts,
        where each dict contains the neighbors for one level, with the scores as values.
 
        For more information, see https://redis.io/commands/vlinks
        r+T)rCrGr)r+rHrLÚ
VLINKS_CMD)rNr1r3rTrirOs      r'ÚvlinkszVectorSetCommands.vlinks'sa€ð*ˆØˆØ ‰ s˜GnÔ%á Ø M‰M˜,Ô 'Ø9=ˆGÔ$×/Ñ/×5Ñ5Ñ 6à#ˆt×#Ñ#¤JÐC°ÒC¸7ÑCÐCr&có.—|jt|«S)zy
        Get information about a vector set.
 
        For more information, see https://redis.io/commands/vinfo.
        )rLÚ    VINFO_CMDrms  r'ÚvinfozVectorSetCommands.vinfoFs€ð ×#Ñ#¤I¨sÓ3Ð3r&cóŒ—|€d}n(t|t«rtj|«}n|}|j    t
|||«S)zÁ
        Associate or remove JSON attributes ``attributes`` of element ``element``
        for vector set ``key``.
 
        For more information, see https://redis.io/commands/vsetattr
        z{})rDrIrJrKrLÚ VSETATTR_CMD)rNr1r3r8rQs     r'ÚvsetattrzVectorSetCommands.vsetattrNsC€ð Ð Ø"‰OÜ ˜
¤DÔ )ä"Ÿj™j¨Ó4‰Oà(ˆOà×#Ñ#¤L°#°wÀÓPÐPr&có0—|jt||«S)a
        Retrieve the JSON attributes of an element ``element `` for vector set ``key``.
 
        If the element does not exist, or if the vector set does not exist, None is
        returned.
 
        For more information, see https://redis.io/commands/vgetattr.
        )rLÚ VGETATTR_CMDrts   r'ÚvgetattrzVectorSetCommands.vgetattras€ð×#Ñ#¤L°#°wÓ?Ð?r&có|—g}|j|«||j|«|jtg|¢­ŽS)a‘
        Returns random elements from a vector set ``key``.
 
        ``count`` is the number of elements to return.
                If ``count`` is not provided, a single element is returned as a single string.
                If ``count`` is positive(smaller than the number of elements
                            in the vector set), the command returns a list with up to ``count``
                            distinct elements from the vector set
                If ``count`` is negative, the command returns a list with ``count`` random elements,
                            potentially with duplicates.
                If ``count`` is greater than the number of elements in the vector set,
                            only the entire set is returned as a list.
 
        If the vector set does not exist, ``None`` is returned.
 
        For more information, see https://redis.io/commands/vrandmember.
        )rGrLÚVRANDMEMBER_CMD)rNr1rVrOs    r'Ú vrandmemberzVectorSetCommands.vrandmemberns?€ð,ˆØ ‰ cÔØ Ð Ø M‰M˜%Ô  Ø#ˆt×#Ñ#¤OÐ=°fÒ=Ð=r&)NFNNNN)    FFNNNNFFN)F)N)r!r"r#r$rr    rÚfloatrEÚstrrÚintÚboolrrrIrrRÚ
VSimResultrjrnrqrurrr~rr„r‡rŠrr%r&r'r0r02ss„Ù"ð%)Ø#Ø6:Ø#Ø15Ø"&ñL<à ðL<ðd˜5‘k 5Ð(Ñ)ðL<ðð    L<ð
˜S‘Mð L<ð d‰^ð L<ðÐ2Ñ3ðL<ð VÑ ðL<ð˜U 4¨ 9Ñ-Ñ.ðL<ð˜3‘-ðL<ð
ˆy˜‰~˜sÐ"Ñ    #óL<ðd',Ø',Ø#Ø#Ø $Ø#'Ø %Ø$)Ø$(ñXGà ðXGðT˜%‘[ %¨Ð,Ñ-ðXGð˜d‘^ð    XGð
˜t‘nð XG𠘉}ð XGð VÑ ðXG𘑠ðXGð˜C‘=ðXGð˜‰~ðXGð˜D‘>ðXGð˜&Ñ!ðXGð
ˆy˜Ñ$ jÐ0Ñ    1óXGðt 3˜ð 3  y°¡~°sÐ':Ñ!;ó 3ð4˜ð4 %¨    °#©¸Ð(;Ñ"<ó4ð<˜ð< sð<¨u°Y¸s±^ÀSÐ5HÑ/Ió<ð>Cñ(BØð(BØ"%ð(BØ,4°T©Nð(Bà    Ø(˜5  jÑ!1°4¸¸Z¸Ñ3HÐ!HÑIÑJÑKؐt˜JÑ'¨¨c°:¨oÑ)>Ð>Ñ?Ñ@ð    Bñ
ó(BðVFKñDØðDØ"%ðDØ4<¸T±NðDà    ØØ ؐU˜4  c¨5 jÑ 1Ñ2°D¸¸sÀE¸zÑ9JÈFÐ9RÑ4SÐSÑTÑUñ ñ    
ð
    e˜D  s¨E zÑ!2Ñ3°T¸%ÀÀUÀ
Ñ:KÈVÐ:SÑ5TÐTÑUÑVÑWð     Yñ
óDð>4˜ð4 %¨    °$©¸Ð(=Ñ">ó4ðQUñQØðQØ"%ðQØ3;¸EÀ$ÈÀ)Ñ<LÑ3MðQà    ˆy˜‰~˜sÐ"Ñ    #óQð& @Øð @Ø"%ð @à    ˆx˜     $™Ñ(¨(°4©.Ð8Ñ    9ó @ð15ñ>Øð>Ø (¨¡ ð>à    Ø(˜5  c¡¨C Ñ0Ñ1Ñ2°H¸UÀ4ÈÁ9ÈcÀ>Ñ=RÑ4SÐSñ
ô>r&r0)%rJÚenumrÚtypingrrrrrr    Ú redis.clientr
Úredis.commands.helpersr Úredis.exceptionsr Ú redis.typingr rrrrMrhrsrlrpr}r€rƒr†r‰rŒrr’rr)r0r%r&r'ú<module>r™sÆðÛ Ýß>×>å%Ý7Ý&ßCÓCà €Ø €Ø €Ø €Ø €    Ø €Ø €
Ø €    Ø€ Ø€ Ø€ðØØ Ø Ñ ˜d :¨vÐ#5Ñ6¸¸ZÈÈcÐSVÈhÉÐ=WÑ8XÐ Xñ    
ññ€
ô˜$ôôtôôV>Ð(õV>r&