
    Ig                        d dl mZmZmZmZmZmZmZmZm	Z	 d dl
Z
d dlZd dlmZmZ d dl
mZmZmZmZ d dlmZmZ d dlmZ d dlmZ d dl
mZmZ d d	lmZ d d
lm Z  d dl!m"Z"m#Z#m$Z$m%Z%m&Z& d dl'm(Z( d dl'm)Z)m*Z*m+Z+m,Z, d dl-m.Z.m/Z/m0Z0m1Z1 d dl2m3Z3 d dl4m5Z5m6Z6m7Z7m8Z8m9Z9 d dl:m;Z; d dl<m=Z= d dl>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZG d dlHmIZI d dlJZJd dlKmLZL d dlMmNZNmOZP d dlQmRZR d dlSmTZT d dlUmVZVmWZW d dlXmYZYmZZZ d dl[m\Z\m]Z]m^Z^m_Z_ d dlUm`Za  eJj                  ec      ZddeddfdZed ed!eegef   defd"Zfd ed!eegef   defd#Zgd ed!eegef   defd$Zh ed%e d&'      Zid(eei   d)edeifd*Zj G d+ d,e
j                        Zl G d- d.e=      Zy)/    )	AnyCallablecastDictSequenceOptionalTypeTypeVarTupleN)	to_threadCapacityLimiter)FastAPIResponseRequestBody)JSONResponseORJSONResponse)CORSMiddleware)APIRoute)HTTPExceptionstatus)CollectionConfigurationInternal)	BaseModel)	Embedding	GetResultQueryResult
Embeddingsconvert_list_embeddings_to_np)UserIdentity)AuthzActionAuthzResourceServerAuthenticationProviderServerAuthorizationProvider)DEFAULT_DATABASEDEFAULT_TENANTSettingsSystem)	ServerAPI)ChromaErrorInvalidDimensionExceptionInvalidHTTPVersionRateLimitError
QuotaError)QuotaEnforcer)Server)	AddEmbeddingCreateDatabaseCreateTenantDeleteEmbeddingGetEmbeddingQueryEmbeddingCreateCollectionUpdateCollectionUpdateEmbedding)Headers)ServerStartEvent)fastapi_json_responsestring_to_uuid)trace)instrument_fastapi)DatabaseTenant)ServerContextProductTelemetryClient)OpenTelemetryClientOpenTelemetryGranularityadd_attributes_to_current_spantrace_method)
Collectionappreturnc                 j    | j                   D ]$  }t        |t              s|j                  |_        & y)z
    Simplify operation IDs so that generated API clients have simpler function
    names.
    Should be called only after all routes have been added.
    N)routes
isinstancer   nameoperation_id)rH   routes     ]/var/www/html/answerous/venv/lib/python3.12/site-packages/chromadb/server/fastapi/__init__.py use_route_names_as_operation_idsrQ   S   s-      ,eX&!&E,    request	call_nextc                    K   t        j                         j                         j                  } ||        d {   }t	        |d      |j
                  d<   |S 7 w)NxzChroma-Trace-Id)r=   get_current_spanget_span_contexttrace_idformatheaders)rS   rT   rY   responses       rP   #add_trace_id_to_response_middlewarer]   ^   sT      %%'88:CCHw''H*03*?H&'O (s   8AA Ac                   K   	  ||        d {   S 7 # t         $ r}t        |      cY d }~S d }~wt        $ r#}t        dt	        |      dd      cY d }~S d }~wt
        $ r#}t        dt	        |      dd      cY d }~S d }~wt        $ r7}t        j                  |       t        dt        |      id      cY d }~S d }~ww xY ww)NInvalidArgumentError)errormessagei  )contentstatus_coder`     )
