
    q9i                     T    d dl mZmZmZmZ d dlmZ d dlZerd dlm	Z	  G d d      Z
y)    )TYPE_CHECKINGOptionalDictAny)UUIDN)	ServerAPIc                   2   e Zd ZdZdddededededed	eeeef      d
edefdZ	e
defd       Ze
defd       Ze
defd       Ze
defd       Ze
defd       Ze
deeeef      fd       Zed	ee   deeef   fd       ZdefdZdedefdZdefdZy)AttachedFunctionz/Represents a function attached to a collection.clientr   idnamefunction_nameinput_collection_idoutput_collectionparamstenantdatabasec
                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        y)a  Initialize an AttachedFunction.

        Args:
            client: The API client
            id: Unique identifier for this attached function
            name: Name of this attached function instance
            function_name: The function name (e.g., "record_counter", "statistics")
            input_collection_id: ID of the input collection
            output_collection: Name of the output collection
            params: Function-specific parameters
            tenant: The tenant name
            database: The database name
        N)	_client_id_name_function_name_input_collection_id_output_collection_params_tenant	_database)
selfr   r   r   r   r   r   r   r   r   s
             m/var/www/html/leadgen/airagagent/rag_env/lib/python3.12/site-packages/chromadb/api/models/AttachedFunction.py__init__zAttachedFunction.__init__   sF    2 
+$7!"3!    returnc                     | j                   S )z0The unique identifier of this attached function.)r   r   s    r   r   zAttachedFunction.id/   s     xxr!   c                     | j                   S )z,The name of this attached function instance.)r   r$   s    r   r   zAttachedFunction.name4   s     zzr!   c                     | j                   S )zThe function name.)r   r$   s    r   r   zAttachedFunction.function_name9   s     """r!   c                     | j                   S )zThe ID of the input collection.)r   r$   s    r   r   z$AttachedFunction.input_collection_id>   s     (((r!   c                     | j                   S )z"The name of the output collection.)r   r$   s    r   r   z"AttachedFunction.output_collectionC   s     &&&r!   c                     | j                   S )zThe function parameters.)r   r$   s    r   r   zAttachedFunction.paramsH   s     ||r!   c                     | i S t        | t              r.	 | rt        j                  |       ni }t        |t              r|S i S t        | t              r| S i S # t        j
                  $ r i cY S w xY w)zuNormalize params to a consistent dict format.

        Handles None, empty strings, JSON strings, and dicts.
        )
isinstancestrjsonloadsdictJSONDecodeError)r   results     r   _normalize_paramsz"AttachedFunction._normalize_paramsM   su     >Ifc"/5F+2!+FD!9vArA fd#M		 '' 	s   *A A A/.A/c                     d| j                    d| j                   d| j                   d| j                   d| j                   dS )NzAttachedFunction(id=z, name='z', function_name='z', input_collection_id=z, output_collection='z'))r   r   r   r   r   r$   s    r   __repr__zAttachedFunction.__repr___   sW    "488*HTZZL A"112 3##'#<#<"= >""&"9"9!:">	
r!   otherc                    t        |t              sy| j                  | j                        }| j                  |j                        }| j                  |j                  k(  xr | j
                  |j
                  k(  xr | j                  |j                  k(  xrq | j                  |j                  k(  xrV | j                  |j                  k(  xr; ||k(  xr4 | j                  |j                  k(  xr | j                  |j                  k(  S )z2Compare two AttachedFunction objects for equality.F)r+   r
   r2   r   r   r   r   r   r   r   r   )r   r5   self_paramsother_paramss       r   __eq__zAttachedFunction.__eq__g   s    %!12 ,,T\\:--emm< HH		! 2

ekk)2##u';';;2 ))U-G-GG2 ''5+C+CC	2
 |+2 -2 %//1		
r!   c           
      6   | j                  | j                        }|r"t        t        |j	                                     nd}t        | j                  | j                  | j                  | j                  | j                  || j                  | j                  f      S )z$Return hash of the AttachedFunction. )r2   r   tuplesorteditemshashr   r   r   r   r   r   r   )r   normalized_paramsparams_tuples      r   __hash__zAttachedFunction.__hash__{   s     !224<<@8IE&*00234r 	 

##))''	
 	
r!   N)__name__
__module____qualname____doc__r   r,   r   r   r   r    propertyr   r   r   r   r   r   staticmethodr2   r4   objectboolr9   intrB   r;   r!   r   r
   r
   	   sx   9!"!" !" 	!"
 !" "!" !" c3h(!" !" !"F D   c   #s # # )T ) ) '3 ' ' c3h0   (3- DcN  "
# 

F 
t 
(
# 
r!   r
   )typingr   r   r   r   uuidr   r-   chromadb.apir   r
   r;   r!   r   <module>rO      s#    5 5  &E
 E
r!   