+
    Ԙj	                       ^ RI Ht ^ RIt^ RIHt ^ RIHt ^ RIHtH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHtHt ^ RIHtHt ^ RIHt ^ RIHt ]P<                  ! ]P>                  RR7       ]P@                  ! R4      t!]! ]"4      PG                  4       PH                  PH                  R,          t%]R R l4       t&]! RR]&R7      t']'PQ                  ]RR.RR.R.R7       ]'PS                  R]! ]%R7      RR 7       ]'PU                  R!4      R" R# l4       t+]'PU                  R$4      R% R& l4       t,]'P[                  R']R(7      R) R* l4       t.R# )+    )annotationsN)asynccontextmanager)Path)FastAPIHTTPException)CORSMiddleware)FileResponse)StaticFiles)run_in_threadpool)get_settings)
close_pool	init_pool)SearchRequestSearchResponse)answer_question)init_vertexz#%(levelname)s %(name)s: %(message)s)levelformatpartnerlogicstaticc                   V ^8  d   QhRR/# )   _appr    )r   s   "app/main.py__annotate__r      s           c                 "   \        4         \        4         \        4        R5x  \        4        R#   \         d    \        P	                  R 4        L>i ; i  \         d    \        P	                  R4        LYi ; i5i)z`PostgreSQL pool failed to start. UI will still load; /search will fail until the database is up.zVVertex AI failed to initialize. Set GCP_PROJECT_ID and GOOGLE_APPLICATION_CREDENTIALS.N)r   r   	Exceptionlog	exceptionr   r   )r   s   &r   lifespanr"      sh     Nzp 
L  zxyz  pnopsB   B 
4 
A B  AB AB  A=:B <A==B PartnerLogicz2MLT Aikins private document intelligence prototype)titledescriptionr"   zhttp://localhost:8000zhttp://127.0.0.1:8000GETPOSTzContent-Type)allow_originsallow_methodsallow_headersz/static)	directory)name/c                   V ^8  d   QhRR/# )r   returnr	   r   )r   s   "r   r   r   9   s     3 3\ 3r   c                 6   "   \        \        R ,          4      # 5i)z
index.html)r	   
STATIC_DIRr   r   r   indexr2   8   s     
\122s   z/healthc                   V ^8  d   QhRR/# )r   r/   zdict[str, str]r   )r   s   "r   r   r   >   s     G Gn Gr   c                    "   R RRR/# 5i)statusokinstancezMLT Aikins Private Instancer   r   r   r   healthr8   =   s     dJ(EFFs   	z/search)response_modelc                    V ^8  d   QhRRRR/# )r   payloadr   r/   r   r   )r   s   "r   r   r   C   s     G G- GN Gr   c                   "   V P                   P                  4       pV'       g   \        R RR7      h \        \        V4      G Rj  xL
 #  L  \
         d   p\        R\        T4      R7      ThRp?ii ; i5i)i  zQuestion is required.)status_codedetailNi  )questionstripr   r   r   r   str)r;   r?   excs   &  r   searchrC   B   sg     %%'H4KLLG&AAAA GCH=3FGs:   0A7A AA 
A7A A4A//A44A7)/
__future__r   logging
contextlibr   pathlibr   fastapir   r   fastapi.middleware.corsr   fastapi.responsesr	   fastapi.staticfilesr
   starlette.concurrencyr   
app.configr   app.dbr   r   
app.modelsr   r   app.ragr   
app.vertexr   basicConfigINFO	getLoggerr    __file__resolveparentr1   r"   appadd_middlewaremountgetr2   r8   postrC   r   r   r   <module>r]      sE   "  *  * 2 * + 3 # ( 4 # "   ',,/T U'(^##%,,33h>
   
D   *,CD&/!"	   		)[:6X	 F 3 3 G G )N3G 4Gr   