
    LKi                         S SK Jr  S SKJrJrJr  S SKJrJrJ	r	J
r
Jr  S SKJr  S SKJr  S SKrS\
S\S	\4S
 jrS\S\S	\
4S jr " S S\5      r\\\   /S4   r " S S\5      rg)    )abstractmethod)CallableOptionalSequence)OperationRecord	LogRecordSeqIdVectorScalarEncoding)	Component)UUIDNvectorencodingreturnc                 F   U[         R                  :X  a1  [        R                  " U [        R                  S9R                  5       $ U[         R                  :X  a1  [        R                  " U [        R                  S9R                  5       $ [        SUR                   35      e)z"Encode a vector into a byte array.dtypeUnsupported encoding: )
r   FLOAT32nparrayfloat32tobytesINT32int32
ValueErrorvaluer   r   s     Z/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/chromadb/ingest/__init__.pyencode_vectorr       st     >)))xxbjj199;;	^))	)xxbhh/77991(..1ABCC    c                    U[         R                  :X  a#  [        R                  " U [        R                  S9$ U[         R
                  :X  a#  [        R                  " U [        R                  S9$ [        SUR                   35      e)z!Decode a byte array into a vectorr   r   )r   r   r   
frombufferr   r   r   r   r   s     r   decode_vectorr$      sb     >)))}}V2::66	^))	)}}V2::661(..1ABCCr!   c                       \ rS rSrSr\S\SS4S j5       r\S\SS4S j5       r\S\S\	S\
4S	 j5       r\S\S
\\	   S\\
   4S j5       r\\S\4S j5       5       rSrg)Producer%   z4Interface for writing embeddings to an ingest streamcollection_idr   Nc                     g )N selfr(   s     r   
delete_logProducer.delete_log(   s    r!   c                     g)zFTruncates the log for the given collection, removing all seen records.Nr*   r+   s     r   	purge_logProducer.purge_log,        	r!   	embeddingc                     g)zVAdd an embedding record to the given collections log. Returns the SeqID of the record.Nr*   )r,   r(   r3   s      r   submit_embeddingProducer.submit_embedding1       
 	r!   
embeddingsc                     g)a  Add a batch of embedding records to the given collections log. Returns the SeqIDs of
the records. The returned SeqIDs will be in the same order as the given
SubmitEmbeddingRecords. However, it is not guaranteed that the SeqIDs will be
processed in the same order as the given SubmitEmbeddingRecords. If the number
of records exceeds the maximum batch size, an exception will be thrown.Nr*   )r,   r(   r8   s      r   submit_embeddingsProducer.submit_embeddings8   s     	r!   c                     g)zaReturn the maximum number of records that can be submitted in a single call
to submit_embeddings.Nr*   r,   s    r   max_batch_sizeProducer.max_batch_sizeC   r7   r!   r*   )__name__
__module____qualname____firstlineno____doc__r   r   r-   r0   r   r	   r5   r   r:   propertyintr>   __static_attributes__r*   r!   r   r&   r&   %   s    >    t    !.=	  !/7/H	%     r!   r&   c                       \ rS rSrSr\   SS\S\S\\	   S\\	   S\\   S	\4S
 jj5       r
\S\S	S4S j5       r\S	\	4S j5       r\S	\	4S j5       rSrg)ConsumerN   z5Interface for reading embeddings off an ingest streamNr(   
consume_fnstartendidr   c                     g)a  Register a function that will be called to receive embeddings for a given
collections log stream. The given function may be called any number of times, with any number of
records, and may be called concurrently.

Only records between start (exclusive) and end (inclusive) SeqIDs will be
returned. If start is None, the first record returned will be the next record
generated, not including those generated before creating the subscription. If
end is None, the consumer will consume indefinitely, otherwise it will
automatically be unsubscribed when the end SeqID is reached.

If the function throws an exception, the function may be called again with the
same or different records.

Takes an optional UUID as a unique subscription ID. If no ID is provided, a new
ID will be generated and returned.Nr*   )r,   r(   rK   rL   rM   rN   s         r   	subscribeConsumer.subscribeQ   s    0 	r!   subscription_idc                     g)zUnregister a subscription. The consume function will no longer be invoked,
and resources associated with the subscription will be released.Nr*   )r,   rR   s     r   unsubscribeConsumer.unsubscribek   s     	r!   c                     g)z9Return the minimum possible SeqID in this implementation.Nr*   r=   s    r   	min_seqidConsumer.min_seqidq   r2   r!   c                     g)z9Return the maximum possible SeqID in this implementation.Nr*   r=   s    r   	max_seqidConsumer.max_seqidv   r2   r!   r*   )NNN)r@   rA   rB   rC   rD   r   r   ConsumerCallbackFnr   r	   rP   rT   rW   rZ   rG   r*   r!   r   rI   rI   N   s    ?
 "&#! ' 	
 e_ TN 
 2 4 D  
 5   5  r!   rI   )abcr   typingr   r   r   chromadb.typesr   r   r	   r
   r   chromadb.configr   uuidr   numpyr   bytesr    r$   r&   r\   rI   r*   r!   r   <module>rd      s     / /  &  D& DN Du DD% D> Df D#y #L x	23T9: +y +r!   