+
    i+                       ^ RI Ht ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^RI
Ht ^RIHt  ! R	 R
]4      t ! R R]4      t ! R R]4      t ! R R]4      t] ! R R4      4       t ! R R4      t ! R R]P&                  4      tR# )    )annotationsN)	dataclass)Enum)Optional)Union)types)Floatc                  $    ] tR t^tRtRt RtRtR# )VectorIndexTypezEnum representing different types of VECTOR index structures.

See :ref:`oracle_vector_datatype` for background.

.. versionadded:: 2.0.41

HNSWIVF N)__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes__r       {C:\Users\petid\OneDrive\Desktop\Maestro\MAESTRO\maestro-backend\venv\Lib\site-packages\sqlalchemy/dialects/oracle/vector.pyr   r      s     D Cr   r   c                  0    ] tR t^)tRtRt Rt Rt RtRt	R# )VectorDistanceTypezEnum representing different types of vector distance metrics.

See :ref:`oracle_vector_datatype` for background.

.. versionadded:: 2.0.41

	EUCLIDEANDOTCOSINE	MANHATTANr   N)
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )   s7     I C F Ir   r   c                  0    ] tR t^HtRtRt Rt Rt RtRt	R# )VectorStorageFormatzEnum representing the data format used to store vector components.

See :ref:`oracle_vector_datatype` for background.

.. versionadded:: 2.0.41

INT8BINARYFLOAT32FLOAT64r   N)
r   r   r   r   r   r   r    r!   r"   r   r   r   r   r   r   H   s7     D F G Gr   r   c                  $    ] tR t^ctRtRt RtRtR# )VectorStorageTypezqEnum representing the vector type,

See :ref:`oracle_vector_datatype` for background.

.. versionadded:: 2.0.43

SPARSEDENSEr   N)r   r   r   r   r   r%   r&   r   r   r   r   r$   r$   c   s     F Er   r$   c                      ] tR t^xt$ Rt]P                  tR]R&   Rt	R]R&   Rt
R]R&   RtR]R	&   RtR]R
&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   R tRtR# )VectorIndexConfiga6  Define the configuration for Oracle VECTOR Index.

See :ref:`oracle_vector_datatype` for background.

.. versionadded:: 2.0.41

:param index_type: Enum value from :class:`.VectorIndexType`
 Specifies the indexing method. For HNSW, this must be
 :attr:`.VectorIndexType.HNSW`.

:param distance: Enum value from :class:`.VectorDistanceType`
 specifies the metric for calculating distance between VECTORS.

:param accuracy: integer. Should be in the range 0 to 100
 Specifies the accuracy of the nearest neighbor search during
 query execution.

:param parallel: integer. Specifies degree of parallelism.

:param hnsw_neighbors: integer. Should be in the range 0 to
 2048. Specifies the number of nearest neighbors considered
 during the search. The attribute :attr:`.VectorIndexConfig.hnsw_neighbors`
 is HNSW index specific.

:param hnsw_efconstruction: integer. Should be in the range 0
 to 65535. Controls the trade-off between indexing speed and
 recall quality during index construction. The attribute
 :attr:`.VectorIndexConfig.hnsw_efconstruction` is HNSW index
 specific.

:param ivf_neighbor_partitions: integer. Should be in the range
 0 to 10,000,000. Specifies the number of partitions used to
 divide the dataset. The attribute
 :attr:`.VectorIndexConfig.ivf_neighbor_partitions` is IVF index
 specific.

:param ivf_sample_per_partition: integer. Should be between 1
 and ``num_vectors / neighbor partitions``. Specifies the
 number of samples used per partition. The attribute
 :attr:`.VectorIndexConfig.ivf_sample_per_partition` is IVF index
 specific.

:param ivf_min_vectors_per_partition: integer. From 0 (no trimming)
 to the total number of vectors (results in 1 partition). Specifies
 the minimum number of vectors per partition. The attribute
 :attr:`.VectorIndexConfig.ivf_min_vectors_per_partition`
 is IVF index specific.

r   
index_typeNzOptional[VectorDistanceType]distancezOptional[int]accuracyhnsw_neighborshnsw_efconstructionivf_neighbor_partitionsivf_sample_per_partitionivf_min_vectors_per_partitionparallelc                	    \        V P                  4      V n        R FM  p\        W4      pVf   K  \        V\        4      '       d   K,  \        V R\        V4      P                   24      h	  R# )r,   Nz$ must be an integer ifprovided, got )r,   r-   r.   r/   r0   r1   r+   )r   r)   getattr
isinstanceint	TypeErrortyper   )selffieldvalues   &  r   __post_init__VectorIndexConfig.__post_init__   sh    )$//:
E D(E E3)?)?g %%)%[%9%9$:< 
r   )r)   )r   r   r   r   r   r   r   r)   __annotations__r*   r+   r,   r-   r.   r/   r0   r1   r;   r   r   r   r   r(   r(   x   st    0d #2"6"6J6-1H*1"Hm"$(NM()---1]1.2m237!=7"Hm"r   r(   c                  ,    ] tR t^tRtR R ltR tRtR# )SparseVectorzt
Lightweight SQLAlchemy-side version of SparseVector.
This mimics oracledb.SparseVector.

.. versionadded:: 2.0.43

c               $    V ^8  d   QhRRRRRR/# )   num_dimensionsr5   indiceszUnion[list, array.array]valuesr   )formats   "r   __annotate__SparseVector.__annotate__   s(       * )	r   c                	p   \        V\        P                  4      '       d   VP                  R 8w  d   \        P                  ! R V4      p\        V\        P                  4      '       g   \        P                  ! RV4      p\        V4      \        V4      8w  d   \	        R4      hWn        W n        W0n        R# )Idz.indices and values must be of the same length!N)r4   arraytypecodelenr6   rB   rC   rD   )r8   rB   rC   rD   s   &&&&r   __init__SparseVector.__init__   s     '5;;//73C3Cs3Jkk#w/G&%++..[[f-Fw<3v;&LMM,r   c                	|    R V P                    R\        V P                  4       RV P                  P                   R2# )zSparseVector(num_dimensions=z, size=z, typecode=))rB   rM   rC   rD   rL   )r8   s   &r   __str__SparseVector.__str__   sC    *4+>+>*? @%&k$++2F2F1GqJ	
r   )rC   rB   rD   N)r   r   r   r   r   rN   rR   r   r   r   r   r?   r?      s    "
r   r?   c                      ] tR t^tRtRtR t]P                  R]P                  R]P                  R]P                  R/tRR ltR	 tR
 tR t ! R R]P$                  P&                  4      tRtR# )VECTORzOracle VECTOR datatype.

