
    3iv9                        S SK JrJrJr  S SKrS SKJr  S SKJr	  S SK
Jr  S SKJr  S SKrS SKJrJrJr  S SKJrJrJr  S S	KJr  S S
KJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7  S SK8J9r9  S SK:J;r;J<r<J=r=J>r>  S SK?J@r@  S SKArA/ SQrBS SKCJDrD  \R                  " \F5      rG\" 5       qHSrIS\J4S jrK\K" 5       rLSrM S SKNJOrO  \OrM\M(       d}  S SKQrQ\QR                  S:  ai  \L(       aZ  S SKSrSS SKTrT\SR                  " \TR                  SSSS/5        \W" S5        \TR                  R                  S5      \TR                  S'   O\Z" S5      eS:S jr[S\4S jr\S\\4S\\   S \]S!\]S\4S" jjr^S#S\\4S$\\]\@4   S\\   S \]S!\]S\4
S% jjr_SS\\4S$\\]   S\\   S \]S!\]S\4
S& jjr`S'S(SSS\\4S)\]S*\aS+\JS,\\\]\]4      S\\   S \]S!\]S\4S- jjrbS'S(SSS\\4S)\]S*\aS+\JS,\\\]\]4      S\\   S \]S!\]S\4S. jjrc    S;S/S0S1S2.S \\]   S!\\]   S3\\]   S\\   S4\]S5\aS6\JS\4S7 jjjrd[        \\4S\S \]S!\]S\4S8 jjr\" 5       4S\S\4S9 jjrg! \P a    SrM GNf = f)<    )DictOptionalUnionN)Client)AdminClient)AsyncClient)TokenTransportHeader)DEFAULT_DATABASEDEFAULT_TENANTSettings)AdminAPIAsyncClientAPI	ClientAPI)
Collection)CollectionMetadataUpdateMetadata	DocumentsEmbeddingFunction
EmbeddingsURIURIsIDsIncludeMetadata	MetadatasWhereQueryResult	GetResultWhereDocumentUpdateCollectionMetadataSparseVectorSparseVectorsSparseEmbeddingFunctionSchemaVectorIndexConfigHnswIndexConfigSpannIndexConfigFtsIndexConfigSparseVectorIndexConfigStringInvertedIndexConfigIntInvertedIndexConfigFloatInvertedIndexConfigBoolInvertedIndexConfig)Search)KeyKKnnRrf)Path)$r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r   r	   r.   r/   r0   r1   r2   r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   )CloudClientArgz1.3.0returnc                  .     SS K n g! [         a     gf = f)Nr   TF)google.colabImportError)googles    K/home/james-whalen/.local/lib/python3.13/site-packages/chromadb/__init__.pyis_in_colabr;   p   s     s    
F)is_thin_client)   #   r   z-mpipinstallzpysqlite3-binary	pysqlite3sqlite3z[91mYour system has an unsupported version of sqlite3. Chroma                     requires sqlite3 >= 3.35.0.[0m
[94mPlease visit                     https://docs.trychroma.com/troubleshooting#sqlite to learn how                     to upgrade.[0mc                  D    [         R                  R                  " S0 U D6qg)zGOverride Chroma's default settings, environment variables or .env filesN )chromadbconfigr   
__settings)kwargss    r:   	configurerI      s     ))3F3J    c                      [         $ )N)rG   rD   rJ   r:   get_settingsrL      s    rJ   settingstenantdatabasec                 j    U c
  [        5       n SU l        [        U5      n[        U5      n[        XUS9$ )a)  
Creates an in-memory instance of Chroma. This is useful for testing and
development, but not recommended for production use.

Args:
    tenant: The tenant to use for this client. Defaults to the default tenant.
    database: The database to use for this client. Defaults to the default database.
FrM   rN   rO   )r   is_persistentstrClientCreatorrQ   s      r:   EphemeralClientrU      s:     :"H [F8}H(HMMrJ   z./chromapathc                     Uc
  [        5       n[        U 5      Ul        SUl        [        U5      n[        U5      n[	        X#US9$ )a  
Creates a persistent instance of Chroma that saves to disk. This is useful for
testing and development, but not recommended for production use.

Args:
    path: The directory to save Chroma's data to. Defaults to "./chroma".
    tenant: The tenant to use for this client. Defaults to the default tenant.
    database: The database to use for this client. Defaults to the default database.
TrN   rO   rM   )r   rS   persist_directoryrR   rT   rV   rM   rN   rO   s       r:   PersistentClientr[      sF     :!$TH!H [F8}HHMMrJ   c                     Uc
  [        5       nSUl        U SLUl        U =(       d    SUl        [	        U5      n[	        U5      n[        X#US9$ )a  
Creates an ephemeral or persistance instance of Chroma that saves to disk.
This is useful for testing and development, but not recommended for production use.

Args:
    path: An optional directory to save Chroma's data to. The client is ephemeral if a None value is provided. Defaults to None.
    tenant: The tenant to use for this client. Defaults to the default tenant.
    database: The database to use for this client. Defaults to the default database.
Nz!chromadb.api.rust.RustBindingsAPI rX   )r   chroma_api_implrR   rY   rS   rT   rZ   s       r:   
RustClientr_      sS     :BH!-H!%H [F8}HHMMrJ   	localhosti@  hostportsslheadersc                    Uc
  [        5       n[        U 5      n [        U5      n[        U5      n[        U5      n[        U5      nSUl        UR
                  (       a,  UR
                  U :w  a  [        SUR
                   SU  S35      eXl        UR                  (       a,  UR                  U:w  a  [        SUR                   SU S35      eXl        X$l        X4l	        [        XVUS9$ )a  
Creates a client that connects to a remote Chroma server. This supports
many clients connecting to the same server, and is the recommended way to
use Chroma in production.

Args:
    host: The hostname of the Chroma server. Defaults to "localhost".
    port: The port of the Chroma server. Defaults to 8000.
    ssl: Whether to use SSL to connect to the Chroma server. Defaults to False.
    headers: A dictionary of headers to send to the Chroma server. Defaults to {}.
    settings: A dictionary of settings to communicate with the chroma server.
    tenant: The tenant to use for this client. Defaults to the default tenant.
    database: The database to use for this client. Defaults to the default database.
chromadb.api.fastapi.FastAPI(Chroma server host provided in settings[3] is different to the one provided in HttpClient: []-Chroma server http port provided in settings[rX   )r   rS   intboolr^   chroma_server_host
ValueErrorchroma_server_http_portchroma_server_ssl_enabledchroma_server_headersrT   ra   rb   rc   rd   rM   rN   rO   s          r:   
HttpClientrs      s   0 : t9Dt9D
s)C[F8}H=H""x'B'Bd'J6x7R7R6S  TG  HL  GM  MN  O
 	
 #'''H,L,LPT,T;H<\<\;]  ^Q  RV  QW  WX  Y
 	
 (,$),&%,"HMMrJ   c                   #    Uc
  [        5       n[        U 5      n [        U5      n[        U5      n[        U5      n[        U5      nSUl        UR
                  (       a,  UR
                  U :w  a  [        SUR
                   SU  S35      eXl        UR                  (       a,  UR                  U:w  a  [        SUR                   SU S35      eXl        X$l        X4l	        [        R                  " XVUS9I Sh  vN $  N7f)a  
Creates an async client that connects to a remote Chroma server. This supports
many clients connecting to the same server, and is the recommended way to
use Chroma in production.

Args:
    host: The hostname of the Chroma server. Defaults to "localhost".
    port: The port of the Chroma server. Defaults to 8000.
    ssl: Whether to use SSL to connect to the Chroma server. Defaults to False.
    headers: A dictionary of headers to send to the Chroma server. Defaults to {}.
    settings: A dictionary of settings to communicate with the chroma server.
    tenant: The tenant to use for this client. Defaults to the default tenant.
    database: The database to use for this client. Defaults to the default database.
Nz'chromadb.api.async_fastapi.AsyncFastAPIrg   rh   ri   rj   rX   )r   rS   rk   rl   r^   rm   rn   ro   rp   rq   AsyncClientCreatorcreaterr   s          r:   AsyncHttpClientrw   (  s0    0 : t9Dt9D
s)C[F8}HHH""x'B'Bd'J6x7R7R6S  TG  HL  GM  MN  O
 	
 #'''H,L,LPT,T;H<\<\;]  ^Q  RV  QW  WX  Y
 	
 (,$),&%,"#**8   s   C6C?8C=9C?zapi.trychroma.comi  T)
cloud_host
cloud_port
enable_sslapi_keyrx   ry   rz   c                    [        SSUS9/n[        U Vs/ s H  oR                  PM     sn5      (       dJ  U HD  nUR                  =(       d)    [        R                  R                  UR                  5      Ul        MF     U Vs/ s H  oR                  b  M  UPM     n	nU	(       ac  [        SSR                  U	 Vs/ s H  oR                  PM     sn5       SSR                  U	 Vs/ s H  oR                  PM     sn5       35      eUc
  [        5       nU =(       d    [        R                  R                  S5      n U b  [        U 5      n U=(       d    [        R                  R                  S5      nUb  [        U5      n[        U5      n[        U5      n[        U5      n[        U5      nS	Ul        XCl        XSl        Xcl        S
Ul        X#l        [(        R*                  Ul        SUl        [1        XUS9$ s  snf s  snf s  snf s  snf )a3  
Creates a client to connect to a tenant and database on Chroma cloud.

Args:
    tenant: The tenant to use for this client. Optional. If not provided, it will be inferred from the API key if the key is scoped to a single tenant. If provided, it will be validated against the API key's scope.
    database: The database to use for this client. Optional. If not provided, it will be inferred from the API key if the key is scoped to a single database. If provided, it will be validated against the API key's scope.
    api_key: The api key to use for this client.
r{   CHROMA_API_KEY)nameenv_varvaluezMissing required arguments: z, z8. Please provide them or set the environment variables: CHROMA_TENANTCHROMA_DATABASErf   z1chromadb.auth.token_authn.TokenAuthClientProviderTrX   )r4   allr   osenvirongetr   rn   joinr~   r   rS   rk   rl   r^   rm   ro   rp   chroma_client_auth_providerchroma_client_auth_credentialsr	   X_CHROMA_TOKEN"chroma_auth_token_transport_header;chroma_overwrite_singleton_tenant_database_access_from_authrT   )
rN   rO   r{   rM   rx   ry   rz   required_argsargmissing_argss
             r:   CloudClientr   ]  s   ( 	I/?wOM
 ]3]c		]344 C		@RZZ^^CKK%@CI ! $1F=CIIC=LF*499,5W,3hh,5W+X*Y ZEEIYYgsOtgs`cP[P[gsOtEuDvx
 	

 : 6rzz~~o6FV<2::>>*;<Hx='lGZJZJj!J=H",'1$)3& 	< ( /6+2F2U2UH/KOHHHMMM 4 G 6XOts   G<HH=H)Hc                 B    [        U5      n[        U5      n[        XU S9$ )z
Return a running chroma.API instance

tenant: The tenant to use for this client. Defaults to the default tenant.
database: The database to use for this client. Defaults to the default database.
rX   )rS   rT   rQ   s      r:   r   r     s#     [F8}HHMMrJ   c                     [        U S9$ )zM

Creates an admin client that can be used to create tenants and databases.

rM   )AdminClientCreatorr   s    r:   r   r     s     x00rJ   )r5   N)NNNN)etypingr   r   r   loggingchromadb.api.clientr   rT   r   r   chromadb.api.async_clientr   ru   chromadb.auth.token_authnr	   chromadb.configrE   r
   r   r   chromadb.apir   r   r   chromadb.api.models.Collectionr   chromadb.api.typesr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   "chromadb.execution.expression.planr.   &chromadb.execution.expression.operatorr/   r0   r1   r2   pathlibr3   r   __all__chromadb.typesr4   	getLogger__name__loggerrG   __version__rl   r;   IN_COLAB	is_clientchromadb.is_thin_clientr<   r8   rB   sqlite_version_info
subprocesssys
check_call
executable
__import__modulespopRuntimeErrorrI   rL   rS   rU   r[   r_   rk   rs   rw   r   rD   rJ   r:   <module>r      s    ( (  7 H :  F F < < 5       B 6   	(T *			8	$Z
T  =	6I ""Z/!!ui9KL {#%([[__[%ACKK	"( 4h 
 $( $Nx NN N 	N2 (#' $	N
T	
Nx N N 	N
 N8 #' $	N
3-Nx N N 	N
 N< (,#' $0N
0N
0N 
0N d38n%	0N
 x 0N 0N 0N 0Nh (,#' $2
2
2 
2 d38n%	2
 x 2 2 2 2l !"!#'	>N *>NSM>Nsm>N c]>N x 	>N >N >N >N >ND $ $NNN N 	N& &.Z 1( 1H 1c	  Is   I! !I-,I-