
    3i
                        % S SK r S SKrS SKJrJrJr  S SKrS SKJr  \R                  R                  \R                  R                  \R                  R                  \R                  R                  \R                  R                  \R                  R                  \5      5      5      5      5      SS5      r0 r\\\\\4   4   \S'   S\S\\\4   4S	 jrS
\\\4   S\SS4S jrS\S\4S jrg)    N)DictAnycast)ValidationErrorschemasembedding_functionscached_schemasschema_namereturnc                 <   U [         ;   a	  [         U    $ [        R                  R                  [        U  S35      n[        US5       n[        [        [        [        4   [        R                  " U5      5      nU[         U '   UsSSS5        $ ! , (       d  f       g= f)a+  
Load a JSON schema from the schemas directory.

Args:
    schema_name: Name of the schema file (without .json extension)

Returns:
    The loaded schema as a dictionary

Raises:
    FileNotFoundError: If the schema file does not exist
    json.JSONDecodeError: If the schema file is not valid JSON
z.jsonrN)r	   ospathjoinSCHEMAS_DIRopenr   r   strr   jsonload)r
   schema_pathfschemas       q/home/james-whalen/.local/lib/python3.13/site-packages/chromadb/utils/embedding_functions/schemas/schema_utils.pyload_schemar      ss     n$k**'',,{{m5,ABK	k3	1d38ndiil3&,{# 
 		s   <B
Bconfigc                    [        U5      n [        R                  " XS9  g! [         aU  nSR	                  S UR
                   5       5      nSU SUR                   3nU(       a	  USU S3-  n[        U5      UeSnAff = f)	aa  
Validate a configuration against a schema.

Args:
    config: Configuration to validate
    schema_name: Name of the schema file (without .json extension)

Raises:
    ValidationError: If the configuration does not match the schema
    FileNotFoundError: If the schema file does not exist
    json.JSONDecodeError: If the schema file is not valid JSON
)instancer   /c              3   8   #    U  H  n[        U5      v   M     g 7f)N)r   ).0r   s     r   	<genexpr>)validate_config_schema.<locals>.<genexpr><   s     ;FDc$iiFs   z%Config validation failed for schema 'z': z
 at path ''N)r   
jsonschemavalidater   r   r   message)r   r
   r   e
error_patherror_messages         r   validate_config_schemar*   *   s     %F
4V; 4XX;AFF;;
3K=AII;O 	 z*Q77Mm,!34s   " 
BAA<<Bc                 X    [        U 5      n[        [        UR                  SS5      5      $ )aJ  
Get the version of a schema.

Args:
    schema_name: Name of the schema file (without .json extension)

Returns:
    The schema version as a string

Raises:
    FileNotFoundError: If the schema file does not exist
    json.JSONDecodeError: If the schema file is not valid JSON
    KeyError: If the schema does not have a version
versionz1.0.0)r   r   r   get)r
   r   s     r   get_schema_versionr.   E   s&     %FVZZ	7344    )r   r   typingr   r   r   r$   r   r   r   dirname__file__r   r	   r   __annotations__r   r*   r.    r/   r   <module>r5      s     	 " "  & ggllGGOO
8Q(RST  -/S$sCx.() .S T#s(^ .44S> 4 4 465C 5C 5r/   