r)   r;   
ValueErrorr   str	TypeError	Exceptionlogger	exceptionrepr)rS   rT   es      rP   catch_exceptions_middlewarerm   g   s     Iw'''' ($Q'' 
4QH
 	
  
4QH
 	
  IWd1g$6CHHIs   C	  C	 	C
/CC	CACC	C%B=C>C	C,C;C<C	CC	c                    K   | j                   j                  d      }|dvrt        d| d       ||        d {   S 7 w)Nhttp_version)z1.12zHTTP version z is not supported)scopegetr+   )rS   rT   ro   s      rP   check_http_version_middlewarers   }   sJ      ==$$^4L<' =>O!PQQ7####s   :AAADT)boundcontravariantmodeldatac                 f    	 | j                  |      S # t        $ r | j                  |      cY S w xY w)z1Used for backward compatibility with Pydantic 1.x)model_validateAttributeError	parse_obj)rw   rx   s     rP   validate_modelr}      s6    %##D)) %t$$%s    00c                   0     e Zd Zdedededdf fdZ xZS )ChromaAPIRouterpathargskwargsrI   Nc                     d|v xr |d    dt         dt        ffd} ||      |d<   t        |   |g|i | |j	                  d      r|d d }n|dz   } ||      |d<   t        |   |g|i | y )Ninclude_in_schemar   rI   c                 2     xr | j                  d       S )N/)endswith)r   exclude_from_schemas    rP   r   z8ChromaAPIRouter.add_api_route.<locals>.include_in_schema   s    **E4==3E/EErR   r   )rf   boolsuperadd_api_router   )selfr   r   r   r   r   	__class__s        @rP   r   zChromaAPIRouter.add_api_route   s    
  6)M&9L2M.M 		FC 	FD 	F '8&="#d4T4V4==9D#:D&7&="#d4T4V4rR   )__name__
__module____qualname__rf   r   r   __classcell__)r   s   @rP   r   r      s)    5# 5c 5S 5T 5 5rR   r   c                   D   e Zd ZdefdZdldZdldZdej                  fdZ	de
d	edefd
Zdeeef   fdZde
d	edefdZdeeef   fdZdefdZde
ddfdZ edej2                        dededee   dee   dee   ddfd       Z edej2                        de
defd       Z edej2                         e d      fde
dede!ddfd       Z" edej2                        de
dedede#fd       Z$ ed ej2                         e d      fde
de%ddfd!       Z& ed"ej2                        de
dede'fd#       Z( ed$ej2                        	 	 dmde
deded%ee   d&ee   de)e*   fd'       Z+ ed(ej2                        de
dededefd)       Z, ed*ej2                         e d      fde
dedede-de*f
d+       Z. ed,ej2                        de
deded-ede*f
d.       Z/ ed/ej2                         e d      fdeded0ede
de0ddfd1       Z1 ed2ej2                        de
d-edededdf
d3       Z2 ed4ej2                         e d      fde
deded0ede3de4fd5       Z5 ed6ej2                         e d      fde
deded0ede6ddfd7       Z7 ed8ej2                         e d      fde
deded0ede3ddfd9       Z8 ed:ej2                         e d      fd0ededede
de9de:fd;       Z; ed<ej2                         e d      fd0ededede
de<ddfd=       Z= ed>ej2                        de
deded0edef
d?       Z> ed@ej2                        de
de4fdA       Z? edBej2                         e d      fdeded0ede
de@deAfdC       ZBdeeeCf   fdDZDdldEZE edFej2                        dededee   dee   dee   deFee   ee   f   fdG       ZG edHej2                        eH e d      fde
dede!ddfdI       ZI edJej2                        eHfde
dedede#fdK       ZJ edLej2                         e d      fde
de%ddfdM       ZK edNej2                        de
dede'fdO       ZL edPej2                        ddeHeMfde
d%ee   d&ee   dedede)e*   fdQ       ZN edRej2                        eHeMfde
dededefdS       ZO edTej2                        eHeM e d      fde
dedede-de*f
dU       ZP edVej2                        eHeMfde
d-ededede*f
dW       ZQ edXej2                         e d      fd0ede
de0ddfdY       ZR edZej2                        eHeMfde
d-edededdf
d[       ZS ed\ej2                         e d      fde
d0ede3de4fd]       ZT ed^ej2                         e d      fde
d0ede6ddfd_       ZU ed`ej2                         e d      fde
d0ede3ddfda       ZV edbej2                         e d      fd0ede
de9de:fdc       ZW eddej2                         e d      fd0ede
de<ddfde       ZX edfej2                        de
d0edefdg       ZY edhej2                        de
de4fdi       ZZ edjej2                         e d      fd0ede
de@deAfdk       Z[y)nr   settingsc                 X   t         j                  t        _        t	        j
                  dt              | _        t        |      | _	        | j                  j                  t              | _        | j                  j                  t              | _        t!        |j"                        | _        | j                  j                  t&              | _        | j                  j+                           | j                  j-                  d      t.                | j                  j-                  d      t0                | j                  j-                  d      t2               | j                  j5                  t6        dg|j8                  dg       | j                  j;                  t<        | j>                         | j                  j;                  t@        | jB                          | j                  jE                  d      | jF                         d | _$        |jJ                  r$| j                  j                  tL              | _$        d | _'        |jP                  r$| j                  j                  tR              | _'        tU               | _+        | jY                          | j[                          | j                  j]                  | jV                         t_        | j                         ta        | j                         | j                  j                  t              }|jc                  te                      y )NT)debugdefault_response_classhttp*)allow_headersallow_originsallow_methodsshutdown)3rA   FASTAPIrB   SERVER_CONTEXTfastapir   r   _appr'   _systeminstancer(   _apirequirerC   _opentelemetry_clientr   chroma_server_thread_pool_size_capacity_limiterr.   _quota_enforcerstart
middlewarers   rm   r]   add_middlewarer    chroma_server_cors_allow_originsadd_exception_handlerr-   quota_exception_handlerr,   rate_limit_exception_handleron_eventr   authn_providerchroma_server_authn_providerr"   authz_providerchroma_server_authz_providerr#   r   routersetup_v1_routessetup_v2_routesinclude_routerrQ   r>   capturer:   )r   r   telemetry_clients      rP   __init__zFastAPI.__init__   s9   0=0E0E-OO$~V	h'#||44Y?	%)YY%6%67J%K"!033"
  $||33MB$		V$%BC$		V$%@A$		V$%HI		  %"CC%	 	! 	
 			''
D4P4PQ		''D==	
 	'		:&t}}5"00"&,,"6"67S"TD"00"&,,"6"67R"SD%'		  -(3499%<<001GH  !1!34rR   rI   Nc                    | j                   j                  d| j                  dg       | j                   j                  d| j                  dg       | j                   j                  d| j                  dg       | j                   j                  d| j
                  dg       | j                   j                  d| j                  dg       | j                   j                  d	| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgt         j"                  d        | j                   j                  d| j$                  dgd 
       | j                   j                  d| j&                  dgd 
       | j                   j                  d| j(                  dgd 
       | j                   j                  d| j*                  dgd 
       | j                   j                  d| j,                  dgd 
       | j                   j                  d| j.                  dgd 
       | j                   j                  d| j0                  dgd 
       | j                   j                  d| j2                  dgd 
       | j                   j                  d| j4                  dgd 
       y )Nz/api/v2GETmethodsz/api/v2/resetPOSTz/api/v2/versionz/api/v2/heartbeatz/api/v2/pre-flight-checksz/api/v2/auth/identityr   response_modelz"/api/v2/tenants/{tenant}/databasesz2/api/v2/tenants/{tenant}/databases/{database_name}z/api/v2/tenantsz/api/v2/tenants/{tenant}z>/api/v2/tenants/{tenant}/databases/{database_name}/collectionszD/api/v2/tenants/{tenant}/databases/{database_name}/collections_countzR/api/v2/tenants/{tenant}/databases/{database_name}/collections/{collection_id}/addr   rc   r   zU/api/v2/tenants/{tenant}/databases/{database_name}/collections/{collection_id}/updatezU/api/v2/tenants/{tenant}/databases/{database_name}/collections/{collection_id}/upsertzR/api/v2/tenants/{tenant}/databases/{database_name}/collections/{collection_id}/getzU/api/v2/tenants/{tenant}/databases/{database_name}/collections/{collection_id}/deletezT/api/v2/tenants/{tenant}/databases/{database_name}/collections/{collection_id}/countzT/api/v2/tenants/{tenant}/databases/{database_name}/collections/{collection_id}/queryzP/api/v2/tenants/{tenant}/databases/{database_name}/collections/{collection_name}zN/api/v2/tenants/{tenant}/databases/{database_name}/collections/{collection_id}PUTDELETE)r   r   rootresetversion	heartbeatpre_flight_checksget_user_identitycreate_databaseget_databasecreate_tenant
get_tenantlist_collectionscount_collectionscreate_collectionaddr   HTTP_201_CREATEDupdateupsertrr   deletecountget_nearest_neighborsget_collectionupdate_collectiondelete_collectionr   s    rP   r   zFastAPI.setup_v2_routes   s   !!)TYY!H!!/4::x!P!!"3T\\E7!S!!"5t~~PUw!W!!')?)?% 	" 	
 	!!#""G	 	" 	
 	!!0  H	 	" 	
 	!!@G	 	" 	
 	!!H	 	" 	
 	!!&OOG	 	" 	
 	!!L!!G	 	" 	
 	!!R""G	 	" 	
 	!!L""H	 	" 	
 	!!`HHH// 	" 	
 	!!cKKH	 	" 	
 	!!cKKH	 	" 	
 	!!`HHH	 	" 	
 	!!cKKH	 	" 	
 	!!bJJG	 	" 	
 	!!b&&H	 	" 	
 	!!^G	 	" 	
 	!!\""G	 	" 	
 	!!^""J	 	" 	
rR   c                 8    | j                   j                          y N)r   stopr   s    rP   r   zFastAPI.shutdown\  s    rR   c                     | j                   S r   )r   r   s    rP   rH   zFastAPI.app_  s    yyrR   rS   excc                 (   K   t        dddi      S w)N  ra   zRate limit exceeded.rc   rb   )r   r   rS   r   s      rP   r   z$FastAPI.rate_limit_exception_handlerb  s!       67
 	
s   c                 :    d| j                   j                         iS )Nznanosecond heartbeat)r   r   r   s    rP   r   zFastAPI.rootj  s    &		(;(;(=>>rR   c                 D   K   t        dd|j                         i      S w)Nr   ra   r   )r   ra   r   s      rP   r   zFastAPI.quota_exception_handlerm  s&      .
 	
s    c                 *   K   | j                         S wr   )r   r   s    rP   r   zFastAPI.heartbeatu  s     yy{s   c                 >   K   | j                   j                         S wr   )r   get_versionr   s    rP   r   zFastAPI.versionx  s     yy$$&&s   c                 @    | j                   j                  d|i       y)zU
        Set context about the request on any components that might need it.
        rS   )contextN)r   set_contextr   rS   s     rP   _set_request_contextzFastAPI._set_request_context{  s      	(()W1E(FrR   auth_requestr[   actiontenantdatabase
collectionc                    | j                   st        |||d       y| j                   j                  t        |            }| j                  syt        |||      }| j                  j                  |||       t        |||d       y)z
        Authenticates and authorizes the request based on the given headers
        and other parameters. If the request cannot be authenticated or cannot
        be authorized (with the configured providers), raises an HTTP 401.
        r   r   r   N)r   rE   authenticate_or_raisedictr   r!   authorize_or_raise)r   r[   r   r   r   r   user_identityauthz_resources           rP   r   zFastAPI.auth_request  s    " ""*$ (", ++AA$w-P""&!
 	..}fnU& $(	
 	rR   zFastAPI.get_user_identityc                     K    j                   st        dt        t        g      S t	        t        t        j                   fd       d {         S 7 w)N )user_idr   	databasesc                  |    t        t        j                        j                  t	         j
                              S r   )r   r"   r   r   r   r[   )rS   r   s   rP   <lambda>z+FastAPI.get_user_identity.<locals>.<lambda>  s-    94;N;NOeefjkrkzkzf{| rR   )r   r   r%   r$   r   r   run_syncr   s   ``rP   r   zFastAPI.get_user_identity  sW     
 "">>N=O  $$| 
 	
s   A
AA
	AzFastAPI.create_database.bodyc                     K   dt         dt        dt        dd f fd}t        j                  ||j
                  j                          d {    j                         d {    y 7 7 w)Nr   r[   raw_bodyrI   c                    t        t        t        j                  |            }j	                  |t
        j                  | |j                  d        j                         j                  j                  |j                  |       S )NrS   )r}   r1   orjsonloadsr   r    CREATE_DATABASErM   r   r   r   )r   r[   r  dbrS   r   s       rP   process_create_databasez8FastAPI.create_database.<locals>.process_create_database  so      X0FGB++ %%g%699,,RWWf==rR   limiterrf   r9   bytesr   r  r[   r  r   r   rS   r   r  r  s   ``   rP   r   zFastAPI.create_database  ss     	>	>")	>5:	>	>"   #OO,,. **
 	
 	
 !		
s$   AA1A-A1'A/(A1/A1zFastAPI.get_databasedatabase_namec           	        K   | j                  |j                  t        j                  ||d        t	        t
        t        j                  | j                  j                  ||| j                         d {         S 7 wNr  )r   r[   r    GET_DATABASEr   r?   r   r  r   r   r   )r   rS   r  r   s       rP   r   zFastAPI.get_database  su      	OO$$	
 $$		&&..	 
 	
s   A2A?4A=
5	A?zFastAPI.create_tenantc                     K   dt         dt        dd f fd}t        j                  |||j	                          d {    j
                         d {    y 7 7 w)NrS   r  rI   c                    t        t        t        j                  |            }j	                  | j
                  t        j                  |j                  d d        j                  j                  |j                        S r   )r}   r2   r
  r  r   r[   r    CREATE_TENANTrM   r   r   )rS   r  r   r   s      rP   process_create_tenantz4FastAPI.create_tenant.<locals>.process_create_tenant  s^    #L&,,x2HIF)) 99**6;;77rR   r  r   r  r   r  r  r   r   rS   r  r  s   `   rP   r   zFastAPI.create_tenant  sa     	87 	8e 	8 	8   !,,. **	
 	
 	
 !	
!   9AAAAAAzFastAPI.get_tenantc                    K   | j                  |j                  t        j                  |d d        t	        t
        t        j                  | j                  j                  || j                         d {         S 7 wr  )r   r[   r    
GET_TENANTr   r@   r   r  r   r   r   )r   rS   r   s      rP   r   zFastAPI.get_tenant  sr      	OO""	
 $$		$$.. 
 	
s   A1A>3A<
4	A>zFastAPI.list_collectionslimitoffsetc                    K   dt         t           dt         t           dt        dt        dt        t           f
 fd}t        t        t           t        j                  ||||| j                         d {         }|S 7 
w)Nr!  r"  r   r  rI   c                     j                  j                  t        j                  ||d        j	                         t        d|i       j                  j                  ||| |      S )Nr	  r   )r   r   r!  r"  )r   r[   r    LIST_COLLECTIONSr   rE   r   r   )r!  r"  r   r  rS   r   s       rP   process_list_collectionsz:FastAPI.list_collections.<locals>.process_list_collections3  sq     ,, %%g%6*Hf+=>99--U6 .  rR   r  )	r   intrf   r   CollectionModelr   r   r  r   )r   rS   r   r  r!  r"  r&  api_collection_modelss   ``      rP   r   zFastAPI.list_collections*  s     	C=	*23-	AD	UX	o&	$ !%_%$$(.. 
!
 %$s   A4B8B
9BzFastAPI.count_collectionsc           	        K   | j                  |j                  t        j                  ||d        t	        d|i       t        t        t        j                  | j                  j                  ||| j                         d {         S 7 wNr   r  )r   r[   r    COUNT_COLLECTIONSrE   r   r'  r   r  r   r   r   )r   rS   r   r  s       rP   r   zFastAPI.count_collectionsS  s      	OO))	
 	'&'9:$$		++..	 
 	
s   A?BB

	BzFastAPI.create_collectionc                    K   dt         dt        dt        dt        dt        f
 fd}t	        t        t        j                  |||||j                          d {    j                         d {         }|S 7 "7 w)NrS   r   r   r  rI   c                    t        t        t        j                  |            }|j                  s
t               nt        j                  |j                        }j                  | j                  t        j                  |||j                         j                  |        t        d|i       j                  j                  |j                  ||j                   |j"                  ||      S )Nr	  r   rM   configurationmetadataget_or_creater   r   )r}   r6   r
  r  r0  r   	from_jsonr   r[   r    CREATE_COLLECTIONrM   r   rE   r   r   r1  r2  )rS   r   r   r  creater0  r   s         rP   process_create_collectionz<FastAPI.create_collection.<locals>.process_create_collectionv  s     $$4fll86LMF ++ 014>>v?S?ST  -- %%g%6*Hf+=>99..[[+$22! /  rR   r  	r   rf   r  r(  r   r   r  r  r   )r   rS   r   r  r  r6  api_collection_models   `      rP   r   zFastAPI.create_collectionn  s     		&)	58	DI		>  $$$)lln$.. 
 
 $#	 %$   AA?A;A?0A=
1A?=A?zFastAPI.get_collectioncollection_namec           
      "  K   | j                  |j                  t        j                  |||       t	        d|i       t        t        t        j                  | j                  j                  |||| j                         d {         }|S 7 
wr+  )r   r[   r    GET_COLLECTIONrE   r   r(  r   r  r   r   r   )r   rS   r   r  r:  r8  s         rP   r   zFastAPI.get_collection  s      	OO&&	
 	'&'9:#$$		((.. 	 
 $#s   B BB
BzFastAPI.update_collectioncollection_idc                     K   dt         dt        dt        dd f fd}t        j                  ||||j                          d {    j                         d {    y 7 7 w)NrS   r=  r  rI   c                 \   t        t        t        j                  |            }j	                  | j
                  t        j                  |       j                  |        t        di       j                  j                  t        |      |j                  |j                        S )Nr	  r   )idnew_namenew_metadatar   r   )r}   r7   r
  r  r   r[   r    UPDATE_COLLECTIONr   rE   r   _modify_uuidrA  rB  )rS   r=  r  r   r  r   r   s       rP   process_update_collectionz<FastAPI.update_collection.<locals>.process_update_collection  s     $$4fll86LMF-- %%g%6*Hf+=>99$$'#00& %  rR   r  r   rf   r  r   r  r  r   )r   r   r  r=  rS   r  rF  s   ```    rP   r   zFastAPI.update_collection  so     		-0	<A		*   %,,. **
 	
 	
 !		
s$   AA)A%A)A' A)'A)zFastAPI.delete_collectionc                   K   | j                  |j                  t        j                  |||       t	        d|i       t        j                  | j                  j                  |||| j                         d {    y 7 wr+  )
r   r[   r    DELETE_COLLECTIONrE   r   r  r   r   r   )r   rS   r:  r   r  s        rP   r   zFastAPI.delete_collection  su      	OO))	
 	'&'9:  II''**
 	
 	
s   A6B 8A>9B zFastAPI.addc           
      >   K   	 dt         dt        dt        f fd}t        t        t	        j
                  |||j                          d {    j                         d {         S 7  7 
# t        $ r}t        dt        |            d }~ww xY ww)NrS   r  rI   c           
         t        t        t        j                  |            }j	                  | j
                  t        j                         j                  |        t        di       j                  j                  t              |j                  t        t        |j                   rt#        |j                         nd       |j$                  |j&                  |j(                        S Nr	  r   )r=  ids
embeddings	metadatas	documentsurisr   r   )r}   r0   r
  r  r   r[   r    ADDr   rE   r   _addrE  rM  r   r   rN  r   rO  rP  rQ  )rS   r  r   r=  r  r   r   s      rP   process_addz FastAPI.add.<locals>.process_add
  s    $\6<<3IJ!!OOOO!! ))'):.&/AByy~~"'"6#">> 6cnnE!	  "mm!mm!* &  rR   r  rd   rc   detailr   r  r   r   r   r  r  r   r*   r   rf   )r   rS   r   r  r=  r  rT  rl   s   ` ```   rP   r   zFastAPI.add  s     '	@W  $  6 ((!,,.( 22	  
 ) ) 	@CA??	@sM   BA	A6 A2A6 )A4
*A6 1B2A6 4A6 6	B?BBBzFastAPI.updatec                     K   dt         dt        dt        f fd}t        j                  |||j                          d {    j                         d {    y 7 7 w)NrS   r  rI   c           
         t        t        t        j                  |            }j	                  | j
                  t        j                         j                  |        t        di       j                  j                  t              |j                  |j                  rt        |j                        nd |j                   |j"                  |j$                        S rL  )r}   r8   r
  r  r   r[   r    UPDATEr   rE   r   _updaterE  rM  rN  r   rO  rP  rQ  )rS   r  r   r=  r  r   r   s      rP   process_updatez&FastAPI.update.<locals>.process_update:  s    #OV\\(5KLF"" %%g%6*Hf+=>99$$#M2JJ$$ 99J9JK ** **[[& %  rR   r  r   r  r   r   r  r  r   )r   rS   r   r  r=  r  r\  s   ` ```  rP   r   zFastAPI.update1  sf     	G 	u 	 	 	4   ,,. **	
 	
 	
 !	
$   A A(A$A(A&A(&A(zFastAPI.upsertc                     K   dt         dt        dt        f fd}t        j                  |||j                          d {    j                         d {    y 7 7 w)NrS   r  rI   c           
         t        t        t        j                  |            }j	                  | j
                  t        j                         j                  |        t        di       j                  j                  t              |j                  t        t        |j                   rt#        |j                         nd       |j$                  |j&                  |j(                        S rL  )r}   r0   r
  r  r   r[   r    UPSERTr   rE   r   _upsertrE  rM  r   r   rN  r   rO  rP  rQ  )rS   r  r   r=  r  r   r   s      rP   process_upsertz&FastAPI.upsert.<locals>.process_upsertd  s    #L&,,x2HIF"" %%g%6*Hf+=>99$$#M2JJ(( 2&2C2CD	 !** **[[& %  rR   r  r]  )r   rS   r   r  r=  r  rc  s   ` ```  rP   r   zFastAPI.upsert[  sf     	G 	u 	 	 	:   ,,. **	
 	
 	
 !	
r^  zFastAPI.getc           
      j   K   dt         dt        dt        f fd}t        t        t	        j
                  |||j                          d {    j                         d {         }|d   2|d   D cg c]   }t        t        |      j                         " c}|d<   |S 7 Y7 Cc c}w w)NrS   r  rI   c                    t        t        t        j                  |            }j	                  | j
                  t        j                         j                  |        t        di       j                  j                  t              |j                  |j                  |j                  |j                   |j"                  |j$                  |j&                  
      S )Nr	  r   )
r=  rM  wheresortr!  r"  where_documentincluder   r   )r}   r4   r
  r  r   r[   r    r   r   rE   r   _getrE  rM  rf  rg  r!  r"  rh  ri  )rS   r  rr   r=  r  r   r   s      rP   process_getz FastAPI.get.<locals>.process_get  s     v||H/EFC %%g%6*Hf+=>99>>#M2GGiiXXiizz"11& "  rR   r  rN  
r   r  r   r   r   r  r  r   r   tolist)	r   r=  r   r  rS   r  rk  
get_result	embeddings	   ````     rP   rr   zFastAPI.get  s     	 	E 	i 	 	0 $$lln$..	 

 l#/ ",L!9( Y	*113(J|$
  %(s6   A
B3B*B3(B,
)B3=%B."	B3,B3.B3zFastAPI.deletec                     K   dt         dt        dd f fd}t        j                  |||j	                          d {    j
                         d {    y 7 7 w)NrS   r  rI   c                 r   t        t        t        j                  |            }j	                  | j
                  t        j                         j                  |        t        di       j                  j                  t              |j                  |j                  |j                        S )Nr	  r   )r=  rM  rf  rh  r   r   )r}   r3   r
  r  r   r[   r    r   r   rE   r   _deleterE  rM  rf  rh  )rS   r  r   r=  r  r   r   s      rP   process_deletez&FastAPI.delete.<locals>.process_delete  s    #OV\\(5KLF"" %%g%6*Hf+=>99$$#M2JJll%44& %  rR   r  r  )r   r=  r   r  rS   r  rs  s   ````   rP   r   zFastAPI.delete  sf     	G 	u 	 	 	(   ,,. **	
 	
 	
 !	
s#   <A$A A$A"A$"A$zFastAPI.countc           
      0  K   | j                  |j                  t        j                  |||       t	        d|i       t        t        t        j                  | j                  j                  t        |      ||| j                         d {         S 7 wr+  )r   r[   r    COUNTrE   r   r'  r   r  r   _countrE  r   )r   rS   r   r  r=  s        rP   r   zFastAPI.count  s      	OO	
 	'&'9:$$		  m$.. 	
 		
s   B	BB
	BzFastAPI.resetc                    K   | j                  |j                  t        j                  d d d        t	        t
        t        j                  | j                  j                  | j                         d {         S 7 wr  )r   r[   r    RESETr   r   r   r  r   r   r   r   s     rP   r   zFastAPI.reset  sm     
 	OO	
 $$		.. 
 	
   A0A=2A;
3	A=zFastAPI.get_nearest_neighborsc                    K   dt         dt        dt        f fd}t        t        t	        j
                  |||j                          d {    j                         d {         }|d   B|d   D 	cg c].  }|D 	cg c]   }	t        t        |	      j                         " c}	0 c}	}|d<   |S 7 i7 Sc c}	w c c}	}w w)NrS   r  rI   c           
         t        t        t        j                  |            }j	                  | j
                  t        j                         j                  |        t        di       j                  j                  t              t        t        |j                  rt!        |j                        nd       |j"                  |j$                  |j&                  |j(                        S )Nr	  r   )r=  query_embeddings	n_resultsrf  rh  ri  r   r   )r}   r5   r
  r  r   r[   r    QUERYr   rE   r   _queryrE  r   r   r|  r   r}  rf  rh  ri  )rS   r  queryr=  r  r   r   s      rP   process_queryz4FastAPI.get_nearest_neighbors.<locals>.process_query  s    ">6<<3IJE!! %%g%6*Hf+=>99###M2!%-- 2%2H2HI	"  //kk$33& $  rR   r  rN  
r   r  r   r   r   r  r  r   r   rm  )
r   r   r  r=  rS   r  r  nnresultresultro  s
   ````      rP   r   zFastAPI.get_nearest_neighbors  s     	7 	e 	 	 	: $$lln$..	 
 L!- '|4& GMMi+224M&H\"
  % N&sH   A
C	B:C	(B<
)C	>	C%B>,C1
C	<C	>CC	c                     K   dt         t        t        f   f fd}t        t         t        t        f   t	        j
                  | j                         d {         S 7 w)NrI   c                  <    d j                   j                         iS )Nmax_batch_size)r   get_max_batch_sizer   s   rP   process_pre_flight_checksz<FastAPI.pre_flight_checks.<locals>.process_pre_flight_checksI  s     $))">">"@ rR   r  )r   rf   r   r   r   r  r   )r   r  s   ` rP   r   zFastAPI.pre_flight_checksH  sY     	4S> 	
 cN$$).. 
 	
s   AA#A!
	A#c                 P   | j                   j                  d| j                  dg       | j                   j                  d| j                  dg       | j                   j                  d| j                  dg       | j                   j                  d| j
                  dg       | j                   j                  d| j                  dg       | j                   j                  d	| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgd 
       | j                   j                  d| j                  dgt        j                   d        | j                   j                  d| j"                  dgd 
       | j                   j                  d| j$                  dgd 
       | j                   j                  d| j&                  dgd 
       | j                   j                  d| j(                  dgd 
       | j                   j                  d| j*                  dgd 
       | j                   j                  d| j,                  dgd 
       | j                   j                  d| j.                  dgd 
       | j                   j                  d| j0                  dgd 
       | j                   j                  d| j2                  dgd 
       y )Nz/api/v1r   r   z/api/v1/resetr   z/api/v1/versionz/api/v1/heartbeatz/api/v1/pre-flight-checksz/api/v1/databasesr   z/api/v1/databases/{database}z/api/v1/tenantsz/api/v1/tenants/{tenant}z/api/v1/collectionsz/api/v1/count_collectionsz'/api/v1/collections/{collection_id}/addr   z*/api/v1/collections/{collection_id}/updatez*/api/v1/collections/{collection_id}/upsertz'/api/v1/collections/{collection_id}/getz*/api/v1/collections/{collection_id}/deletez)/api/v1/collections/{collection_id}/countz)/api/v1/collections/{collection_id}/queryz%/api/v1/collections/{collection_name}z#/api/v1/collections/{collection_id}r   r   )r   r   r   r   r   r   r   create_database_v1get_database_v1create_tenant_v1get_tenant_v1list_collections_v1count_collections_v1create_collection_v1add_v1r   r   	update_v1	upsert_v1get_v1	delete_v1count_v1get_nearest_neighbors_v1get_collection_v1update_collection_v1delete_collection_v1r   s    rP   r   zFastAPI.setup_v1_routesY  s   !!)TYY!H!!/4::x!P!!"3T\\E7!S!!"5t~~PUw!W!!')?)?% 	" 	
 	!!##H	 	" 	
 	!!*  G	 	" 	
 	!!!!H	 	" 	
 	!!&G	 	" 	
 	!!!$$G	 	" 	
 	!!'%%G	 	" 	
 	!!!%%H	 	" 	
 	!!5KKH// 	" 	
 	!!8NNH	 	" 	
 	!!8NNH	 	" 	
 	!!5KKH	 	" 	
 	!!8NNH	 	" 	
 	!!7MMG	 	" 	
 	!!7))H	 	" 	
 	!!3""G	 	" 	
 	!!1%%G	 	" 	
 	!!3%%J	 	" 	
rR   /auth_and_get_tenant_and_database_for_request_v1c                    | j                   st        |||d       ||fS | j                   j                  t        |            }| j                   j	                  |      \  }}|r	|t
        k(  r|r|}|r	|t        k(  r|r|}| j                  s||fS t        |||      }	| j                  j                  |||	       t        |||d       ||fS )a  
        Authenticates and authorizes the request based on the given headers
        and other parameters. If the request cannot be authenticated or cannot
        be authorized (with the configured providers), raises an HTTP 401.

        If the request is authenticated and authorized, returns the tenant and
        database to be used for the request. These will differ from the passed
        tenant and database if and only if:
        - The request is authenticated
        - chroma_overwrite_singleton_tenant_database_access_from_auth = True
        - The passed tenant or database are None or default_{tenant, database}
            (can be overwritten separately)
        - The user has access to a single tenant and/or single database.
        r   )
r   rE   r   r   'singleton_tenant_database_if_applicabler%   r$   r   r!   r   )
r   r[   r   r   r   r   r   
new_tenantnew_databaser   s
             rP   ,auth_and_get_tenant_and_database_for_requestz4FastAPI.auth_and_get_tenant_and_database_for_request  s    4 ""*$ (", H%%++AA$w-P
 GGV	
 &N2
FH(88l#H""H%%&!
 	..}fnU& $(	
 !!rR   zFastAPI.create_database_v1c                     K   dt         dt        dt        dd f fd}t        j                  |||j
                  |j                          d {    j                         d {    y 7 7 w)Nr   r[   r  rI   c                    t        t        t        j                  |            }j	                  |t
        j                  | |j                  d       \  }}|r|} |r||_        j                  j                  |j                  |       S r   )
r}   r1   r
  r  r  r    r  rM   r   r   )r   r[   r  r  maybe_tenantmaybe_databaser   s         rP   r  z;FastAPI.create_database_v1.<locals>.process_create_database  s}      X0FGB
 AA++ %(99,,RWWf==rR   r  r  r  s   `    rP   r  zFastAPI.create_database_v1  ss     	>	>")	>5:	>	>,   #OO,,. **
 	
 	
 !		
s$   A
A/A+A/%A-&A/-A/zFastAPI.get_database_v1c           	        K   | j                  |j                  t        j                  ||d       \  }}|r|}|r|}t	        t
        t        j                  | j                  j                  ||| j                         d {         S 7 wr  )r  r[   r    r  r   r?   r   r  r   r   r   )r   rS   r   r   r  r  s         rP   r  zFastAPI.get_database_v17  s      ==OO$$
	
 !F%H$$		&&..	 
 	
   A=B
?B
 	B
zFastAPI.create_tenant_v1c                     K   dt         dt        dd f fd}t        j                  |||j	                          d {    j
                         d {    y 7 7 w)NrS   r  rI   c                    t        t        t        j                  |            }j	                  | j
                  t        j                  |j                  d d       \  }}|r||_        j                  j                  |j                        S r   )r}   r2   r
  r  r  r[   r    r  rM   r   r   )rS   r  r   r  _r   s        rP   r  z7FastAPI.create_tenant_v1.<locals>.process_create_tenant[  sn    #L&,,x2HIF"OO))OL! *99**6;;77rR   r  r  r  s   `   rP   r  zFastAPI.create_tenant_v1W  sa     	87 	8e 	8 	8   !,,. **	
 	
 	
 !	
r  zFastAPI.get_tenant_v1c                   K   | j                  |j                  t        j                  |d d       \  }}|r|}t	        t
        t        j                  | j                  j                  || j                         d {         S 7 wr  )r  r[   r    r   r   r@   r   r  r   r   r   )r   rS   r   r  r  s        rP   r  zFastAPI.get_tenant_v1q  s      KKOO""
a !F$$		$$.. 
 	
s   A8B:B
;	BzFastAPI.list_collections_v1c                 .  K   | j                  |j                  t        j                  ||d       \  }}|r|}|r|}t	        t
        t           t        j                  | j                  j                  ||||| j                         d {         }|S 7 
wr  )r  r[   r    r%  r   r   r(  r   r  r   r   r   )	r   rS   r!  r"  r   r   r  r  r)  s	            rP   r  zFastAPI.list_collections_v1  s      ==OO((
	
 !F%H $_%$$		**.. 
!
 %$s   BBB
	BzFastAPI.count_collections_v1c           	        K   | j                  |j                  t        j                  ||d       \  }}|r|}|r|}t	        t
        t        j                  | j                  j                  ||| j                         d {         S 7 wr  )r  r[   r    r,  r   r'  r   r  r   r   r   )r   rS   r   r   r  r  s         rP   r  zFastAPI.count_collections_v1  s      ==OO))
	
 !F%H$$		++..	 
 	
r  zFastAPI.create_collection_v1c                    K   dt         dt        dt        dt        dt        f
 fd}t	        t        t        j                  |||||j                          d {    j                         d {         }|S 7 "7 w)NrS   r   r   r  rI   c                    t        t        t        j                  |            }|j                  s
t               nt        j                  |j                        }j                  | j                  t        j                  |||j                        \  }}|r|}|r|}j                  j                  |j                  ||j                  |j                  ||      S )Nr/  )r}   r6   r
  r  r0  r   r3  r  r[   r    r4  rM   r   r   r1  r2  )	rS   r   r   r  r5  r0  r  r  r   s	           rP   r6  z?FastAPI.create_collection_v1.<locals>.process_create_collection  s     $$4fll86LMF ++ 014>>v?S?ST  AA-- %)99..[[+$22! /  rR   r  r7  )r   rS   r   r   r  r6  r8  s   `      rP   r  zFastAPI.create_collection_v1  s      	 	&) 	58 	DI 	 	D  $$$)lln$.. 
 
 $#	 %r9  zFastAPI.get_collection_v1c           
        K   | j                  |j                  t        j                  |||      \  }}|r|}|r|}t	        t
        t        j                  | j                  j                  |||| j                         d {         }|S 7 
wr  )r  r[   r    r<  r   r(  r   r  r   r   r   )r   rS   r:  r   r   r  r  r8  s           rP   r  zFastAPI.get_collection_v1  s      ==OO&&
	
 !F%H#$$		((.. 	 
 $#s   A>B B
BzFastAPI.update_collection_v1c                     K   dt         dt        dt        dd f fd}t        j                  ||||j                          d {    j                         d {    y 7 7 w)NrS   r=  r  rI   c                    t        t        t        j                  |            }j	                  | j
                  t        j                  d d |       j                  j                  t        |      |j                  |j                        S )N)r@  rA  rB  )r}   r7   r
  r  r  r[   r    rC  r   rD  rE  rA  rB  )rS   r=  r  r   r   s       rP   rF  z?FastAPI.update_collection_v1.<locals>.process_update_collection.  sx     $$4fll86LMF==-- 99$$'#00 %  rR   r  rG  )r   r=  rS   r  rF  s   `    rP   r  zFastAPI.update_collection_v1*  so     		-0	<A		"   %,,. **
 	
 	
 !		
s$   A A%A!A%A#A%#A%zFastAPI.delete_collection_v1c                    K   | j                  |j                  t        j                  |||      \  }}|r|}|r|}t	        j
                  | j                  j                  |||| j                         d {    y 7 wr  )	r  r[   r    rI  r   r  r   r   r   )r   rS   r:  r   r   r  r  s          rP   r  zFastAPI.delete_collection_v1G  s      ==OO))
	
 !F%H  II''**
 	
 	
s   A4A>6A<7A>zFastAPI.add_v1c           
      6   K   	 dt         dt        dt        f fd}t        t        t	        j
                  |||j                          d {    j                         d {         S 7  7 
# t        $ r}t        dt        |            d }~ww xY ww)NrS   r  rI   c           
         t        t        t        j                  |            }j	                  | j
                  t        j                  d d        j                  j                  t              |j                  t        t        |j                  rt        |j                        nd       |j                   |j"                  |j$                        S N)r=  rM  rN  rO  rP  rQ  )r}   r0   r
  r  r  r[   r    rR  r   rS  rE  rM  r   r   rN  r   rO  rP  rQ  )rS   r  r   r=  r   s      rP   rT  z#FastAPI.add_v1.<locals>.process_addl  s    $\6<<3IJAAOOOO! yy~~"'"6#">> 6cnnE!	  "mm!mm &  rR   r  rd   rU  rW  )r   rS   r=  r  rT  rl   s   ` `   rP   r  zFastAPI.add_v1f  s     #	@W  $ . ((!,,.( 22	  
 ) ) 	@CA??	@sM   BAA2 A.A2 %A0
&A2 -B.A2 0A2 2	B;BBBzFastAPI.update_v1c                     K   dt         dt        dt        f fd}t        j                  |||j                          d {    j                         d {    y 7 7 w)NrS   r  rI   c                    t        t        t        j                  |            }j	                  | j
                  t        j                  d d        j                  j                  t              |j                  |j                  rt        |j                        nd |j                  |j                  |j                         S r  )r}   r8   r
  r  r  r[   r    rZ  r   r[  rE  rM  rN  r   rO  rP  rQ  )rS   r  r   r=  r   s      rP   r\  z)FastAPI.update_v1.<locals>.process_update  s    #OV\\(5KLF=="" 99$$#M2JJ$$ 99J9JK ** **[[ % 	 	rR   r  r]  )r   rS   r=  r  r\  s   ` `  rP   r  zFastAPI.update_v1  sa     	G 	u 	 	,   ,,. **	
 	
 	
 !	
#   >A$A A$A"A$"A$zFastAPI.upsert_v1c                     K   dt         dt        dt        f fd}t        j                  |||j                          d {    j                         d {    y 7 7 w)NrS   r  rI   c           
         t        t        t        j                  |            }j	                  | j
                  t        j                  d d        j                  j                  t              |j                  t        t        |j                  rt        |j                        nd       |j                   |j"                  |j$                        S r  )r}   r0   r
  r  r  r[   r    ra  r   rb  rE  rM  r   r   rN  r   rO  rP  rQ  )rS   r  r   r=  r   s      rP   rc  z)FastAPI.upsert_v1.<locals>.process_upsert  s    #L&,,x2HIF=="" 99$$#M2JJ(( 2&2C2CD	 !** **[[ %  rR   r  r]  )r   rS   r=  r  rc  s   ` `  rP   r  zFastAPI.upsert_v1  sa     	G 	u 	 	2   ,,. **	
 	
 	
 !	
r  zFastAPI.get_v1c           
      b   K   dt         dt        dt        f fd}t        t        t	        j
                  |||j                          d {    j                         d {         }|d   2|d   D cg c]   }t        t        |      j                         " c}|d<   |S 7 Y7 Cc c}w w)NrS   r  rI   c           
         t        t        t        j                  |            }j	                  | j
                  t        j                  d d        j                  j                  t              |j                  |j                  |j                  |j                  |j                  |j                   |j"                        S )N)r=  rM  rf  rg  r!  r"  rh  ri  )r}   r4   r
  r  r  r[   r    r   r   rj  rE  rM  rf  rg  r!  r"  rh  ri  )rS   r  rr   r=  r   s      rP   rk  z#FastAPI.get_v1.<locals>.process_get  s     v||H/EFC== 99>>#M2GGiiXXiizz"11 " 	 	rR   r  rN  rl  )r   r=  rS   r  rk  rn  ro  s   ``     rP   r  zFastAPI.get_v1  s     	 	E 	i 	( $$lln$..	 

 l#/ ",L!9( Y	*113(J|$
  %(s6   AB/B&B/$B(
%B/9%B*	B/(B/*B/zFastAPI.delete_v1c                     K   dt         dt        dd f fd}t        j                  |||j	                          d {    j
                         d {    y 7 7 w)NrS   r  rI   c                 0   t        t        t        j                  |            }j	                  | j
                  t        j                  d d        j                  j                  t              |j                  |j                  |j                        S )N)r=  rM  rf  rh  )r}   r3   r
  r  r  r[   r    r   r   rr  rE  rM  rf  rh  )rS   r  r   r=  r   s      rP   rs  z)FastAPI.delete_v1.<locals>.process_delete  s|    #OV\\(5KLF=="" 99$$#M2JJll%44	 %  rR   r  r  )r   r=  rS   r  rs  s   ``   rP   r  zFastAPI.delete_v1  sa     	G 	u 	 	    ,,. **	
 	
 	
 !	
s!   :A AA AA A zFastAPI.count_v1c           	        K   | j                  |j                  t        j                  d d |       t	        t
        t        j                  | j                  j                  t        |      | j                         d {         S 7 wr  )r  r[   r    ru  r   r'  r   r  r   rv  rE  r   )r   rS   r=  s      rP   r  zFastAPI.count_v1  sw      	99OO	
 $$		  m$.. 
 	
s   A:B<B
=	BzFastAPI.reset_v1c                    K   | j                  |j                  t        j                  d d d        t	        t
        t        j                  | j                  j                  | j                         d {         S 7 wr  )r  r[   r    rx  r   r   r   r  r   r   r   r   s     rP   reset_v1zFastAPI.reset_v10  sm     
 	99OO	
 $$		.. 
 	
ry  z FastAPI.get_nearest_neighbors_v1c                    K   dt         dt        dt        f fd}t        t        t	        j
                  |||j                          d {    j                         d {         }|d   B|d   D cg c].  }|D cg c]   }t        t        |      j                         " c}0 c}}|d<   |S 7 i7 Sc c}w c c}}w w)NrS   r  rI   c           	         t        t        t        j                  |            }j	                  | j
                  t        j                  d d        j                  j                  t              t        t        |j                  rt        |j                        nd       |j                  |j                   |j"                  |j$                        S )N)r=  r|  r}  rf  rh  ri  )r}   r5   r
  r  r  r[   r    r~  r   r  rE  r   r   r|  r   r}  rf  rh  ri  )rS   r  r  r=  r   s      rP   r  z7FastAPI.get_nearest_neighbors_v1.<locals>.process_queryN  s    ">6<<3IJE==!! 99###M2!%-- 2%2H2HI	"  //kk$33 $  rR   r  rN  r  )r   r=  rS   r  r  r  r  ro  s   ``      rP   r  z FastAPI.get_nearest_neighbors_v1E  s     	7 	e 	 	2 $$lln$..	 
 L!- '|4& GMMi+224M&H\"
  % N&sH   ACB6C$B8
%C:	B?%B:(B?-
C8C:B??C)rI   N)NN)\r   r   r   r&   r   r   r   r   r   rH   r   r,   r   r   r   rf   r'  r   r-   r   r   r   r   rF   rD   	OPERATIONr9   r    r   r   r   r   r   r1   r   r?   r   r2   r   r@   r   r   r(  r   r   r6   r   r   r7   r   r   r0   r   r   r8   r   r   r4   r   rr   r3   r   r   r   r5   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   rR   rP   r   r      s   /5 /5b{
zW__ 

%3
	
?d38n ?

%/
	
c3h 's 'GG G G  **** * 	*
 3-* SM* 
*	*X -/G/Q/QR

 

 S
  +-E-O-OP
  $Cy	

 
 	

 

 Q
> (*B*L*LM

 
 	

 

 N
0 )+C+M+MN59#Y

&2
	
 O
. &(@(J(JK

 
 
	
 L
, ,.F.P.PQ  $ $&%&% &% 	&%
 }&% &% 
/	"&% R&%P -/G/Q/QR

 
 	

 

 S
4 -/G/Q/QR "&c1$1$ 1$ 	1$
 1$ 
1$ S1$f *,D,N,NO$$ $ 	$
 $ 
$ P$: -/G/Q/QR "&c#
#
 #
 	#

 #
 #
 
#
 S#
J -/G/Q/QR

 
 	

 
 

 S
0 -!9!C!CD "#Y/@/@ /@ 	/@
 /@ /@ 
/@ E/@b "$<$F$FG !%S	'
'
 '
 	'

 '
 '
 
'
 H'
R "$<$F$FG "#Y*
*
 *
 	*

 *
 *
 
*
 H*
X -!9!C!CD "#Y00 0 	0
 0 0 
0 E0d "$<$F$FG !%S	!
!
 !
 	!

 !
 !
 
!
 H!
F /#;#E#EF

 
 	

 
 

 G
6 /#;#E#EF

 

 G
( 13K3U3UV  $Cy55 5 	5
 5 5 
5 W5n
c3h 
"t
l 9 **="=" =" 	="
 3-=" SM=" 
x}hsm+	,="	="~ .0H0R0RS %#Cy	"
"
 "
 	"

 
"
 T"
H +-E-O-OP
 %	

 
 	

 

 Q
> ,.F.P.PQ59#Y

&2
	
 R
2 )+C+M+MN

 
 
	
 O
0 /1I1S1ST  $ $$(#%#% }#% 	#%
 #% #% 
/	"#% U#%J 02J2T2TU %(	

 
 	

 

 V
> 02J2T2TU %(!%c4$4$ 4$ 	4$
 4$ 
4$ V4$l -/G/Q/QR
 %( $ $  $ 	 $
  $ 
 $ S $D 02J2T2TUMQRUY
 
+2
:J
	
 V
8 02J2T2TU
 %(

 
 	

 
 

 V
< "$<$F$FGIMc&@&@/2&@:F&@	&@ H&@P %'?'I'IJLPQTI

/2
:I
	
 K
@ %'?'I'IJIMc!
!
/2!
:F!
	!
 K!
F "$<$F$FGIMc' '+2':F'	' H'R %'?'I'IJLPQTI
 
+2
:I
	
 K
4 $&>&H&HI

 
 
	
 J
, $&>&H&HI

 

 J
( *,D,N,N  $Cy	// / 	/
 
//rR   r   )mtypingr   r   r   r   r   r   r	   r
   r   r   r
  anyior   r   r   _FastAPIr   r   r   fastapi.responsesr   r   fastapi.middleware.corsr   fastapi.routingr   r   r   chromadb.api.configurationr   pydanticr   chromadb.api.typesr   r   r   r   r   chromadb.authr   r    r!   r"   r#   chromadb.configr$   r%   r&   r'   chromadb.apir(   chromadb.errorsr)   r*   r+   r,   r-   chromadb.quotar.   chromadb.serverr/   chromadb.server.fastapi.typesr0   r1   r2   r3   r4   r5   r6   r7   r8   starlette.datastructuresr9   logging!chromadb.telemetry.product.eventsr:   chromadb.utils.fastapir;   r<   rE  opentelemetryr=   (chromadb.telemetry.opentelemetry.fastapir>   chromadb.typesr?   r@   chromadb.telemetry.productrA   rB    chromadb.telemetry.opentelemetryrC   rD   rE   rF   rG   r(  	getLoggerr   ri   rQ   r]   rm   rs   rt   r}   	APIRouterr   r  rR   rP   <module>r     s  
 
 
   A @ : 2 $ ) F   '  O N "  ) "
 
 
 -  > Q  G + L  9			8	$,( ,t ,!)7)S.!9II!)7)S.!9II,$$!)7)S.!9$$ Cy5%$q' % % %5g'' 58Jf JrR   