For complete background on using this type, see
:ref:`oracle_vector_datatype`.

.. versionadded:: 2.0.41

TbBfrJ   Nc                   Ve"   \        V\        4      '       g   \        R4      hVe"   \        V\        4      '       g   \        R4      hVe"   \        V\        4      '       g   \        R4      hWn        W n        W0n        R# )a  Construct a VECTOR.

:param dim: integer. The dimension of the VECTOR datatype. This
 should be an integer value.

:param storage_format: VectorStorageFormat. The VECTOR storage
 type format. This should be Enum values form
 :class:`.VectorStorageFormat` INT8, BINARY, FLOAT32, or FLOAT64.

:param storage_type: VectorStorageType. The Vector storage type. This
 should be Enum values from :class:`.VectorStorageType` SPARSE or
 DENSE.

Nzdim must be an integerz:storage_format must be an enum of type VectorStorageFormatz6storage_type must be an enum of type VectorStorageType)r4   r5   r6   r   r$   dimstorage_formatstorage_type)r8   rZ   r[   r\   s   &&&&r   rN   VECTOR.__init__   s      ?:c3#7#7455%j//
 /
 L  #J+-
 -
 H  ,(r   c                   a a VV 3R lpV# )z
Converts a Python-side SparseVector instance into an
oracledb.SparseVectormor a compatible array format before
binding it to the database.
c                  < V e!   \        V \        P                  4      '       d   V # \        V \        4      '       d4   SP                  SP                  4      p\        P                  ! W4      p V # \        V \
        4      '       d<   SP                  P                  V P                  V P                  V P                  4      # \        R4      h)Nz
                    Invalid input for VECTOR: expected a list, an array.array,
                    or a SparseVector object.
                    )r4   rK   list_array_typecoder[   r?   dbapirB   rC   rD   r6   )r:   rL   dialectr8   s   & r   process.VECTOR._cached_bind_processor.<locals>.process)  s    }
5%++ > > E4((//0C0CDH4 E<00}}11((MMLL    r   r   )r8   rc   rd   s   ff r   _cached_bind_processorVECTOR._cached_bind_processor"  s    	4 r   c                   a V3R lpV# )z
Converts database-returned values into Python-native representations.
If the value is an oracledb.SparseVector, it is converted into the
SQLAlchemy-side SparseVector class.
If the value is a array.array, it is converted to a plain Python list.

c                  < V f   R # \        V \        P                  4      '       d   \        V 4      # \        V SP                  P                  4      '       d-   \	        V P
                  V P                  V P                  R7      # R # )N)rB   rC   rD   )r4   rK   r`   rb   r?   rB   rC   rD   )r:   rc   s   &r   rd   0VECTOR._cached_result_processor.<locals>.processN  sh    }E5;;//E{" E7==#=#=>>##(#7#7!MM <<  ?r   r   )r8   rc   coltyperd   s   &f& r   _cached_result_processorVECTOR._cached_result_processorE  s    	 r   c                :    V P                   P                  VR4      # )z'
Map storage format to array typecode.
rJ   )_typecode_mapget)r8   rL   s   &&r   ra   VECTOR._array_typecode_  s     !!%%h44r   c                  (    ] tR tRtR tR tR tRtR# )VECTOR.comparator_factoryie  c                	<    V P                  R \        R7      ! V4      # )z<->return_typeopr	   r8   others   &&r   l2_distance%VECTOR.comparator_factory.l2_distancef      775e74U;;r   c                	<    V P                  R \        R7      ! V4      # )z<#>ru   rw   ry   s   &&r   inner_product'VECTOR.comparator_factory.inner_producti  r}   r   c                	<    V P                  R \        R7      ! V4      # )z<=>ru   rw   ry   s   &&r   cosine_distance)VECTOR.comparator_factory.cosine_distancel  r}   r   r   N)r   r   r   r   r{   r   r   r   r   r   r   comparator_factoryrs   e  s    	<	<	<r   r   )rZ   r[   r\   )NNN)r   r   r   r   r   cache_ok__visit_name__r   r   r    r!   r"   ro   rN   rf   rl   ra   r   
TypeEngine
Comparatorr   r   r   r   r   rU   rU      s{     HN 	  #""C##S##S	M!)F!F45<U--88 < <r   rU   )
__future__r   rK   dataclassesr   enumr   typingr   r    r   r	   r   r   r   r$   r(   r?   r   rU   r   r   r   <module>r      s    #  !     d & >$ 6 * M M M`
 
BC<U C<r   